7

I am trying to create a new store view for the Tamil Language, but the language does not get listed while choosing the language from admin.

short description of what I have done

1) I have successfully created Tamil Store View. Please refer the screenshot for your easy reference.

tamil store view

2) Next, I am trying to add Tamil Language Package

2.1 collect phrases

create the folder /var/www/html/magento2/app/i18n/tamil/tn_tn/

after that run the below command and get a success message

php bin/magento i18n:collect-phrases -o "/var/www/html/magento2/app/i18n/tamil/tn_tn/dictionary.csv" -m "/var/www/html/magento2/"

2.2 composer.json

{
    "name": "tamil/tn"
    ,"type": "magento2-language"
    ,"description": "Tamil language"
    ,"authors": [{
    "name": "Bilal Usean",
    "email": "yyyyyy@yyyyy.yyy",
    "role": "Developer"
    }]  
    ,"extra": {"map": [["*", "tamil/tn_tn"]]}
}

2.3 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>tn_TN</code>
    <vendor>tamil</vendor>
    <package>tn_tn</package>
</language>

2.4 registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
   \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
   'tamil_tn_tn',
   __DIR__
);

2.5 Translate

dictionary.csv contains 8000+ rows of phrases for the sample I have taken one (open in gedit)

"We found other products you might like!","We found other products you might like!",module,Magento_Catalog

tn_TN.csv I have translated above particular line (contains one row)(open in gedit)

"We found other products you might like!","நீங்கள் விரும்பக்கூடிய மற்ற பொருட்கள் காணப்படும் !",module,Magento_Catalog

2.6 Language pack

run the below command for creating the language pack and get a success message Successfully saved tn_TN language package.

php bin/magento i18n:pack -d app/i18n/tamil/tn_tn/tn_TN.csv tn_tn tn_TN

It will create directory (tn_tn pack)

<magento-root>/tn_tn/vendor/magento/module-catalog/i18n/tn_TN.csv

someone noted it, collect phrases and lang pack commands are different from the official doc, please refer this link for why am I using like this way.

Overall structure of my language package

enter image description here

After that clear cache, run setup:upgrade, indexer:reindex but I can't found my Tamil language pack in newly created Tamil store view locale options.

easy for your reference

I would like to mention one more, I have researched about existing lang pack /var/www/html/magento2/vendor/magento/language-de_de (composer.json, language.xml, registration.php) but unable to find the exact name of the locale like listed in admin(German (Germany)). So I confused any step I missed to create locale.

why Tamil language package does not get installed?

5

Step 1: collect the phrases

First, you need to find out the phrases that you need to translate.

You can do so by running:

php bin/magento i18n:collect-phrases -o "/path/to/magento2/app/i18n/vendor/lg_lg/dictionary.csv"

Note that vendor is the same as when you develop module and lg_lg is the lang code of your language.

Step 2: create the composer.json file

Go to your app/i18n/vendor/lg_lg folder and create the composer.json file:

{
    "name": "vendor/lg"
    ,"type": "magento2-language"
    ,"description": "Tamil language"
    ,"authors": [{
        "name": "Bilal Usean",
        "email": "bla@bla.com",
        "role": "Developer"
    }]  
    ,"extra": {"map": [["*", "vendor/lg_lg"]]}
}

Step 3: create the language.xml file

Still in your app/i18n/vendor/lg_lg folder you need to create a language.xml file:

<?xml version='1.0'?>
<language xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='urn:magento:framework:App/Language/package.xsd'>
    <code>lg_LG</code>
    <vendor>vendor</vendor>
    <package>lg_lg</package>
</language>

Step 4: create the registration.php file

Still in the same folder, you need to create a registration.php file:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
   \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
   'vendor_lg_lg',
   __DIR__
);

Step 5: translate

Still in your folder, you can start writing your translations in a lg_lg.csv file based on the dictionary you retrieved in step 1. You can use the offical guide to follow the translation guidelines: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html#config-cli-subcommands-xlate-dict-trans

Step 6: create the language pack

Run the following command:

php bin/magento i18n:pack app/i18n/vendor/lg_lg/lg_lg.csv lg_Lg lg_LG

Important note

For this to work, your .csv file name must exactly match the locale, including the characters' case.

Official documentation: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html#config-cli-subcommands-xlate-example2

2

in Tamil you must add iso code and international code for Tamil ta_IN (Tamil- ta / INDIA - IN) https://www.w3schools.com/tags/ref_language_codes.asp https://www.w3schools.com/tags/ref_country_codes.asp

and you need to add this code in vendor/magento/framework/Locale/config.php directory enter image description here

then you install by using command "php bin/magento setup:static-content:deploy -f ta_IN"

hope it will work

enter image description here

1

You can't add new language in the General locale option

The reason is because magento uses php intl library to populate the select box

see the following file

vendor/magento/framework/Locale/TranslatedLists.php

method _getOptionLocales()

  • i think so, How can we customize or add new local language.. – matinict Apr 1 '18 at 9:35
  • @matinict you can utilize existing unused one. – Nahid Jun 26 at 10:55
0

Here is a step-by-step guide to create a language package.

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:

magento/magento2/blob/2.0.0/app/i18n/magento/de_de/composer.json

{
    "name": "magento/language-de_de",
    "description": "German (Germany) language",
    "version": "100.0.2",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "100.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

My composer.json:

{
    "name": "dfl/ru"
    ,"type": "magento2-language"
    ,"description": "Russian language"
    ,"homepage": "https://mage2.pro"
    ,"license": "proprietary"
    ,"authors": [{
        "name": "Dmitry Fedyuk",
        "email": "admin@mage2.pro",
        "homepage": "https://mage2.pro/users/dmitry_fedyuk",
        "role": "Developer"
    }]  
    ,"extra": {"map": [["*", "df/ru_ru"]]}
}

Step 2.2

Create a language.xml file.

An example from the core:

magento/magento2/blob/2.0.0/app/i18n/magento/de_de/language.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>de_DE</code>
    <vendor>magento</vendor>
    <package>de_de</package>
</language>

My 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>ru_RU</code>
    <vendor>df</vendor>
    <package>ru_ru</package>
</language>

Step 2.3

Create a registration.php file.

An example from the core:

magento/magento2/blob/2.0.0/app/i18n/magento/de_de/registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'magento_de_de',
    __DIR__
);
?>

I use an universal registration.php66.

Step 3

Install the extension

Step 4

Do the actual translation and keep your extension updated. See other localization topics: https://mage2.pro/tags/localization

Source.

  • thanks, already I had tried this link but it will not listed created language in store view. – Bilal Usean May 23 '16 at 10:57
  • did you guess anything I miss? I have updated my question – Bilal Usean May 23 '16 at 11:06
  • Have you run setup and cleared the cache ? – Arunendra May 23 '16 at 11:12
  • yes I did but the problem remains, How to check language extension status? like (config.php or any command line) – Bilal Usean May 23 '16 at 12:00
0

Step1: Create the file composer.json like this

{
   "name": "tamil/tn_tn",
   "description": "Tamil language",
   "authors": [{
     "name": "Bilal Usean",
     "email": "xxxxxxx@xxxx.xxx",
     "role": "Developer"
   }],
   "require": {
     "magento/framework": "100.0.*"
   },
   "type": "magento2-language",
   "autoload": {
     "files": [
       "registration.php"
     ]
   }
   ,"extra": {"map": "*", "tamil/tn_tn"}
 }

Step2: Create the file language.xml like this

<?xml version="1.0"?>
 <language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
   <code>tn_TN</code>
   <vendor>tamil</vendor>
   <package>tn_tn</package>
 </language>

Step3: Create the file registration.php like this

<?php
 \Magento\Framework\Component\ComponentRegistrar::register(
     \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
     'tamil_tn_tn',
     __DIR__
 );

Step4: Now place the translated file tn_TN.csv in the /app/i18n/tamil/tn_tn directory

  • still the problem remains..... not listed in newly created store view, anything need to be configured from backend? – Bilal Usean May 23 '16 at 11:54
  • syntax: you missed comma (,) in author – Bilal Usean May 23 '16 at 12:09
  • Fixed and added (,) ... you must install it after creating, did you? – sIiiS May 23 '16 at 14:14
  • install mean run setup:upgrade – Bilal Usean May 23 '16 at 14:46
  • @BilalUsean: Yes, run php bin/magento setup:upgrade ... after that open /app/etc/config.php and check value of tamil_tn_tn be 1 – sIiiS May 23 '16 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.