Installing a Crowdin Magento 2 language pack

Hi,
There should be 3 or maybe 4 steps.

1.Installing the language pack (uploading it to app/i18n/YourVendorNane directory
2. Slightly modify your language.xml and regitration.php files - add your vendor name to the files
3. Changing locale
4. Deploying static content and cleaning cache.

Hi Pawel,

Both language.xml and registration.php already have vendor name, so I modified the directory name (app/i18n/VendorName), but still no change on frontpage.

I deployed static content, cleared cache, and switched back to default magento theme (luma), but locale is not loaded.

Hi,
I was wondering how did you do with it.

It is really difficult to say what it wrong without digging into your Magento.
It took me 3 weeks to do it because of a stupid typing error.

Can you please tell me which language pack you are trying to install?
I could try on one of my test magento installation.

A…please remove js-translation.json file from /pub/static/frontend/Magento/ (your theme, or/and Luma, or/and luma child and so on)

Before you remove anything from your server on my advise please make a back-up.

Regards,
Pawel

Hi Pawel,

I have removed js-translation.json, but nothing happened. I am trying to install Arabic
ar_SA

I just added ar_SA to my Sample i18n Repo. I haven’t tested it, but perhaps @PawelP wouldn’t mind giving it a whirl as he’s used this repo before?

@PawelP would appreciate your support

Hi,
OK. Give me some time. I’m just installing a new magento to play with it.

Please note:

Magento enables you to create the following types of language packages:
1. A set of .csv files for modules and themes. These packages files are intended to be deployed in modules.
2. Language packages that contain an entire dictionary in one directory. (I’m using this method)
You can distribute this language package as a standalone component (similar to modules and themes). Interestingly, it violates Magento’s modularity principles on purpose; that is, so that a system integrator can translate variations provided by extensions. - source

The Arabic language pack you installed from crowding projec is the 1st type. I’ve never done it.

The pack from Craig is type 2nd.

Give me 10-15 mins.

Pawel

1 Like

Hi,

It took me a bit longer than I anticipated.

I’ve installed Craig’s package (Language packages that contain an entire dictionary in one directory). Works as it should :slight_smile:

I could try to play with the package from the crowding project type 1 ( A set of .csv files for modules and themes. These packages files are intended to be deployed in modules.) but I need to work out how to activate it.

@PawelP I’ll have you tagged as the i18n expert by the end of the year :wink:

1 Like

Hahahah :slight_smile:

I need to understand how to make let’s call it type 1 - ( A set of .csv files for modules and themes. These packages files are intended to be deployed in modules.) At a glance, I see that they don’t require language.xml and refistration.php files.

I need to play with it a bit longer.

Hi nccdebug,

Please let me know if you need a hand with this?
Craig’s language pack defenitely works. The other pack I’m guessing warks too but I need to do a reasearch how to make it working.

Pawel

Hi PawelP,
I would definitely need the modules work with type A as well. I can wait till next week :slight_smile:
Much appreciated.

Hi,

I’m going nowhere so far. I don’t know how to bite it.
Craig, maybe you could give a tip on how to install the language pack.

From what I can see each module has it own i18n and language.csv file.
I uploaded the files on to my clean Mag installation and fired 2 commands,
bin/magento setup:static-content:deploy ar_SA -f
bin/magento c:f

My Mag. admin conf. are correct.

Regards,
Pawel

I’ll try and have a look over the weekend.

Great.

I’d like to know too :slight_smile:
Please let me know if you can how do you gather all defaulted en_US phrases to transalte. I know that there is a command to do it.

If you hadn’t guessed I never got around to checking this out…

@nccdebug, did you ever try my Sample i18n Repo that contains the ar_SA language that you wanted? I know it’s not the Crowdin module but it contains the same translations and is probably easier to install.

@PawelP, just to check, are you asking how to create and implement i18n files to each module? And if so, are you asking How to create this from scratch? I just want to check before spending any time on it.

Hi Craig,
Let’s say I wanted to create a new language pack from scratch.
I’m happy to create language.xml, registration.php and composter.json but how to gather all original en_US magento phases to csv. I know that there is a command for it.

Craig don’t waist more that 5 mins on it. If you know how to do it please let me know if you have to research and test it please don’t.

Pawel

Oh, that’s pretty simple. I mentioned it in one of your other posts: Translating Magento 2 - Installing custom language pack(s). You don’t actually create a module.

You simply run the below command and it checks all modules currently installed in your copy of Magento 2 for Translation Opportunities (Opportunities are identified by reading PHP files, assuming they’ve been written properly). And then compiles them into a single convenient CSV file.

bin/magento i18n:collect-phrases -o "/var/www/html/fr_FR.csv" -m

Once you’ve added/amended all of your translations in the fr_FR CSV that you just generated, simply distribute your fr_FR.csv file back into all of the modules with the below command. This splits that one large file back into a bunch of smaller files that end up in the i18n folders of the modules:

bin/magento i18n:pack /var/www/html/fr_FR.csv -d fr_FR

Note: Commands assume that you want to create French (fr_FR) translations

Thank you.

I’ll play with my test magento to polish my knowledge on language packs.

Using your post above as reference, I think the general terminology for Language implementations are:

  • Type 1: Translation Directories
  • Type 2: Language Packs

Good luck

EDIT: I’ll pencil these two implementations for future videos.