Magento 2 Translate Checkout
-
17-12-2020 - |
题
I've been encountering an issue where I am unable to translate fields in Magento 2 checkout.
Steps I have take:
- Created
app/design/frontend/Company/theme/i18n/en_US.csv
Added strings to update:
"Review & Payments", "Review & Pay", "Apply Discount Code", "Apply Promotional Code"
Ran the following:
bin/magento setup:upgrade bin/magento cache:flush php bin/magento setup:content-static:deploy en_US
When refreshing the frontend, the translation in the checkout does not update. However, using the same steps works for all other front-end aspects of the site.
解决方案
After much head banging and trying I finally figured out what the problem was. Localizing inside a theme such as app/design/frontend/Company/theme/i18n/en_US.csv
does appear to get incorporated into the knock-out translations in the checkout. Why? I'm not sure, but I did come up with a solution that worked by creating an entire language pack.
Step 1, create a CSV of all translatable phrases used in the store. Run the following in ssh:
php bin/magento i18n:collect-phrases -o en_US.csv -m
Step 2, create a language pack such as app/i18n/CompanyName/en_US/
instructions on creating dictionaries and language packs are available in the Magento 2 developer documentation at http://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-i18n.html
Step 3, Update the phrases in the language pack to match the translation and localization needs
Step 4, refresh caches and deploy via ssh:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy en_US
A full write up including each step for creating a language pack can be found at http://www.ecommercegorilla.com/translation-localization-of-a-magento-2-store/
其他提示
Before you delete this empty file
Normally this file is generated by language you have to launch a
php bin/magento setup:static-content:deploy fr_FR en_US
tell me if that work