I use beta4 and switched the store language to de_DE. While many strings are just not yet translated to DE, there is a translation in app/code/Magento/Checkout/i18n/de_DE.csv for example for
"Shipping Address",Lieferungsadresse
If I am getting it correctly, this is referenced in app/code/Magento/Checkout/view/frontend/web/template/shipping.html:8
<div class="step-title" data-bind="text: $t('Shipping Address')" data-role="title"></div>
But still the English text is shown.
Is the Javascript translation currently broken?
Just want to add another example where I've experienced the same issue, though the string is not in a template file. In my case trying to translate a string in a core JS file (no override):
app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js
String example:
$t('Adding...')
Translation in app/design/frontend/Project/default/i18n/en_GB.csv as:
"Adding...","foo…"
Other translations in this theme locale file work fine for in-template translations.
Translation seems to run via static/frontend/Vendor/theme/de_DE/js-translation.json - some strings are just not there. Have to find out, how this is generated.
Translation is fetched in \Magento\Translation\Model\Js\DataProvider::getData and \Magento\Translation\Model\Js\DataProvider::getPhrases. Magento fetches a list of all JS files and then does a preg_match for currently only the pattern ~\$\.mage\.__\([\'|\"](.+?)[\'|\"]\)~.
What has to be fixed:
.html templates to the list of files$t('...')I will try to make a PR...
It is already fixed in the develop branch by a commit from July https://github.com/magento/magento2/blob/develop/app/code/Magento/Translation/Model/Js/DataProvider.php#L96 - I am wondering why this is not yet in master.
Internal issue MAGETWO-43935
Is this the part that wasn't being translated? @amenk If so, then it still hasn't been fixed because this is the latest develop and we still need to fix it. If it isn't the part you're talking about then could you please point out how to get there?
Also, if it's been fixed in develop then please use develop for now until the next release when we merge everything to master.

I did not followup this. But I checked the js-translate.json and it looked good. I can currently use develop, because I use composer and do not want to mess with that process at the moment. I hope there will soon be another composer release?
@amenk Yes there is going to be a release soon. But could you please confirm if my screenshot is looking at the correct place in the frontend where you were having this issue?
Should roughly be the correct place. But I am using the blank theme and I think there is no such popup.
Okay let me switch themes and try again
Popup still there with the new theme. We'll get the translation fixed for the popup. Thanks
@chicgeek, thank you for reporting of the translation issue.
The issue, that you've mentioned in
app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js
relates to different from $t() problem.
Internal issue MAGETWO-44263 has been created.
@arkadiych Okay, is there an internal ticket / further discussion for my issue with $t()? I should note also that this is not isolated to catalog-add-to-cart.js: it affects all JS files and KO templates.
@chicgeek, MAGETWO-44263 should cover all entries of such type of untranslatable phrases.
Is this already fixed in the rc master? How can we fix it? We need it urgently.
There was a hypothetically a fix included in beta 6, however we're still seeing the bug after upgrading. The changelog for CE:
Here is one example that does not translate (similar to the first posted here):
code/Magento/Checkout/view/frontend/web/template/shipping.html<div class="step-title" data-bind="text: $t('Shipping Address')" data-role="title"></div>"Shipping Address","Delivery Address"@debuysserk, the issue with $t() should be fixed in RC
@chicgeek, Have you executed next action before check:
If it doesn't help, could you provide a full relative path to *.csv file?
I'm also facing this problem, for example the Add to Cart button has three phases. The Add to Cart, Adding... and Added. These cannot be translated. I believe translations are done via js-translation.json, but this file is empty by default. When I manually add translations (just for testing) to this file, some translations are used. The Add to Cart button unfortunately not. I'm running Magento 2.0.0.
Hi folks!
This issues still seems to be unresolved...we installed the newest version of Mage 2 a few weeks ago. I created our own theme according to the http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/bk-frontend-dev-guide.html
Translations are working for PHP strings. Sadly everything that is done in JS/KO isn't translated at all.
For example:
app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js:23-25
Translation file is placed in:
app/design/frontend/{VENDOR}/{THEME}/i18n/de_DE.csv
A fix would be nice 'cause the majority of our clients speak german...
Okay, it is somehow working for me now.
I was told that the js-translation.json file (which obviously holds all JS/KO translations) is generated only if there is a language package for the current language.
Even though I failed creating my own language package with the magento commands, I "found out a simple solution".
I just moved my language file from the theme folder
app/design/frontend/{VENDOR}/{THEME}/i18n/de_DE.csv
to the already existing language package folder
app/i18n/magento/de_de/de_DE.csv
Flushed cache and now it is working...
Although my js-translation.json file is filled with translations now, the Adding... string is still not translated on the storefront.
Hi @hellsanos! Moving your CSV file to an official Magento directory is not an acceptable solution for the product. You should not have to modify a Magento delivered language pack. (This is not a complaint of what you did, just saying for the Magento folks that this is a workaround, not a solution to the problem.)
I just found that if the js-translation.json is already present, if you redeploy the contents the js-translation.json is not regenerated.
After deleting the js-translation.json files and a redeployment of the static files the js-translation.json files are generated correctly
the js-translation.json is generated correctly. Using the JavaScript debugger we just discovered that $t seems to be called before any translations are loaded.
Joining in, in my case the "js-translation.json" file only contains"[]" and i cannot figure out why.
@IceReaper I didn't figure out why, either. As a workaround you can just delete it and rebuild for your locale, e.g.:
rm pub/static/frontend/Magento/luma/de_DE/js-translation.json
php bin/magento setup:static-content:deploy de_DE
@niclashoyer thanks for the hint, but that also generated an empty array in the js-translation.json file. Magento 2.0.2 PHP 7.0, unmodified magento.
@IceReaper Try this explanation: http://www.vanderboon.net/wiki/Install_Test_Magento_2_Translation
You also need an symbolic link
Did not work :/ As a workaround i manualy converted the de_DE.csv to the json - works till the bug is fixed.
I am running up-to-date development branch.
From the product list and the product compare list, the actions of the "add to cart" button are translated correctly
From the product view the actions of the "add to cart" button are NOT translated correctly
weird.......
@thomvanderboon I tried this out and it worked correctly for me on latest develop branch. This thread is getting too broad with translation issues and the original issue with $t is already fixed. I will close this now. Please open new issue with specific translation examples if you find any. Thank you guys for reporting this!
Tried all solutions in this thread and others on the internet without solving the issue with $t() not working. My frontend js-translation.json is empty (located at pub/static/frontend/<Vendor>/<theme>/sv_SE/js-translation.json even though I have non-empty translations at /app/i18n/magento/sv_se/sv_SE.csv and /app/design/frontend/<Vendor>/<theme>/i18n/sv_SE.csv that works on PHP level, I clear caches with bin/magento cache:clean and bin/magento cache:flush and find pub/static -name js-translation.json -exec rm -rf {} \; and run bin/magento setup:static-content:deploy sv_SE on latest Magento 2.1.2.
@cjohansson Did you find a solution? I have the exact same problem.
Yes @MidnightDesign, we found a work-around. You can manually edit the js-translation.json file. In our case pub/static/frontend/<Vendor>/<theme>/sv_SE/js-translation.json and then change the files file-permissions to disallow overwrite from the Magento 2 application. If you don't change permissions on the file it seems Magento 2 will truncate the file daily.
Manually?? But how do I know which translations are needed in there? So is this actually a bug? Is there an open issue for this?
I think they should re-open this ticket because the issue remains. @hshar7
Same issue here, magento 2.1.2. Having to resort to a CSS :After content solution, for something permanent. please fix.
Just want to share our permanent solution to this Magento 2 issue.
We use a nginx web-server and add server logic to walk-around the Magento 2 problem like this:
location ~* js-translation.json$ {
alias /ROOT/app/design/frontend/VENDOR/THEME/js-translation.json;
expires modified +1w;
}
Replace ROOT, VENDOR and THEME with your values.
So we have a js-translation.json file in our theme and configures web-server to bypass Magento 2 bug to make client-side translations work.
cjohansson how did yo resolve that plz
This is still an issue I have data-bind="text: isVirtual ? $t('Enter your billing address to get a tax estimate.') : $t('Enter your destination to get a delivery estimate.')" which does not get added to a CSV when running collect-phrases and trying to manually translate it doesn't work.
@BenSpace48 did you found how to translate this string? I'm stuck on it.
yes man you should dive in magento folders and find fr.json file then you
should translate all things thats not translating automaticaly
Le mar. 25 sept. 2018 Ã 19:41, We are IGET notifications@github.com a
écrit :
@BenSpace48 https://github.com/BenSpace48 did you found how to
translate this string? I'm stuck on it.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/2056#issuecomment-424455804,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUDaHZBpLC6wtOXaXEiCC_JvC8lrg02bks5uenjsgaJpZM4GLeSI
.
use text/x-magento-template, .phtml file, $t not working. not be collected into ...././js-translate.json
Workaround, tested in magento 2.2.6
Copy the file: vendor/magento/module-checkout/view/frontend/web/template/cart/shipping-estimation.html
To your theme: app/design/frontend/
Then the strings are going to be translated:
$t('Estimate Tax')
$t('Estimate Shipping and Tax')
$t('Enter your billing address to get a tax estimate.')
$t('Enter your destination to get a shipping estimate.')
I needed to copy the shipping-estimation.html file to my theme's folder even in 2.3.3. About five years after this problem has been reported.
Most helpful comment
This is still an issue I have
data-bind="text: isVirtual ? $t('Enter your billing address to get a tax estimate.') : $t('Enter your destination to get a delivery estimate.')"which does not get added to a CSV when runningcollect-phrasesand trying to manually translate it doesn't work.