Update the locales files en masse?

Hi guys,

Looking to share best practices when it comes to updating the locales files. This happens when we create new variables or modify an existing translations.

Question 1:
If we modify en.yml (like add or remove a line) but not the rest, the marketplace still functions fine, and untranslated parts will render in English, while unused old translations in other language files are ignored and not causing problems. Is that right?

Question 2:
Is there some macros, or batch files, that anybody made that could help speed up this process of updating all of the YML files when we add or modify a variable? Like:

SEMI-AUTO: Create a new line in all of the locales files in the right position. Putting in the variables, and leaving the value as [~] (I believe the ~ sign is the convention for null in YML files) >> after that a human would come in and update the ~ with the right translations.

FULL-AUTO: Take values from a CSV file (each column represents a language translation), then update each individual files at the right line and the right variable name.

Anybody has used a tool like that or built one? It would help us tremendously. Thanks!

Duc

Hey there Duc,

Question 1:
No, this is not correct. Even if you don’t translate things, you should add a translation key in all your language files, under the same hierarchy/structure (actual row number doesn’t matter though). If a translation key is missing from an language file, and some features request it, this might break things for your visitors.

Question 2:
At Sharetribe we rely on WebTranslate IT, a great tool!

With WTI, we define some “master” files (like en.yml) and it takes care of adding the correct stuff to all other files, that we can then pull from the WTI repository. It also allows for batch translations and nice UI to translate things. This is quite “auto” with this process, saves quite some time and is really convenient!

Hopefully this helps.

Thanks @thomasmalbaux. Was looking for a free tool. WTI is too expensive for us.
We ended up building a module in Excel that takes all of the YML file, turn them into tabular format for easier translation, then turning them back to YML format. will share with community once it is completed.

1 Like

Good to hear that you’ve found a solution that works for you!

I’m curious: how long did that take for you to build this Excel solution? Do you have a rough estimate of the duration and cost?

Maybe 20 man-hours? I work on it myself so no cost :slight_smile: Still working out the bolts and nuts because we found too many surprises not accounted for.

Here is one, we thought that the EN.YML is the most comprehensive dictionary file (e.g. there are no variables in the other files but not in the English file). Turns out this is not true.

The photo below contains all of the entries that are in the Russian file but not in the English file.


Zoomed in:

3 questions:

  1. Do you know why this happens? In the English file there are similar entries for “one” and “many”, but not for “few”. Is this something that only Russian has?

  2. How do I get the comprehensive list of all of the variables used in all of the YML files put together (translation can be empty)?

  3. If I add the Russian variables above into the EN.YML (in the right location, of course) but leave the translation empty (with the tilda ~ sign), it will not break the site?

Will try to make a comprehensive tool for everybody. Will port it onto Google Sheet eventually for cloud collaboration.

Thanks!

Thanks for the info!

Well your time is probably your most expensive resource so 20 hours of it is quite a lot already, but good that it fits your schedule and plans!

Here are answers to your questions:

  1. Indeed, some languages have more “count” variations that don’t exist in other languages. In our setup, WTI takes care of this, per language.

  2. I’m not sure how to get such a list but by looking at the existing files or relying on some kind of third-party dictionary. Hopefully others will have ideas!

  3. Indeed it’s OK to keep the target language segment empty. It should be present but can be empty. If it’s empty, the English (of configured fallback language) translation will be used instead.

recently i have build simple script for such task, check it here https://pastebin.com/0QZd5Fbz

it allows to find new keys comparing revisions of locale file and convert to csv, and then apply translations from csv to another locale, inserting new keys where appropriate

2 Likes

Thansk zenik. What is the language of this code? Rails?

Hi guys,

Just a bit of update. My folks have successfully built a Google Sheet module to manage translations. We successfully have it running for 10 languages at the moment. See the screenshot below.

The translators translate the columns in green, there are formulas that translate them into yml syntax in the black columns on the right, then there is an appscript macro that convert all of the right columns into yml files, which can be deployed into the system manually.

Maybe after some more fine-tuning we can release a public version for the Sharetribe community to try.


Freelensia
Đặt hẹn trực tuyến với phiên dịch viên | オンラインで通訳者を予約する | 在线预订翻译员 | 통역사 온라인 예약 | นัดหมายออนไลน์กับล่าม