Translating Magento 2 - Installing custom language pack(s)

Hi Craig, hi digitalstartup community,

Can you please give me some tips on how to translate M2?
Magento as a default comes with American English. i.e. Zip/Postal code rather than Postcode. In addition, I would like to translate phrases like “Proceed to Checkout” to “SECURE CHECKOUT”

I know that to translate phrases I need to edit language csv file using a text editor let’s say Notepad ++.
This bit is relatively easy and I’m familiar with it from M1 but in M2 it is not just this.

I tied to do my homework before tormenting you. I know that M2 requires language pack installation and registration.

I tried studying this: I also watched this video:, however, the Vietnamese chap doesn’t explain what he is going. Copy and paste are OK but I would like to understand what I am doing and why. When I watch your videos and follow your articles copy and past codes but I actually understand what I’m doing and why.

I started to experiment. I created an i18n directory in app/design/frontend/Magento/luma_child and saved there an en_GB.csv file to translate my luma_child theme.
I test a few phrases and I can see that it works. Hm… but I don’t think it is a correct way of doing it.
Some phrases are translated but the same phrases are not translated everywhere i.e. mini cart.

Obviously, when I experimented I did a shortcut omitting a few I’m guessing very important steps.

Then I tried to understand Magento’s documentation.

I replicated form Magento’s documentation composer.json, language.xml, registration.php files and a added a language en_GB.csv file and placed all into app/i18n/en_gb directory.

I edited my files.

  1. language.xml file requires a code, vendor and package.
    The code I’m guessing is en_GB, vendor is MyVendorName and package is I’m guessing the name of the directory in my case en_gb
  2. registration.php file
    I added only myvendorname_en_gb
  3. composer.json
    I edited the name row so it says “name”: myvendor/magento2-language-en_gb

Please refer to the attached screenshot.

Finally, I run 2 comments:
bin/magento setup:upgrade --keep-generated
bin/magento cache:flush

And… a BIG ZONK! :frowning: it doesn’t work.

Please advise what am I doing wrong.
Thank you in advance.


1 Like

Hi @PawelP.

I appreciate you putting in the time to show your findings when composing your question. My projects have never really needed anything more than to support en_GB over en_US. I know there are plenty of stores out there that support multiple languages… So, my experience is somewhat limited. But I’m happy to share what I do “know”.

Like you, I’ve had to make similar changes to my projects. Compared to M1, M2 is very compartmentalised, which is a good thing. The bad part is having to work it all out :slight_smile:

My favourite fact about the new translation system is that it’s now referred to as “i18n”, which is short for “internationalisation” (“i” followed by 18 letters then “n”). I don’t know why I find that so cool…

i18n locations
Anyway, being too lazy to research i18n in full because I’ve never had to do any “true” translating, I stumbled my way around. But this is what I’ve learned so far:

  1. i18n can be initialised in the child theme just as you mentioned.
  2. i18n can also be initialised per module within app/Vendor/module/i18n/
  3. Some labels are hard-coded in and can’t be translated via 918n (A side effect from lazy coding)

Based on the first 2 points (above), here are some examples of where i18n files can be initialised:

  • app/code/Vendor/module/i18n/
  • app/design/i18n/
  • vendor/vendor/module/i18n/ (Never edit anything in this folder)

Because there are essentially 3 locations that i18n files can be initialised from, Magento always checks the app/vendor files first. Then it checks the app/code and app/design files for any overrides.

One thing I don’t know is what takes priority out of app/code and app/design. Perhaps you can tell me?

i18n caching
i18n “technically” gets cached in 2 locations, one of which is the standard cache which can be cleared in System > Cache Management. Fairly obvious I know…

The second location is the generated static files. I learned this the hard way, believe me… Sometimes I would update i18n files and get frustrated because I couldn’t see my changes. Even after updating several files in several locations. In the end I stumbled across this.

When I redeployed my static files, I would have to specify both the default en_US and the en_GB languages. The commands vary slightly depending what mode you’re in:

  • (Production Mode) bin/magento setup:static-content:deploy en_GB en_US
  • (Developer Mode) bin/magento setup:static-content:deploy en_GB en_US -f

Even though I only support en_GB, I think I still have to generate en_US because that’s the default fallback language but I could be wrong.

Anyway, whenever I make an i18n amendment I always run that command before previewing it.

Existing en_GB language pack
As a starting point for creating an en_GB language pack and essentially “reverse engineering” it, I use this module via composer. This module should give you everything you need in order to create your own language pack from scratch (including the basic files required to build a module).

I was too lazy to make my own pack from scratch, but there was still some translations that I wanted to tweak. So I broke rule #1 to achieve this and edited the core csv files in the module. Which means that if this module is ever updated, it would write over all of my changes. But I still did it anyway because I have backups of those files and the chances of this particular module being updated are slim. Practice what I preach not what I do :slight_smile:

I’m not sure what else I can share with you as I clearly have some knowledge gaps in this topic. Hopefully, you’ll be able to either use or reverse-engineer that module I shared. And you should find that static-content command helps as well. If you learn anything else along the way, please share as I’d like to know.

Hi Craig,

Thank you for your prompt reply.
I’ve done it :slight_smile: The translation is applied to the mini cart too.

I found this article:

I removed the file /pub/static/frontend/Magento/luma_child/en_GB/js-translation.json cleared caches like Evgeny Levinsky adviced and it worked.

We learn things every day haaa :slight_smile:!

I hope that it will be be useful for someone.


1 Like

Hi Craig,

I’m again straggling to install a language pack.
This time I tried to do it via composer but the following error message was shown.

Can you please advise how to bite it?
Thank you.


Luckily, this is an easy one and nothing you’ve done wrong per se. A quick analysis of the situation should explain…

The “latest” version of the Packagist Composer Repository is out-of-date (2017-09-28). Therefore, not compatible with Magento 2.2, 2.3. Hence the error message you’re seeing.

If you look at the dev-master version of the Packagist Repository, you will see that this branch was updated very recently (2019-08-07). It’s safe to assume that this update addresses the issue.

So, instead of specifying the “latest” version, you should specify the “dev-master” version when loading composer:

composer require cubewebsites/magento2-language-en-gb:dev-master

If you checkout the GitHub Repository, the only difference between the 2 versions is a line in the composer.json that tells composer its requirements (i.e. the compatibility with Magento 2.2, 2.3).

Hi Craig,
Thank you for the tip. It worked, I was able to install the module but I’m still looking at creating my own langage packadges.
In the past I was able to do it for M.2.2 but for some reasons I can’t do it for M2.3.2

The procedure of creating langage packs for both M2.2 and M2.3 looks very similar.
source -
So I created the following directories and files:

app/i18/mystore/en_GB for British English and analogically 
app/i18/mystore/fr_FR for French - France 
app/i18/mystore/de_DE for German - Germany

- composer.json
- registration.php
- langage.xml
- en_GB.csv
- fr_FR.csv
- de_DE.csv

Uploaded relevant files into relevant directory.

composer.json, registration.php, langage.xml, en_GB.csv to app/i18/mystore/en_GB

Finally, run the following commands:

bin/magento setup:static-content:deploy en_GB -f
bin/magento setup:upgrade
bin/magento cache:flush

But it doesn’t work.

My composer file looks as follow:

My language.xml file looks as follow:

My registration.php file looks as follow:

I would like to confirm that I’ve checked my Magento admin conf. and my locale settings are correct.
I don’t know what I’m doing wrong. It should be so simple. Probably I’m not running a correct command or missing one.
I check Magento documentation and checked so many different forums. When you have time can you please look at it?

If anyone knows what I’m doing wrong please let me know.
If anyone would like to have a go the below screenshot might be useful.

Thank you.

I haven’t had a chance to thoroughly read through your post because I’m signing off for the day, but I’ll have a look tomorrow.

However, I just wanted to point out that you referenced the below command:

bin/magento setup:static-content:deploy en_GB -f

But you didn’t include the 2 other languages:

bin/magento setup:static-content:deploy en_GB fr_FR de_DE -f

As I said, I’ll check back in tomorrow.

Hi Craig,

You are absolutely correct. I wasn’t clear in my message. I’m only testing en_GB. If I can make one language works I’m sure the remaining 2 will work too.

It is really annoying because I already went through this once and it worked.
I have a feeling that I’m going backwards.

Please take your time. There is no rush. I’m sitting on this for last 2 weeks.
I tired on a few magento instances, including vanish but it just doesn’t work.

Thank you for your time.


After about an hour, I’ve come to the conclusion that the Official Documentation sucks. When I have more time to get my head around it, I’ll get back to you (and probably produce a video).

I’m such an idiot. No wonder what I was doing wasn’t working! I forgot I installed the CubeWebsites GB Language Pack from the other night - And it was interfering with my own pack. I think I have it working now.

Hi Craig,
As I said take your time.
I tired for maybe 2 to 3 weeks to make this working before I asked you for help. I’m not a programmer but it shouldn’t be so difficult following M docs.

A video would be great. Of cource if you have time. You could break it into steps, creating storeviews, changing locale settngs in the admin pannel, changing or adding currencies, creating language packs and finally, I havent reserched this yet, how to conf. a site for mulpiple domains i.e,, and,,

Also, I know that it could be tricky, how to install SSL from multidoman website. I already cracked how to do it for single domain from godaddy, (I can write something here hopefuly it will be useful). I also tried installing SSL following your “let’s encript” toutorial. I think that this will be a biggy one but at first I need to lern how to creatre language packs.


Have you installed a langauge pack via composer or have you created one?

My main goal was to work out and understand the Documentation. Specifically, I wanted to understand what the following 3 commands did:

  • bin/magento i18n:collect-phrases ...
  • bin/magento i18n:pack ...
  • bin/magento i18n:uninstall ...

collect-phrases and unistall were pretty straight forward. But it was pack that had me confused because I couldn’t work out for the life of me what it was actually doing.

What it does is separate and distribute your translation file into all of the appropriate (referenced) modules within their respective “i18n” folders. Very clever.

What didn’t help was that Test Translations I was expecting to see, didn’t display. And as I mentioned above, that was thanks to the other language pack I installed previously - Which was overriding my changes.

So, at this point I’m pretty sure I understand the purpose and functions of the i18n commands.

To answer your question, I just wanted to Generate and Create my own and then try to deploy it. It shouldn’t take too long to work out how to package the pack. But there are a few ways this can be achieved such as; Module, Theme, Pack.

I’ll come back to you on that one when I have another slot of free time to investigate.

Thank you.

In therory this should be easy.

…and run a few commands.

Ironically, I have done it for the previous M v. updated it to the newest version and the translation works for all 3 languages. :angry:

I’ve uploaded my i18n Language Pack Sample Solution to GitHub. This has been tested and works on my setup.

If this doesn’t work for you, then there is a high chance that you have another language pack interfering.

Note: Unlike a standard module, this doesn’t require any bin/magento installation commands to get going.

Edit: I’m supposed to be “off” today, so I’ll check back in on Monday.

Hi Craig,

Thank you for your reply.
I tried your language packs but it still doesn’t work for me.
(Just to confirm I changed in your en_GB.csv file some phrases - “Zip/Postal Code”, “Postcode”)
Your language packs installation procedure don’t differ from what I was doing which is good but at the same time not good because I didn’t make it work.

The language.csv file differs slightly. I included only original and translated phrases in quotation marks
Zip/Postal Code", "Postcode"
your file contain both phrases, and what they relate to i.e. module and releaser i.e. “Zip/Postal Code”,“Zip/Postal Code”,module,Ess_M2ePro
(Just to confirm I tried both only en_US and en_GB phrases & en_US, en_GB, + module and releaser)

I’m installing a new Magento locally now to check it again.
I have a question. Once the language packages are installed they should work for all themes, shouldn’t they?

Do I have to register my vendor before I register my language pack with the vendor in your example digitalstartup? (Just to confirm I changed the vendor name to mine in the language pack files and in the directory)

If you could give me some tips it would be great. I don’ t know what to look for.
Thank you in advance.


Yes, I believe so. One thing that I don’t know is this: You’re can add i18n translations to Modules, Themes and Language Packs. But I don’t know which takes Priority.

Just swap out any references for your own, whilst not forgetting to update the actual directory names (as you said). However, I didn’t actually need to do anything after uploading the files other than this:

bin/magento setup:static-content:deploy en_GB fr_FR -f
bin/magento cache:clean
bin/magento cache:flush

Then when I switched the Locale in the backend, I just cleared the Cache again. It was surprising simple.

If you’re going to be testing on a clean install later then stick with my original first - Because we know that definitely works.


OK, I need to try on the a fresh Magento then because it looks like I did everyhting correctly but it doesn’t work on my current M installation.

My magento has been installed with default english UK language so I didn’t change anything in the locale in the backend. Only for the french language but this also dosnt work. It absulatuly driving me mad. It should be so simple to do it.

Hi Craig,

Finally, I made it work. It was me being stupid creating the directory. Instead of i18n i named it 18.
I was doing it over and over again.

I waisted 3 weeks :rage: and I wasted your time too.
I’m sorry.

By the way in your command the is an error. No colon need after bin/magento


I feel your pain, as I’ve been there a few times :slight_smile:

I’ve fixed those commands now, thanks.