From 8fd00851ea0f7c099cce828965a0a447fece23bf Mon Sep 17 00:00:00 2001 From: Zakher Masri <46135573+zaaakher@users.noreply.github.com> Date: Thu, 2 May 2024 15:52:17 +0300 Subject: [PATCH] [feat]: update i18n contribution docs (#2440) --- CONTRIBUTING.md | 4 ++++ interface/locales/README.md | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfa3857ed..1eb27ac2f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/interface/locales/README.md b/interface/locales/README.md index 41688a1ca..91038dbe6 100644 --- a/interface/locales/README.md +++ b/interface/locales/README.md @@ -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`