How to install a language pack in Magento 2?

I tried to follow the instructions from https://mage2.pro/t/topic/270 and http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html # config-cli-subcommands-xlate-example2 but I still couldn’t.

I am trying to change the text of the search box in the title from "Search the entire store here ..." to "Suche ..."

I currently have the following files in app / i18n / Test / de_ch

  • composer.json
  • de_ch.csv
  • language.xml
  • registration.php

With this content in composer.json

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

de_ch.csv

 "Search entire store here...","Suche..." 

language.xml

 <language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> <code>de_CH</code> <vendor>Test</vendor> <package>de_ch</package> </language> 

registration.php

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

In the administrator, I configured the store (stores> Configuration> General> General> Locale options> Locale) using Deutsch (Schweiz).

Then I tried to install php bin / magento: update and php bin / magento cache: clean

But nothing, the text in the search form is still "Search the entire store here ..."

+8
translation magento2
source share
3 answers

I just tried and earned. You need to make some lowercase uppercase letters and vice versa.

  • Rename the app/i18n/Test/de_ch to app/i18n/Test/de_ch (lowercase t)
  • Rename the de_ch.csv file to de_ch.csv (in upper case CH, this should be identical to <code></code> in language.xml )
  • In language.xml change Test to Test (of course, add <?xml version="1.0"?> the top of the file). This is defined in App / Language / package.xsd
  • In registration.php also change it to test_de_ch

---- edited to add full code ---

In /app/i18n/test/de_ch Create the following files:

composer.json

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

de_CH.csv

 "Search entire store here...","Suche TESTING..." 

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>de_CH</code> <vendor>test</vendor> <package>de_ch</package> </language> 

registration.php

 <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, 'test_de_ch', __DIR__ ); 
+12
source share

You can buy it and install it :)

composer config repositories.atconnect composer https://connect20.aveo-trade.cz composer require atconnect/magento-two-language-de-de

We use this composer package structure: Magento-two languages ​​de de / composer.json

 { "name": "atconnect/magento-two-language-de-de", "description": "Magento 2.0.0: de_DE", "version": "2.0.0.2-stable", "license": [ "proprietary" ], "type": "magento2-language", "autoload": { "files": [ "registration.php" ] } } 

Magento-two languages ​​de de / language.xml

 <?xml version="1.0"?> <!-- /** * @copyright Copyright (c) AveoTrade Licence: https://connect20.aveo-trade.cz/cat:Agreement */ --> <language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd"> <code>de_DE</code> <vendor>atconnect</vendor> <package>magento-two-language-de-de</package> </language> 

Magento-two languages ​​de de / registration.php

 <?php /** * Copyright Β© 2015 AveoTrade */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, 'atconnect_magento-two-language-de-de', __DIR__ ); 

Magento-two languages ​​de de / de_DE.csv

 "1 Hour","1 Stunde",module,Magento_AdminNotification "12 Hours","12 Stunden",module,Magento_AdminNotification "2 Hours","2 Stunden",module,Magento_AdminNotification "24 Hours","24 Stunden",module,Magento_AdminNotification "6 Hours","6 Stunden",module,Magento_AdminNotification 
+2
source share

Try the following command:

php bin / magento setup: static-content: deploy

-2
source share

All Articles