How to create a language package for Magento 2?


(Dmitry Fedyuk) #1

I have created my own Russian language package for Magento 2.
Here is a step-by-step guide to create a language package.

Step 1

Run i18n:collect-phrases to collect all phrases to be translated:

An example:

bin/magento i18n:collect-phrases -o "<path to Magento>/app/i18n/df/ru_ru/dictionary.csv" -m

Step 2

Create a Magento 2 extension for the language package.

Step 2.1

Create a composer.json file.
An example from the core:

My composer.json:

	"name": "dfl/ru"
	,"type": "magento2-language"
	,"description": "Russian language"
	,"homepage": ""
	,"license": "proprietary"
	,"authors": [{
		"name": "Dmitry Fedyuk",
		"email": "",
		"homepage": "",
		"role": "Developer"
	,"extra": {"map": [["*", "df/ru_ru"]]}

Step 2.2

Create a language.xml file.
An example from the core:

My language.xml:

<?xml version='1.0'?>
<language xmlns:xsi='' xsi:noNamespaceSchemaLocation='urn:magento:framework:App/Language/package.xsd'>

Step 2.3

Create a registration.php file.
An example from the core:

I use an universal registration.php.

Step 3

Install the extension.

Step 4

Do the actual translation and keep your extension updated.
See other localization topics:

How to make the JavaScript strings localizable (translatable)
How to install an extension not from a Git repository?
(Dmitry Fedyuk) #2

See also:

(Azmaer) #3

All info how to create this extension would be more appreciated.

Same here (solution without git would be better for some people who don’t use it)

(Dmitry Fedyuk) #4

How to install an extension not from a Git repository?

How to change the "Shopping Cart" label to the "Basket" on both the and in the <title> tag itself?
(Sajid Unar) #5

I followed this bin/magento i18n:collect-phrases -o “/app/i18n/df/ru_ru/dictionary.csv” -m with . and exact path of root folder it generates only phrases from lib as it should suppose to generate from all though if i dont use -m it work fine.

Thoughts ?