Languages Translate
many times we try to translate some words on our frontend manually. but unfortunately, we can not or difficult to edit translate file. today I will show you how to do that in simple steps.
What you need?
- SSH Access
- Editor
FILES:
- Go to
app/design/frontend/package_folder/theme_folder/default/
-
Create a Folder inside the default directory call it “i18n”
-
Create file CSV inside i18n call it as your translate language ex: in my case for Arabic: “ar_SA.csv”
-
open CSV file with your editor:
app/design/frontend/package_folder/theme_folder/default/i18n/ar_SA.csv
- add any word you want to translate ex: in my case I want to translate “Store:” word to Arabic word “المتجر” … Note: it’s case-sensitive
"Store:","المتجر :",web
Explanation of the code:
"Original_Word","Translate_Word",web
-
after finish save & close.
-
Go to
app/design/frontend/package_folder/theme_folder/default/web/template/
-
Backup or Rename if exist and Create a file call it “translate.html”
-
open translate.html file with your editor
-
Add
<p data-bind="i18n: 'Store:'"></p>
Explanation of the code:
Note: it’s case-sensitive
<p data-bind="i18n: 'Original_Word'"></p>
- after finish save & close.
SSH
- Now Open SSH: Go to Magento root folder for ex: cd /var/www/html/
cd /var/www/html/
- run command:
rm -rf var/view_preprocessed/*
rm -rf pub/static/frontend/*
php bin/magento c:f
php bin/magento setup:static-content:deploy ar_SA -f -t package_folder/theme_folder/theme_Childfolder
php bin/magento c:f
Thank you and Stay Safe
Happy Coding