Languages
The web app comes in 17 languages: English, Arabic, Chinese, French, German, Hindi, Hungarian, Italian, Korean, Polish, Portuguese (Portugal and Brazil), Russian, Spanish, Thai, Turkish and Ukrainian. The exercise names and the exercise instructions of the catalog are available in all 17.
Arabic is written right to left. The page gets dir="rtl". The layouts use logical utilities (ms-, ps-, start-, text-start), so they mirror. The back and forward arrows flip. If the browser asks for a regional variant, it wins over its base language: pt-BR gives Brazilian Portuguese, and pt-PT gives Portuguese. Plural forms follow Intl.PluralRules. A language can spell the number out in its forms for one and two. Arabic does this.
The English strings live in apps/web/src/i18n/en.ts and define the set of keys. Each other language is a file in apps/web/src/i18n/locales/ that is typed against it, so a missing key fails type checking. Intl.PluralRules covers the Polish and Russian plural forms. Dates, numbers and units use Intl and the locale of the user.
The language follows the browser until the user picks one in Settings. gymgym saves the choice to the profile of the user, so it follows the user across devices.
The landing page has its own address for each language. See Architecture.
To add a language, follow these steps:
- Copy
en.tstolocales/<code>.ts. - Translate the values.
- Register the language in
apps/web/src/i18n/index.ts. - Run
pnpm --filter @gymgym/web test.