Search code examples
translationmagento2production

Magento 2 Translations in Minicart and Checkout in production mode


We've got an issue with translations in production mode. Our translations works and loads correctly in developer mode with MaterializationStrategy set to Copy.

When we deploy to production we run the following:

bin/magento maintenance:enable
composer install
bin/magento cache:clean
bin/magento cache:flush
bin/magento setup:upgrade --keep-generated
bin/magento setup:di:compile
bin/magento setup:static-content:deploy da_DK de_DE en_US es_ES fr_FR it_IT nl_NL nb_NO sv_SE fi_FI
bin/magento cache:clean
bin/magento cache:flush
bin/magento maintenance:disable

The problem is that translations aren't working in the Minicart and during checkout. The danish translations are loaded on all locales.

Try adding af product to the cart on https://floatinggrip.com


Solution

  • Found this issue : https://github.com/magento/magento2/issues/7862

    Bug from Magento static content deployment optimization on js translations generations.

    Here is the workaround :

    php bin/magento setup:static-content:deploy --theme=Magento/luma en_US
    php bin/magento setup:static-content:deploy --theme=Magento/luma nl_NL
    php bin/magento setup:static-content:deploy --theme=Magento/luma fr_FR
    

    Replace by your theme, and dont forget the backend theme :

    php bin/magento setup:static-content:deploy --theme=Magento/backend en_US