Magento 2 – Different Static-Content Files Per Locale

localemagento2static-contentview

In Magento 2, a static content URL looks like this

http://magento-2-with-keys.dev/static/adminhtml/Magento/science/en_US/Pulsestorm_FrontendTutorial1/hello.js

This includes a en_US locale portion. This strongly implies that either

  1. Magento 2 allows you to create different static content files per locale
  2. Magento 2 processes static content files for locale/gettext strings

Which of the above is true? Or are both true? Or neither?

How do I, as a Magento module developer, provide a static content files on a per locale basis? Would this be different if I was a theme developer?

Best Answer

Magento allows to provide static asset files per locale in the module or theme. To provide such localized files, put them under web/i18n/<locale> folder inside the module or a theme. These files have priority above non-localized files.

Related Topic