If you add a translation to a language CSV file (such as de_DE.csv), it may not be included correctly in your theme’s js-translation.json . Consequently, messages such as validation errors remain untranslated. To fix this, override vendor/magento/module-translation/Model/Json/PreProcessor.php and make the following change:
|
1 2 |
$area = $this->areaList->getArea($areaCode); $area->load(\Magento\Framework\App\Area::PART_TRANSLATE); |
becomes
|
1 2 3 |
$area = $this->areaList->getArea($areaCode); $area->load(\Magento\Framework\App\Area::PART_DESIGN); $area->load(\Magento\Framework\App\Area::PART_TRANSLATE); |
After redeploying the static content, your translation should appear in your theme’s js-translation.json and work on the storefront.
JavaScript translations are not working
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.