Hacker News new | ask | show | jobs
by FallenMax 2109 days ago
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`