Reputation: 55
I currently have a fresh Magento 2 installation. A basicly have a store setup that is configured for the Dutch market.
I've read the Magento 2 devdocs on installating Language Packs (http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/xlate.html), although the documentation seems clear, I still have some questions.
Magento 2 comes with a pre-installed Dutch Language pack, located in vendor/magento/language-nl_nl. But the language pack does not contain any translated phrases.
I created a *.csv file with the Magento console, wich collected all phrases from the vender/magento dir source files. I suppose this file is meant to be used for distribution to translaters.
After a complete translation there are several options, and I doubt wich one fitch best in my situation;
Option 1 seems to have a drawback, because my Dutch translations are not directly related to the current theme, but for the store with the configured nl_NL locale.
Options 2 is unclear to me. The Magento command i18n:pack command breaks up my nl_NL.csv source file perfectly into vendor/module/i18n/nl_NL.csv files. But packing it in the vendor/magento/ dir seems not an option because of modularity problems.
Wich steps do I have to take to create a global Dutch translation that is not related with the displayed theme, is modular and can easily be distributed with amongst all my Magento 2 Projects?
Upvotes: 3
Views: 7863
Reputation: 2960
For i18n
You can make it like this
i18n
in app
folderapp/design/theme/custom
from this custom
this is your theme name folder(s)
in i18n -> custom
folder like en_us
or en_gb
or nl_nl
app/i18n/custom/nl_nl/
Now in this your language package folder make below files, all files will be in this folder structure app/i18n/custom/en_us/
app/i18n/custom/nl_nl/composer.json
{
"name": "custom/nl_nl",
"description": "English (US) language",
"version": "100.0.1",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/framework": "100.0.*"
},
"type": "magento2-language",
"autoload": {
"files": [
"registration.php"
]
}
}
app/i18n/custom/nl_nl/language.xml
<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
<code>nl_NL</code>
<vendor>custom</vendor>
<package>nl_nl</package>
</language>
app/i18n/custom/nl_nl/registration.php
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
'custom_nl_nl',
__DIR__
);
After this put your nl_NL.csv in your language pack folder
app/i18n/custom/nl_nl/nl_NL.csv
After than run this following commands
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
Hope this will helps you
Upvotes: 2
Reputation: 996
After completing translation, you can create a "language package" under app/i18n
. Folder naming conventions are <vendorname>/<language_code>
. It should contain the following files
- composer.json
- language.xml
- registration.php
Upvotes: 2