⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
docs: document i18n contribution workflow
Tine67eaad42fa1
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 6ffe9eab3..b6454bc1f 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -14,6 +14,7 @@ Thanks for wanting to contribute to Kaneo! Whether you're fixing bugs, adding fe- [Development Guidelines](#development-guidelines)- [Code Style](#code-style)- [Commit Messages](#commit-messages)+ - [Localization (i18n)](#localization-i18n)- [Project Structure](#project-structure)- [Need Help?](#need-help)@@ -113,6 +114,71 @@ We use [conventional commits](https://www.conventionalcommits.org/) to keep our- `test:` - Adding or updating tests- `chore:` - Maintenance tasks+### Localization (i18n)++Kaneo uses [i18next](https://www.i18next.com/) with [react-i18next](https://react.i18next.com/) in the web app. We want user-facing copy to stay consistent, translatable, and easy to maintain.++#### Approach++- Use translation keys for all user-facing strings instead of hardcoded copy+- In React components, call `t("namespace:key.path")` from `useTranslation()`+- Translation files live in [`i18n/`](./i18n) and use locale-style filenames such as `en-US.json` and `de-DE.json`+- [`i18n/en-US.json`](./i18n/en-US.json) is the source of truth for translation keys+- Locale selection comes from the signed-in user's saved preference when available, otherwise from the browser locale++#### i18n commands++The root `package.json` includes scripts to keep locale files in sync:++| Command | Description |+| ------- | ----------- |+| `pnpm i18n:check [locale]` | Compares `en-US.json` with the other locale files and reports missing or extra keys. You can filter by locale, for example `pnpm i18n:check de-DE`. |+| `pnpm i18n:check:fix [locale]` | Adds missing keys to other locale files using the English source text from `en-US.json`. |+| `pnpm i18n:report` | Scans `.ts` and `.tsx` files in the React app and reports missing keys, unused locale keys, and dynamic translation calls that static analysis cannot verify. |+| `pnpm i18n:report:fix` | Removes unused keys from `en-US.json` and the other locale files. |+| `pnpm i18n:schema` | Generates [`i18n/schema.json`](./i18n/schema.json) from `en-US.json` for editor and tooling validation. |++#### Adding a new locale++1. Create a new file in [`i18n/`](./i18n) using a locale code filename such as `fr-FR.json`.+2. Copy [`i18n/en-US.json`](./i18n/en-US.json) and translate the values.+3. Register the locale in [`i18n/resources.ts`](./i18n/resources.ts) by updating `supportedLocales` and `resources`.+4. If the locale should be selectable in the UI, add it to the language picker in [`apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/preferences.tsx`](./apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/preferences.tsx).+5. Run `pnpm i18n:check`, `pnpm i18n:report`, and `pnpm i18n:schema` before opening your PR.++#### Adding translations++1. Add the new key to [`i18n/en-US.json`](./i18n/en-US.json) first.+2. Use it in code with a static key:++```tsx+const { t } = useTranslation();++return <p>{t("common:actions.close")}</p>;+```++3. Use interpolation for dynamic values instead of concatenating translated strings:++```tsx+t("projects:greeting", { name: userName });+```++4. Keep translation keys static. Calls like `t(someVariable)` or ``t(`tasks:${key}`)`` cannot be validated by the i18n report and will be flagged.++#### Translation key conventions++- Use namespaces at the top level such as `common`, `settings`, and `tasks`+- Use dot notation inside each namespace, for example `settings.preferencesPage.title`+- Keep keys descriptive and stable+- Put widely shared labels in `common`+- Group feature-specific keys under the feature or component they belong to++#### Contribution notes++- If you change UI copy, update the locale files in the same PR+- If you remove or rename translation keys, run `pnpm i18n:report:fix` to keep locale files clean+- If a locale is not fully translated yet, leaving the English source text as a placeholder is fine+### Project Structure```