Translation
Our extension supports multilanguage stores. To translate it, we have used the same logic as default Magento.
General Information
All our translation files are in the "/i18n" folder of each sub-module.
i18n files should be located at:
- vendor/mirasvit/module-name/src/ModuleName/i18n - if installed via composer;
- app/code/Mirasvit/ModuleName/i18n - if installed manually.
Create a separate .csv file of your language for our extension. The names of all languages can be found with this command:
php -f bin/magento info:language:list
Override the strings in your dictionary file:
"Original line" , "Translated line"
To avoid rewriting the file with the updating of the module, replace the translation file to your theme directory at app/design/frontend/THEME_VENDOR/theme_name/i18n/lg_LG.csv.
Where lg_LG.csv is a translation file in another locale.
To apply changes run static content deploy :
rm -rf pub/static/*
rm -rf var/view_preprocessed/*
php -f bin/magento setup:static-content:deploy
php -f bin/magento cache:flush
Example: translate "Sorry, nothing found for" and "Show all results" in Autocomplete:
- Open src/SearchAutocomplete/i18n/ directory to find the translation files;
- Make a copy of original en_EN.csv file, for example, nl_NL.csv file;
- Open nl_NL.csv file for editing;
-
If Fast Mode enabled at the Autocomplete settings
Change lines as below:
"Sorry, nothing found for ""%1."" change %1 to %s
"Show all %1 results →" change %1 to %d"Sorry, nothing found for ""%s."", "Sorry niets gevonden voor ""%s.""
"Show all %d results →", "Toon alle %d resultaten →"
4) Temporarily disable a Fast mode in the autocomplete settings;
5) Run static content deploy;
6) Enable Fast Mode and run Magento reindex. -
If Fast Mode disabled at the Autocomplete settings
Change lines as below:
"Sorry, nothing found for ""%1."", "Sorry niets gevonden voor ""%1.""
"Show all %1 results →", "Toon alle %1 resultaten →"
4) Run static content deploy;
Please do not add both kinds of translations in your locale file for a Fast mode enabled and disabled option. It will not work.