1

I'm building an online store using Magento version 2.1.8. I've created a Luma child-theme.

Magento offers CSV files for translating most of it. But the minicart uses JavaScript for the text strings within it.

enter image description here

How can I overwrite the default English text, for Romanian?

  • If i recall correctly this should be also included in the CSV you mentioned, no matter if it is PHP or JS. – mbalparda Sep 19 '17 at 14:52
  • The Magento installation has many CSVs (every module has one). Wich CSV are you writing about? – Razvan Zamfir Sep 19 '17 at 15:01
  • I don't know which text are you trying to translate, but you can try something like this to search in the CSV files github.com/magento/magento2/… – mbalparda Sep 19 '17 at 15:46
2

For JS translate you must create language pack with below files.

/app/i18n/Myshop/ro_ro/language.xml:

<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>ro_RO</code>
    <vendor>Myshop</vendor>
    <package>ro_ro</package>
</language>

/app/i18n/Myshop/ro_ro/registration.php:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'myshop_ro_ro',
    __DIR__
);

/app/i18n/Myshop/ro_ro/ro_RO.csv with your translates (examples):

"Cart Subtotal:","Costul mărfurilor:"
"Go to Checkout","Du-te la checkout"
...

For apply your store must use Romanian locale, of course. JS translates are stored in /pub/static/frontend/Myshop/Mytheme/ro_RO/js-translation.json.

Remove this file for refresh, clear cache and browser local storage. Enjoy!

  • The file/directory structure is different from yours, in Magento 2 – Razvan Zamfir Sep 20 '17 at 7:33
  • The Vendor directory is directly under root. – Razvan Zamfir Sep 20 '17 at 7:40
  • Vendor in paths in my answer is your vendor, replace it to your development's name. It's not vendor directory under root. – Evgeny Levinsky Sep 20 '17 at 13:09
  • What is the right path in Magento version 2.1.8? – Razvan Zamfir Sep 20 '17 at 14:43
  • Ok, Razvan, what is directory of your custom theme? Tell me, please. In /app/design/frontend/.. – Evgeny Levinsky Sep 20 '17 at 16:28
0

Hello Evgeny Levinsky I have similar issue with italian language. But I'm not understanding where exactly I should create the files which you explained in the above answer. My theme files are stored in following location app/design/frontend/TemplateMonster/theme055 inside that one i18n directory is there but inside that only csv files are there. Should i create inside that or should I create new directory as following app/i18n/TemplateMonster/theme055

Please help about this. this is little urgent.

Thank You, Kishan

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.