1

I have a situation where I need to save values in couple of languages, Arabic and English at a save form, So I have two fields with the name Product Name and اسم المنتج i.e Product Name in Arabic, So I need a way I can translate the value in given locale i.e. ar_SA

Note: The Product Name is the primary textbox where as the اسم المنتج will be secondary at the Store View for en_US and vise versa in the case of Store View for ar_SA so I cannot hard code the text, I need it to be dynamically changed on the basis of current locale of the Store

I tried using Translate\Adapter class here but no luck

use Magento\Framework\Translate\Adapter as TranslateAdapter;

...

$translateAdapter = new TranslateAdapter();
return $translateAdapter->translate('Edit Product', 'ar_SA');

but no luck it returns the same Edit Product string, I already have Edit Product in my i18n/ar_SA.csv file

"Edit Product","تحرير المنتج"
"Save","حفظ المنتج"
"Product Name","اسم المنتج"
"Description","وصف"
"Short Description","وصف قصير"
  • product name is a magento attribute? – Adrian Z. Mar 13 '18 at 8:15
  • I have it in my .csv files @AdrianZ. – riksof-zeeshan Mar 13 '18 at 8:15
  • Did you get the answer @riksof-zeeshan – Keyur Shah Oct 12 '18 at 10:50
0

If you are trying to translate the label from the Magento Edit Product Page, i would recommand using the attribute store view label translate from Stores > Atrributes -> Product. Go to the needed attribute and change the label for every storeview you have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.