Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

docs: document translation contribution workflow

InstaZDLLe1161d96caa3
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cb01f975..16a43793 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -35,6 +35,43 @@ cd ..
pnpm check
```
+## Adding a translation
+
+Translations live in two places:
+
+**Main app** (`src/lib/i18n/`):
+
+1. Copy `en.json` to `<locale>.json` (e.g. `es.json`) and translate the values.
+2. Register the locale in `src/lib/i18n/index.ts` by adding an entry to the `loaders` array:
+
+ ```ts
+ {
+ locale: "es",
+ key: "",
+ loader: async () => (await import("./es.json")).default,
+ },
+ ```
+
+3. Add a `lang_<locale>` entry (e.g. `"lang_es": "Español"`) under `settings.appearance` in **every** `src/lib/i18n/*.json` file.
+4. Add a matching `<option>` to the language selector in `src/routes/settings/+page.svelte`:
+
+ ```svelte
+ <option value="es">{$t('settings.appearance.lang_es')}</option>
+ ```
+
+5. Regenerate the translation key types:
+
+ ```bash
+ pnpm generate:i18n-keys
+ ```
+
+**Browser extension** (`browser-extension/chrome/_locales/` and `browser-extension/firefox/_locales/`):
+
+1. Create an `<locale>/` folder in both (e.g. `es/`).
+2. Copy `en/messages.json` into it and translate the `message` fields. Leave the keys and `description` fields unchanged.
+
+Run `pnpm check` before opening the PR.
+
## Commit style
Follow [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`. Keep the subject under 72 characters.