cancel
Showing results for 
Search instead for 
Did you mean: 

Translation of template files

SOLVED

Translation of template files

I try to translate the "Go to Checkout" button in the minicart but it does not wor Smiley Sad
How can I get a translation for these strings which are not using the _('to translate') method?
Do I need to overwrite them in a new Theme?
Even for the js files I could also do the translation via csv file created by the i18n:collect-phrases task.

e.g. in app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html
<!-- ko if: getCartParam('possible_onepage_checkout') -->
<div class="actions">
    <div class="primary">
        <button
                id="top-cart-btn-checkout"
                type="button"
                class="action primary checkout"
                data-bind="attr: {title: $t('Go to Checkout')}">
            <!-- ko i18n: 'Go to Checkout' --><!-- /ko -->
        </button>
        <div data-bind="html: getCartParam('extra_actions')"></div>
    </div>
</div>
<!-- /ko -->
thanks for your help in advance!
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Translation of template files

So I checked out the latest version from the git repository (branch develop).

But still the same problem!

It took me lots of ours to prepare a second full untouched and new environemnt to check this now. Waste of time Smiley Sad

Do you habe any other ideas?

 

<div class="primary">
                <button
                        id="top-cart-btn-checkout"
                        type="button"
                        class="action primary checkout"
                        data-bind="attr: {title: $t('Go to Checkout')}">
                    <!-- ko i18n: 'Go to Checkout' --><!-- /ko -->
                </button>
                <div data-bind="html: getCartParam('extra_actions')"></div>
            </div>

=> Go to Checkout seems still to be not translatable:

 

 

My de_DE.csv file contains this record:

 

"Go to Checkout","Bestellung abschließen","module","Magento_Checkout",,

 

I've nearly an complete Magento2 de_DE translation but things like that let me get really crazy Man Frustrated

 

regards

 

 

 

Edit 2016-01-16

Even the "developers inline translate tool" is not able to translate this button after translating it. The translation is just stored in the database table "translation" correctly but does also not work.

 

 

Edit 2016-01-16

After spending several hours with translation and fixing this issue I found the problem myself!

The "bin/magento setup:static-content:deploy" is mandatory to get a full translation. Flushing static files and cache is not enough for all translations. So I close this issue.

View solution in original post

6 REPLIES 6

Re: Translation of template files

There was 2 bugs in the Magento 2 frontend translation:

 

  • data-bind i18n expressions with JavaScript function calls are used in the core but untranslatable due to regular expression and architectural limitations: https://mage2.pro/t/72
  • Bug: i18n phrases with apostrophes (') in Knockout templates are untranslatable (and my fix): https://mage2.pro/t/86

They are not fixed in the Magento 2.0.0 release.

As the Magento 2 team stated, they has been fixed at 2015-12-23:

So for now, you should the latest Magento 2 developer version, not 2.0.0 release to get it fixed.

 

Re: Translation of template files

So I checked out the latest version from the git repository (branch develop).

But still the same problem!

It took me lots of ours to prepare a second full untouched and new environemnt to check this now. Waste of time Smiley Sad

Do you habe any other ideas?

 

<div class="primary">
                <button
                        id="top-cart-btn-checkout"
                        type="button"
                        class="action primary checkout"
                        data-bind="attr: {title: $t('Go to Checkout')}">
                    <!-- ko i18n: 'Go to Checkout' --><!-- /ko -->
                </button>
                <div data-bind="html: getCartParam('extra_actions')"></div>
            </div>

=> Go to Checkout seems still to be not translatable:

 

 

My de_DE.csv file contains this record:

 

"Go to Checkout","Bestellung abschließen","module","Magento_Checkout",,

 

I've nearly an complete Magento2 de_DE translation but things like that let me get really crazy Man Frustrated

 

regards

 

 

 

Edit 2016-01-16

Even the "developers inline translate tool" is not able to translate this button after translating it. The translation is just stored in the database table "translation" correctly but does also not work.

 

 

Edit 2016-01-16

After spending several hours with translation and fixing this issue I found the problem myself!

The "bin/magento setup:static-content:deploy" is mandatory to get a full translation. Flushing static files and cache is not enough for all translations. So I close this issue.

Re: Translation of template files

Where did you put your translation string? Can you provide file and path?

Re: Translation of template files

Where did you put your translation string? Can you provide file and path?

Re: Translation of template files

I have same issue after static content deploy in french store works fine but after one or two hour translation on minicart and checkout not working correctly.

Re: Translation of template files

As an addendum I'd like to give my 0.02€.

It wasn't enough to use setup:static-content:deploy -f in developer mode.

 

Had to switch to deploy:mode:set production where all messages, code generation, and what-not where compiled, so that a mix of i18n csv translations and table-translate entries where combined in one great mix, before it all came together and showed what I'd intended all along.

 

Flushing and cleaning were not enough. Then, switching back to developer mode, I was  still okay.