1

I just installed this language pack:

http://imaginaerum.github.io/magento2-language-fr-fr/en.html#section-installation

The way I installed it was like this: 1. create folder via ftp in app/i18n/imaginaerum/fr_fr/ unzip file here 2. create store view and change language to french (france).I used language code "fr"

it works.

I'm curious how Magento knew to use that folder as a language pack. It seems to me I did nothing to really connect the language choice with that pack. And while it is doing exactly what I want I don't know how/why so I am kind of curious as I am just starting to learn how magento works.

  • for all languge there is specific code. for example : fr_fr and you select french from admin. so magento will check if languge pack is available it will use it or use magento default text – Kul Jan 17 '17 at 15:55
  • @Kul How did Magento know to look in that folder for the code though? Is there a specific folder that magento looks for language packs? – Sackling Jan 17 '17 at 16:02
1

If you look into app/i18n/Magento you can find different language packages. Every package to be recognized by Magento must have registration.php file.

We have 2 cases to read this file.

1. Install via composer.

To be executed this file must be added to composer.json in the package directory.

"autoload": {
    "files": [
        "registration.php"
    ]
}

2. Not installed via composer

Magento looks for this file in predefined dirs.

See

app/etc/NonComposerComponentRegistration.php

line

$pathList[] = dirname(__DIR__) . '/i18n/*/*/registration.php';

That's it.

Same mechanism exists for modules and themes which allows to be placed either under app or vendor folders.

| improve this answer | |

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.