lasthourcloud/docs/contribution/Translating.md

61 lines
1.8 KiB
Markdown
Raw Normal View History

2022-11-09 22:27:03 +00:00
## 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.
2. 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](https://github.com/mololab/json-translator):
```sh
# 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
- [x] en
- [x] fr
- [x] pt (autogenerated - needs review)
- [x] es (autogenerated - needs review)
- [x] 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)