Magento2: Some texts are not translated

Created on 10 Jan 2016  Â·  45Comments  Â·  Source: magento/magento2

I have found another bug in Magento 2 and it is concerning translation. I have placed translation file: /app/i18n/desytec/es_es/es_ES.csv to translate to Spanish.

It works but not for some texts. For example, if you connect to http://www.vtrack.cl/catalogsearch/advanced/, you will see almost all form texts in English instead of Spanish. Maybe texts are hard coded, because if you see "Advanced Search" text at the bottom of the page it was translated correctly into Spanish, but not in the Title.

If I searched the entry in the CSV file, i saw:
"Advanced Search","Búsqueda avanzada"

The same for all fields in form and for other pages.

Other case is the contact form page: http://www.vtrack.cl/contact/. "This is a required field." message validation is still in English even when it is translated in CSV file. This happens to all forms.

Regards
Jaime

Translation Format is not valid Ready for Work bug report

Most helpful comment

GREAT we are celebrating 1 year open bug, thx magento team

All 45 comments

They are attributes and you should add your word in the "Default Store View" in product attributes
go to "Stores -> Attributes -> Product" and change them!

You are wrong or misunderstood the issue.

You are talking about attributes for product catalog, however, I was talking about translation that has nothing to do with products, for example, translation for the sentence "Advanced Search" title as clearly says in the issue description.

Regards
Jaime.

it is not cache problem... you have just actually confirmed that it is a bug. For example, with respect to "Advanced Search" you said that I need to open a core file and change the text. Do you think it is a normal procedure for a multilanguage site? why is not the translation file taken into account for this sentence? This sentence is translated in the CSV file.

By the way, "Advanced Search" was only an example. Along the site, there are many other non translated titles. Another one is "Contact Us" form title. Please connect to: http://www.vtrack.cl/contact/. You will see "Contact Us" as the title, but the link at page bottom you will see the right Spanish version "Contáctenos". And in the CSV file, this entry exists:

"Contact Us","Contáctenos"

This entry should translate the form title, but it did not.

Regards,
Jaime

Yes, for "Advanced Search" and several titles and lables!
Also for Cache lable and descriptions too!

"Advanced Search" is here
{magento2 root}/vendor/magento/module-catalog-search/view/frontend/layout/catalogsearch_advanced_index.xml
in this file you can find it : <title>Advanced Search</title>

What about "Contact Us" title? "You have no items in your shopping cart." text? or "This is a required field?" validation message? All of them are not translated even when that texts exists in the CSV file.

You said that for "Advanced Search" and several titles, it is needed to correct in the core files, but, I think Magento developers should be notified about this so that make all of these translatable texts.

Please search the open issues in this Github. Multiple issues have already been opened and confirmed

Concerning "Privacy and Cookie Policy" text I have found the correction to this bug.

First, this entry was in /module-cms/view/frontend/layout/default.xml file this way:
[argument name="label" xsi:type="string"]Privacy and Cookie Policy[/argument]

I have added "translate" attribute, so that it became:
[argument name="label" xsi:type="string" translate="true"]Privacy and Cookie Policy[/argument]

However, this did not work either because "Privacy and Cookie Policy" text was not in CSV file (the one that was generated using the magento application, another bug?). So, I have added "Privacy and Cookie Policy" entry to the CSV file and problem was gone.

Concerning "Advanced Search" and "Contact Us" texts, I have changed directly in core files as suggested.

I could not find the "required field" message yet, but I keep looking.

I found are at least three ways titles are set:

1) with title tag

<head>
    <title>Advanced Search</title>
</head>

which doesn't translate

2) with reference to page title

<referenceBlock name="page.main.title">
    <action method="setPageTitle">
        <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>
    </action>
</referenceBlock>

which translates correctly,

3) directy via PHP

$this->pageConfig->getTitle()->set(__('Create New Customer Account'));

which translates correctly as well.

This is very confusing and need to be unified.

Is there any Update? We still have the problem that we cant translate titles correctly without a workarround.

We also have this issue. We can't translate the title of the Contact page because it uses method 1 which is not translatable.

We are facing a similar problem, but it happens when we use accented letters, like í ú. In portuguese it is very common to have words with accents... In this case, some translations are not shown in the frontend. Any ideia?

Edit this file "vendor/magento/module-theme/view/frontend/templates/html/title.phtml"(So for that first copy that to theme).
Replace :

$title = '<span class="base" data-ui-id="page-title-wrapper" ' .  $block->getAddBaseAttribute() . '>'
    . $block->escapeHtml($block->getPageHeading()) . '</span>';

With:

$title = '<span class="base" data-ui-id="page-title-wrapper" ' .  $block->getAddBaseAttribute() . '>'
    . __($block->escapeHtml($block->getPageHeading())) . '</span>';

This will work for me "/contact","sales/guest/form/" etc page.

Any update about this? Same problem about the tag "Forgot Your Password" you can't translate. This should be fixed. Thank you!

@PieterCappelle This issue has already been fixed in latest development branch. Will be moved to stable branch in one of the upcoming releases.

@thomvanderboon Great! I can't find anywhere in this issue that it has been fixed, how do you know such a things? (we are always working on stable releases like 2.0.6 right now)

I've created a patch for "Privacy and Cookie Policy" translation in pull request https://github.com/magento/magento2/pull/5400

Thanks for response. Internal ticket MAGETWO-56872 was created.

Any news regarding the "Advanced Search" as a title string? Problem still persists in 2.1.1 version.

"Forgot Your Password" not translatable problem still exists in 2.1.1

The issue doesn't seem to be that it is untranslatable. It seem that 'Forgot Your Password' isn't in the translation package. Magento should add those to the Crowdin translations as well.

any updates regarding this?? still same for me on 2.1.1

same issue in magento 2.1.3

GREAT we are celebrating 1 year open bug, thx magento team

This problem really s**ks!!

Unable to translate:

  • Review & Payments
  • Order Summary
  • And many more.

Spending already hours to find it.

I have them translated.... which version do you use? 2.1.2 ?

Oh really? How? I'm running 2.1.3.

Any update or known workaround for this issue? Our customers don't know English!!!

I am going to show you the step by step work arround for getting a working translated site.

I use the Magento Crowdin Translation file. Please visit https://crowdin.com/project/magento-2

I am going to create a Dutch (nl_nl) translation. The Crowdin file is currently at 92%. Is it perfect? No! It is good enough.

Please change as needed

From document root create the following directories:

mkdir app/i18n
mkdir app/i18n/test
mkdir app/i18n/test/nl_nl
cd app/i18n/test/nl_nl

Create composer.json

{
    "name": "test/language-nl_nl",
    "description": "Dutch (Netherlands) language",
    "version": "100.0.2",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "100.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

Create language.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>nl_NL</code>
    <vendor>test</vendor>
    <package>nl_nl</package>
</language>

Create registration.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>nl_NL</code>
    <vendor>test</vendor>
    <package>nl_nl</package>
</language>

Download the appropriate file from the Crowdin Translation Project

wget http://107.170.242.99/var/2.1.0/source_nl_NL.csv

Go back to document root

cd ../../../../

Run the following commands from document root:

find . -name js-translation.json -exec rm -rf {} \;
php bin/magento setup:static-content:deploy en_US 
php bin/magento setup:static-content:deploy nl_NL
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

DO NOT and I mean DO NOT run the php bin/magento i18n:pack command. Keep the translation file in one file.

Change your store view to match the language you want to display

thomvanderboon is GOD

@thomvanderboon thanks for the workaround, but it's not working for me in 2.1.5. I've followed the steps above exactly, but the en_GB translation I'm trying to create just gives lots of blank js files, and the nl_NL files only give a single translation:

more ./var/view_preprocessed/source/adminhtml/Magento/backend/nl_NL/jstranslation.json
{"Are you sure you want to do this?":"Weet je zeker dat je dit wilt doen?"}

Please note

a) if translation is same as original it will not be in the json file.
b) You need to reload the page twice

But for example this file:
./pub/static/frontend/Magento/blank/nl_NL/js-translation.json
just contains '[]'. Shouldn't it be full of translations?

Hi Thomvanderboon, Thanks for your explanation. I have tried to follow your instructions, but unfortunately, it doesn't work. My Directory structure looks like this (please see screenshot). Is that correct?

https://snag.gy/OMEUr7.jpg

E.g. "Order Summary" is in the CSV, but it is not translated.

Thanks!

Hi thomvanderboon, I have tried to follow your instructions and the page was translated on my local pc. Why after bundle js on server EC2 AWS (nginx) the translation in validation.js like (this is a required field.) the message not translate?

I'm on 2.1.6 i'm still not able to translate /catalogsearch/advanced/ page title. I think rewriting theme files is not right way for this.

Hello,

I'm also on 2.1.6 and I'm not able to translate the Contact page title.

Hello,

2.1.7 and I have problems to translate some elements of the cart, and the checkout.

'Go to checkout', 'Cart total', 'View and edit cart', 'Shipping address', 'Order summary', 'Shipping methods' and mainly every single one validation message of the checkout form, and some other ones.

Hello everyone.

If someone encounters a Problem with loading order of the translations(not the generation of the js-translation.js), you may find the following Issue interesting:
https://github.com/magento/magento2/issues/7363

Greetings
Elias

Part of the issues, with page titles not translating is described here #6337 and a solution is proposed here #9992. It solves the contact us issue and likely other page title issues. Does any title problems still exist?

In the response of @thomvanderboon, what is the difference between what you are proposing and creating a localization?

In front of what @jeanpham describes, I'm on 2.17 and don't have the same issue (where I am able to find the corresponding English and translated sentences you refer to). If those errors still exist, could you specify where you see them? In addition, could you also describe what happens if and when you use the inline translation tools on these sentences?

Found out that my translations problems were because of deploying files.

with this :php bin/magento setup:static-content:deploy
problem with CSS and JS

php bin/magento setup:static-content:deploy -l en_US -l fr_FR
Problems with some translations not working (due to overwriting)

php bin/magento setup:static-content:deploy -l fr_FR
No more problems

So final solution for me was to launch these line in a upgrade.sh file at the root of magento :

php -f bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -l fr_FR
php bin/magento cache:flush

Is the Bug now fixed ?

Run the following commands from document root:
find . -name js-translation.json -exec rm -rf {} \;
php bin/magento setup:static-content:deploy en_US 
php bin/magento setup:static-content:deploy nl_NL
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

DO NOT and I mean DO NOT run the php bin/magento i18n:pack command. Keep the translation file in one file.

@thomvanderboon This was of great help but I have a problem. Before finding these instructions I actually went ahead and ran the above command you suggested absolutely not to run. So now, whenever I do setup:upgrade or similar action, the manually added pack translations are lost.

Is there a way to remove additional packages and only keep the manually added translation? Of course I would like to keep i18n files for modules that are not included in the core translation files.

I did a total manual clean-up.... trial and error

Met vriendelijke groet, Best regards,

Thom van der Boon
E-Mail: [email protected]

=====

Thom.H. van der Boon b.v.
Transito 4
6909 DA Babberich
Tel.: +31 (0)88 4272727
Fax: +31 (0)88 4272789
Home Page: http://www.vdb.nl/

Van: "DripperCoffee" notifications@github.com
Aan: "magento/magento2" magento2@noreply.github.com
Cc: "Thom van der Boon" thom@vdb.nl, "Mention" mention@noreply.github.com
Verzonden: Donderdag 24 augustus 2017 10:30:32
Onderwerp: {Disarmed} Re: [magento/magento2] Some texts are not translated (#2951)

Run the following commands from document root:
find . -name js-translation.json -exec rm -rf {} ;
php bin/magento setup:static-content:deploy en_US
php bin/magento setup:static-content:deploy nl_NL
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

DO NOT and I mean DO NOT run the php bin/magento i18n:pack command. Keep the translation file in one file.

@thomvanderboon This was of great help but I have a problem. Before finding these instructions I actually went ahead and ran the above command you suggested absolutely not to run. So now, whenever I do setup:upgrade or similar action, the manually added pack translations are lost.

Is there a way to remove additional packages and only keep the manually added translation? Of course I would like to keep i18n files for modules that are not included in the core translation files.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub , or mute the thread .
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/magento/magento2","title":"magento/magento2","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/magento/magento2"}},"updates":{"snippets":[{"icon":"PERSON","message":"@DripperCoffee in #2951: \r\nRun the following commands from document root:\r\nfind . -name js-translation.json -exec rm -rf {} \\;\r\nphp bin/magento setup:static-content:deploy en_US \r\nphp bin/magento setup:static-content:deploy nl_NL\r\nphp bin/magento indexer:reindex\r\nphp bin/magento cache:clean\r\nphp bin/magento cache:flush\r\nrnrnu003e DO NOT and I mean DO NOT run the php bin/magento i18n:pack command. Keep the translation file in one file.rnrn@thomvanderboon This was of great help but I have a problem. Before finding these instructions I actually went ahead and ran the above command you suggested absolutely not to run. So now, whenever I do setup:upgrade or similar action, the manually added pack translations are lost. rnrnIs there a way to remove additional packages and only keep the manually added translation? Of course I would like to keep i18n files for modules that are not included in the core translation files."}],"action":{"name":"View Issue","url":"https://github.com/magento/magento2/issues/2951#issuecomment-324569700"}}}

I'm facing the same problems with Finnish translations (Magento ver. 2.1.7). The main pages are translated but all the Magento_Checkout translations are in English.

Once I got it working with
find . -name js-translation.json -exec rm -rf {} ;
php bin/magento setup:static-content:deploy en_US
php bin/magento setup:static-content:deploy fi_FI
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

I though that this will be the permanent solution... but I was totally wrong.

When the set of commands were rerun the all checkout texts are back in English.

Hello everyone. Thank you for your reports, suggestions and comments. Unfortunately, we should lock this issue for now. We already fixed most of the cases described in this issue and will deliver the fixes with release 2.2.0 very soon. If you still have other issues, please, report separate issues otherwise this will be infinite loop. Thank you for collaboration!

Was this page helpful?
0 / 5 - 0 ratings