Hacker News new | ask | show | jobs
by onei 2109 days ago
From what I can tell, this scans code for strings that can be translated, and then you supply translations from the initial language resulting in a mapping of Chinese to other languages (using Chinese as an example).

What happens if you update that initial translation that every other language hooks off? Do you end up with orphans? At the same time, you may not speak all your languages so you may end up with no -equivalent messages too.

1 comments

Thank you! This concern is valid. If we change original (let's say) Chinese texts in code, and re-run the CLI (wrap+extract). These happens (in my company's workflow):

1. CLI removes (oldKey -> oldValue) entry from en.json (a18n don't keep stale keys)

2. CLI adds (newKey -> null) entry to en.json

3. Developer commits updated en.json (yeah it's versioned)

4. A script (not in a18n yet) scans en.json, found untranslated text and warns

5. It's up to the developer to decide what to do with missing translation

Not too perfect, but I think keeping original text in code instead of "some.text.id" also has its benefit:

1. Devs understand the texts, this brings more context and makes code easier to understand

2. Some huge projects in my company exists long before they need to support i18n, and it is just too expensive to manually migrate from `text` to `code`