Lenster uses Crowdin for managing translations. A GitHub workflow uploads new strings for translation to the Crowdin project whenever code using the lingui translation macros is merged into main
.
Every day, translations are synced back down from Crowdin to a pull request to main
. We then merge these PR's into main
manually.
Any user-facing strings that are added or modified in the source code should be marked for translation. Use the t
macro or the Trans
component from the @lingui/macro
library. Learn more.
const myString = t`Example text`;
<Trans>Example text</Trans>
You must extract strings in PRs. If your PR adds or modifies translated strings, run the following command to generate new .po
files:
yarn i18n:extract
- Sign up to Crowdin and go to Lenster project page.
- Select the language you’d like to contribute to and request access:
- Drop a message in the Translators channel of our Discord to introduce yourself and let us know you’ve requested access.
- Once you’ve been given access, you can start making translations.
- Once your translations have been approved by a proofreader they’ll be automatically synced with the Lenster site!
- You are a proofreader too but, you can’t appove your translations.
- If you identify some error in any translation please, comment your revision proposal on the comments in the right column before approve and wait for the translator answer!
- Add the locale code to
./apps/web/linguirc.json
.
- "locales": ["en", "es"]
+ "locales": ["en", "es", "ta"]
- Add the locale code and long alias's to
./apps/web/src/lib/i18n.ts
.
export const supportedLocales: Record<string, string> = {
en: 'English',
es: 'Español',
+ ta: 'தமிழ்'
};
- Import the locale plurals in
./apps/web/src/lib/i18n.ts
.
- import { en, es } from 'make-plural/plurals'
+ import { en, es, ta } from 'make-plural/plurals'
- Load the locale plurals in
./apps/web/src/lib/i18n.ts
i18n.loadLocaleData({
en: { plurals: en },
es: { plurals: es },
+ ta: { plurals: ta },
})
- Extract and compile the strings marked for translation. This creates a directory for the locale within the
./apps/web/src/locales/
directory:
yarn i18n:extract