lasthourcloud/docs/contribution/Translating.md
2022-11-09 19:27:03 -03:00

1.8 KiB

Helping with Translations

All interface translations can be found inside the folder:

📁 apps/ui/src/lib/locales

The base and fallback language is 🇬🇧 en.


🖐️ Manual First steps

To start translating to a new language:

  1. create apps/ui/src/lib/locales/jp.json (change jp to chosen language)
  2. copy the contents from apps/ui/src/lib/locales/en.json to your new json.
  3. edit apps/ui/src/lib/translations.ts
  • 2.1. add jp: { lang }, inside translations:
  • 2.2. duplicate the full en locale hash inside loaders:, change en to jp(chosen locale)

Congratulations! You are now ready to start translating

🤖 Automated First Steps

We can ease the translation using MoloLab Json Translator:

# Install Json Tranlator
npm i -g @parvineyvazov/json-translator
# Run this command to create a new translation:
jsontt apps/ui/src/lib/locales/en.json

# Example Result:
jsontt apps/ui/src/lib/locales/en.json
? From which source? #ArgosTranslate
? From which language? #Automatic
? To which language | languages? #Spanish
✔ DONE! 287 of 287 translated.
 All files are created! 
 You can find them in the same folder as the original JSON file. 
 For Spanish --> es.json created. 

Currently supported locales

  • en
  • fr
  • pt (autogenerated - needs review)
  • es (autogenerated - needs review)
  • ko (autogenerated - needs review)

☑️ Todo:

  • Write a script to

    • sync missing keys from en to other locales;
    • remove deprecated keys from all non en locales;
  • Sveltekit-i18n instructs to create one locale file per path, maybe we should review that soon.

  • Improve the aesthetics of <LocalePicker/>

  • Make selected locale persistent (in session or cookie)