[feat]: update i18n contribution docs (#2440)

This commit is contained in:
Zakher Masri 2024-05-02 15:52:17 +03:00 committed by GitHub
parent 5fe9f02299
commit 8fd00851ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -169,6 +169,10 @@ Once that has completed, run `xcode-select --install` in the terminal to install
Also ensure that Rosetta is installed, as a few of our dependencies require it. You can install Rosetta with `softwareupdate --install-rosetta --agree-to-license`.
### Translations
Check out the [i18n README](interface/locales/README.md) for more information on how to contribute to translations.
### Credits
This CONTRIBUTING.md file was inspired by the [github/docs CONTRIBUTING.md](https://github.com/github/docs/blob/main/CONTRIBUTING.md) file, and we extend our gratitude to the original author.

View file

@ -1,3 +1,24 @@
# Locales
This directory contains the translations for the application.
## Adding a new language
To add a new language, create a new directory with the language code (e.g. `es` for Spanish) and copy the `en` directory into it. Then, translate the strings in the new directory.
To display the new language as an option in the application, add the language code to the `LANGUAGE_OPTIONS` array in `interface/app/$libraryId/settings/client/appearance.tsx`.
```ts
export const LANGUAGE_OPTIONS = [
{ value: 'en', label: 'English' },
{ value: 'es', label: 'Español' },
// The rest of the languages
];
```
## Syncing locales
This command will help you sync locales with the source language (en) and find missing keys.
`npx i18next-locales-sync -p en -s it -l ./interface/locales`