This blog explains how to create language package on Magento 2. Here's the example of Vietnamese language.
1. Generate dictionary file
$ cd /root/dir/magento
$ bin/magento i18n:collect-phrases --output="app/design/frontend/vendor_name/theme_name/i18n/vi_VN.csv" --magento ./
2. Create language pack and register it
$ bin/magento i18n:pack -d app/design/frontend/app_name/theme_name/i18n/vi_VN.csv ./ vi_VN
3. Modify config files
Add & modify these 3 files.
# app/i18n/app_name/vi_VN/composer.json
{
"name": "app_name/language-vi_vn",
"description": "Vietnamese language",
"version": "100.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/framework": "100.0.*"
},
"type": "magento2-language",
"autoload": {
"files": [
"registration.php"
]
}
}
# app/i18n/app_name/vi_VN/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
'magento_vi_vn',
__DIR__
);
# app/i18n/app_name/vi_VN/language.xml
# PLEASE NOTICE MANUAL IS WRONG
# package MUST BE LOWER CASE
<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
<code>vi_VN</code>
<vendor>app_name</vendor>
<package>vi_vn</package>
<sort_order>100</sort_order>
</language>
Reference
http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html#m2devgde-xlate-files
If you liked this article
Let's subscribe the updates of Scuti!
This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
Please help.
ReplyDeleteAfter refresh frondend I get an error as the following:
Notice: Undefined offset: 1 in /var/www/html/megamart/vendor/magento/framework/App/Language/Dictionary.php on line 183
What was happening ? Thanks
I can't give you exact answer with only this information but CSV format is correct? I see this person also encountered the same problem.
Deletehttp://magento.stackexchange.com/questions/101692/problem-when-create-a-language-package-for-magento-2
I might want to thank you for the endeavors you have made in composing this article. I am trusting the same best work from you later on too.. Magento extensions by Mageworx
ReplyDeleteVery helpful post! Thanks for sharing. I'd also like to suggest one ready-made tool called Google Translate Integration Magento 2 Extension. This module allows to translate your Magento 2 store content to more than 100 languages. Know more here: https://marketplace.magento.com/solwin-googlelanguagetranslate.html
ReplyDeleteMua vé máy bay tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ giá bao nhiêu
vé máy bay phú quốc về sài gòn
vé máy bay nha trang hà nội
vé hà nội nha trang
giá vé máy bay đà nẵng đi đà lạt
taxi 7 chỗ đi sân bay nội bài
combo nha trang 4 ngày 3 đêm 2021
Aivivu - đại lý chuyên vé máy bay trong nước và quốc tế
ReplyDeletegia ve may bay di my
vé máy bay từ mỹ về vn
mua vé máy bay từ đức về việt nam
mua vé máy bay từ nga về việt nam
vé máy bay từ anh về việt nam
vé máy bay từ pháp về việt nam
danh sách khách sạn cách ly tại tphcm