0

What is the correct way to add frontend translation for modules that are installed with composer? The solution should be updated safely. Some extension providers instruct to save the translation file xx_XX.csv into vendor/company/module/i18n/xx_XX.csv but it gets removed when the extension is updated.

It seems that for some reason the translation of some strings does not work when set in the theme's i18n folder. Only when translation is in that vendor folder mentioned before it works.

Or is there some specific reason that would cause the translation not to work from the theme folder and only work from the vendor folder?

1 Answer 1

0

Magento 2 translations fallback mechanism, by highest priority

  1. Database Translations are saved in translation table. You can added using Inline translation feature from Magento backend.

  2. Themes Translations are located in app/design/i18n folder. Magento will merge all translations files found in the current theme and his parents for the current locale.

  3. Language packages Translations are located in app/i18n/[Vendor_Name]/xx_yy folder. Magento will merge all installed language packages for the current locale.

  4. Module Translations are located in app/code/[Vendor_Name]/[Module_Name]/i18n folder.

2
  • Thanks for your answer. However for some reason in this particular instance the theme translation does not seem to take an effect for this one module as I said in the question. It should, but it just does not. Only place where the translation works is at the vendor/[Vendor_Name]/[Module_Name]/i18n. Can you come up with any reason why this would happen? All other translations work in the theme folder, but for this particular module it is not working.
    – Webninja
    Dec 16, 2021 at 13:20
  • Have you check your word was already in theme translation file? Dec 16, 2021 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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