I know that this issue has been dealt with several times in this forum

Magento2 localisation Javascript

Magento 2 - translating problem in JS templates

Magento2 translating Javascript (KO) template text

I have installed the Italian language pack on my Magento 2.1.9 project and most strings are correctly translated.

I added a new translation dictionary in my theme.


Here I've modified some translations and added the new strings of my theme to translate. For strings included in phtml files everything works fine.

I added a some custom strings in knokout templates of checkout. For example in


I added

<span data-bind="i18n: 'Do you already have an account?'"></span>

Then in my theme it_IT.csv:

"Do you already have an account?","Hai già un account?"

Of course I emptied cache, pub/static/, var/view_preprocessed/, var/generation, etc.. and I runned all the commands.

The strings are still in English.

I really have to create a new language package to translate a few strings in the checkout? What's the reason?

EDIT Online translations work for all strings. It can be a way to fix it temporarily but not the definitive solution.

  • 1
    i would also add that other translations work using this method
    – springerin
    Commented Sep 28, 2017 at 9:37

2 Answers 2


You need to extend a language package, creating a translation file in the theme is not enough.

This extension module needs to contain:


  "name": "snowdog/project-language-translations",
  "description": "Some translations for some project",
  "type": "magento2-language",
  "require": {
    "magento/framework": "^100.0.0"
  "autoload": {
    "files": [


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



And of course file with translations in desired language.


An alternative solution (the one we finally adopted) is to include translation files in a module instead of in the theme.

Oddly the modules csv can easily translate the js strings.

Create a new module with:

use \Magento\Framework\Component\ComponentRegistrar;


  "name": "vendor/module",
  "description": "Project custom translations",
  "require": {
    "php": "7.0.2|7.0.4|~7.0.6"
  "type": "magento2-module",
  "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "<Vendor>\\<Module>\\": ""


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="<Vendor>_<Module>" setup_version="1.0.0" />

and here we will add all of our language file:




We chose this system because the project we are working on has many languages and we didn't want to include too many language packages.

Note that it will work only for new strings because Magento gives priority to the language pack translations. But this is another story.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.