Skip to main content
Share Your Experience: Take the 2024 Developer Survey
43 votes
Accepted

Magento2 translating Javascript (KO) template text

So I was finally able to figure out the problem. Seems that the JS template translation are read from js-translation.json which is generated during setup:static-content:deploy execution. In order to ...
Atish Goswami's user avatar
10 votes

How can I use a link in string to translate at Magento 2?

HTML code should not be used directly in a translation string, instead use a placeholder (i.e. %1) to represent it, and put it's value in a subsequent parameter to the translation method. <?= __('...
Holly's user avatar
  • 4,873
10 votes
Accepted

How can I use a link in string to translate at Magento 2?

Your solution might look something like this: <a href="<?php echo $block->escapeUrl($this->getBaseUrl().'customer/address/');?>"> <?php echo $block->escapeHtml(__('Street ...
joni jones's user avatar
  • 2,549
7 votes
Accepted

Magento 2: Translate input placeholder attribute string in Knockout html template

You can write like this <input type="text" data-bind="attr:{placeholder: $t('Email')} " /> Run below commands php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php ...
Suresh Chikani's user avatar
7 votes

Translation string, how to

When dealing with translations best way is to start with collecting translatable phrases, you can do so by issuing following command: bin/magento i18n:collect-phrases --output "app/i18n/Vendorname/...
Devtype's user avatar
  • 3,008
7 votes
Accepted

Magento 2.3.5 - Inline Translate within a CMS Block

php translate will not work in static block you need to add like: <h1 class="hero-h1">{{trans "Welcome to this website" }}</h1> You can add translation as per link
Pawan's user avatar
  • 5,901
6 votes
Accepted

How to use inline translate on custom block?

To allow the inline translation, Magento uses the isAllowed method of Mage_Core_Model_Translate_Inline class, which basically does the following: check if the inline translation is allowed in the ...
Raphael at Digital Pianism's user avatar
5 votes
Accepted

How to properly translate strings in JavaScript

Write your strings to be translated like so: $.mage.__('Foobar') $('.readmorebutton').click(function() { if (! $('.readmore').hasClass('open') ) { $('.readmorebutton').text($.mage.__('...
Eamonn's user avatar
  • 508
5 votes

magento 2 - need to change text and remove items from wishlist

To change the label for 'My Wish List' to 'wishlist' , go to vendor/magento/module-wishlist/i18n/your_language.csv (i think there will be en_us only) And change: "My Wish List","My Wish List" to "...
ntzz's user avatar
  • 534
4 votes
Accepted

Magento 2 : Notice : Undefined property Interceptor::$inlineTranslation

You need to add \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, in your Controller or remove $this->inlineTranslation->suspend(); from Controller file. Just copy ...
kunj's user avatar
  • 3,699
4 votes
Accepted

Translate string containing "

Try this : "You subscribe to ""General Subscription"".","U staat ingeschreven voor de standaard nieuwsbrief inschrijving.","module","Magento_Customer
Ashish Jagnani's user avatar
3 votes
Accepted

Magento 2: How to translate the minicart?

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" ...
Evgeny Levinsky's user avatar
3 votes

Magento 2 Close (Esc) button translate

You can use your JS to transform the string translatable and then apply using JS in the HTML, so you can change in your CSV file. $.mage.__('<string>'); Further information To ensure that the ...
Rafael Corrêa Gomes's user avatar
3 votes
Accepted

Fronted issue after inline translation

Check the inline translation config at website and store level and clear the caché. Test it in a private mode browser.
rubenr's user avatar
  • 113
2 votes
Accepted

How to escape a % in magento translation

For a literal percent character, use %% Reference: Magento uses vsprintf to format translations https://secure.php.net/vsprintf
Fabian Schmengler's user avatar
2 votes
Accepted

Magento 1.9 - Translate text in php file

The $message is already translatable, because you use $this->__() to generate it. So, you can enable Inline Translation to translate it. However, it is not best practise to use HTML code inside a ...
simonthesorcerer's user avatar
2 votes

Magento2 Change Text of Top Links Sign In and Sign Out by Inline Translating

If you have already selected your Custom Theme in admin under Content -> Configuration then you can put i18n folder in this location: /app/design/frontend/Comapnyname/vendorname/i18n/en_US.csv or ...
Aman Agarwal's user avatar
2 votes

How to translate validation messages in magento2

First Please check your file of the "*Require" word format it should be in <?php echo $this->__('Enter your destination to get a shipping estimate') ?> if it doesn't work please use below ...
Ranganathan's user avatar
  • 3,220
2 votes
Accepted

Magento2 Translate cross sell, up sell and related products

When I look in my version of the Catalog translation file I find the following lines for the three themes "Related Products","Related Products" "We found other products you might like!","We found ...
iphigenie's user avatar
  • 1,729
2 votes
Accepted

Magento 2: How to use translation to change the adminhtml button text?

You can override translation csv file using this way : app/design/{AreaName}/{Vendorname}/{themename}/i18n/en_US.csv or You can follow this 2nd way also Just Copy this file vendor\magento\...
Rohan Hapani's user avatar
  • 17.4k
1 vote

No translations for `Invalid Form Key. Please refresh the page`

This is actually a Magento CORE Issues, Reported at: https://github.com/magento/magento2/issues/27889 and FIXed within Magento 2.4.0++. Release Notes: https://devdocs.magento.com/guides/v2.4/release-...
Piotr Siejczuk's user avatar
1 vote

Not able to translate OK and cancel buttons in confirmation popup minicart

Minicart confirmation popup button text Ok and Cancel option comes to the below file path. You can able to find that two button text form there. File path: magento/vendor/magento/module-ui/view/...
Kirti Nariya's user avatar
  • 3,041
1 vote

How to translate alert message

It seems the text you are trying to translate is coming from ko js. For translating phrases from ko js you should provide i18n: in front of the value of data-bind attribute. Something like below; &...
Vivek Kumar's user avatar
  • 5,395
1 vote

Translate inline Store View Issues

As you already know how to translate inline, I will answer only to make these changes store-wise. When you translate inline, you may have seen a checkbox "Store View Specific". You just have to check ...
Mohit Kumar Arora's user avatar
1 vote
Accepted

Translate store language label in magento frontend

copy file app/design/frontend/base/default/template/page/switch/languages.phtml into your theme add below code echo $this->__(<Text to translate>); you want to translate $this->...
Gopal Patel's user avatar
  • 3,139
1 vote

Magento 2 : Translation Error

There is a bug in Magento 2.1.3 which breaks js translations. The bug is already reported, see this link for more info and a workaround: https://github.com/magento/magento2/issues/7862
mikesteeghs's user avatar
1 vote
Accepted

How can i translate custom module text that i cant with inline translate in Magento 2

Make sure that you are using translatable strings. For example: <h3><?php echo __('Create Backup') ?></h3> You can translate the strings with inline translation or i18n theme ...
Tjitse's user avatar
  • 1,310
1 vote

Magento 2 - Error Messaging Text Change

Please check that validation errors text in lib/web/mage/validation.js is like $.mage.__('validation error msg') and not like 'validation error msg'. If it is not using $.mage.__() it will not be ...
Sarvagya's user avatar
  • 1,217
1 vote

Magento2 translating Javascript (KO) template text

As I described in the Github issue (https://github.com/magento/magento2/issues/7525#issuecomment-316690100) there is another (easier) solution to that problem. You just need to make sure to deploy ...
FaHu's user avatar
  • 238

Only top scored, non community-wiki answers of a minimum length are eligible