Table of contents
Using Magento 2 translation, you can now easily have your store localized for many different regions and markets. Indeed, the shopping has never been more convenient as your customers will view your store in their own language.
How to Creat a Translation Dictionary for Your Theme within Only 5 Minutes using Magento 2 Translation
With one existing translation, Magento allows you to create variable localizations for languages using language inheritance. Here’s an example of creating a default en_US locale dictionary:
Step 1: Locate the theme in which you want to create a translation dictionary
The example theme we have here inherits from the Magento Black theme. What we’re going to do here is to change several phrases used in the Black theme for the default locale.
Source: devdocs.magento.com
Here are all modifications when our customers view the store in the US:
- Change Add to Cart label to Purchase
- Change Add to Compare label to Compare
- Change Add to Wish List label to Wishlist
Step 2: Override the strings in the en_US dictionary file
- Run the i18n (internationalization) tool to generate the en_US dictionary:
php magento2/bin/magento i18n:collect-phrases --output="magento2/app/design/frontend/OrangeCo/orange/i18n/en_US.csv" magento2/app/design/frontend/OrangeCo/orange
- In magento2/app/design/frontend/OrangeCo/orange/i18n/en_US.csv file, add the followings:
"Add to Cart", "Purchase" "Add to Compare", "Compare" "Add to Wish List", "Wishlist"
- Run deploy command to get changes of localization:
php bin/magento setup:static-content:deploy
When we use this theme, the custom phrases will be displayed instead of the default ones.
Source: devdocs.magento.com
Congratulations! You’re almost DONE.
Hope this helps!
Further Reading:
How to Add and Configure Multi Language for your Magento Store
12 Best Free Magento Themes & Templates