# NetRelay language system

[Türkçe](I18N.md)

The panel's default language is Turkish. The selected language is stored in browser `localStorage` under `netrelay-language` and in the `netrelay_language` cookie. The selector appears at the bottom of the panel sidebar and inside the form card on authentication pages.

## Files

- `public/locales/index.json`: list of available languages.
- `public/locales/tr.json`: Turkish source-language metadata and shared scope keys. Because it has `sourceLanguage: true`, Turkish UI strings are used as their own catalog values.
- `public/locales/en.json`: English translations.
- `public/i18n.js`: shared client that translates static/dynamic DOM content, placeholders, titles, ARIA labels and tooltip text.

Source UI strings are Turkish. Inside a target catalog's `translations` object, the Turkish source text is the key and the translated text is the value. Rows added later through WebSocket updates are translated by `MutationObserver` as well.

## Adding another language

1. Copy `public/locales/en.json` to a new file such as `de.json`.
2. Fill in its `code`, `name` and `translations` fields.
3. Add `{"code":"de","name":"Deutsch","shortName":"DE","flag":"🇩🇪"}` to `public/locales/index.json`.
4. Refresh the browser. A server restart is not required and the new language appears in the selector.

Whenever user-facing HTML or JavaScript text is added, add the same Turkish source key to every target-language catalog. Missing keys safely remain in Turkish. `code` and `pre` elements are excluded automatically so topics, tokens and API examples are not translated. Add `data-i18n-ignore` to exclude any other element.

Run `npm test` to detect missing/empty English entries used by menus, messages, placeholders, tooltips, permissions and dynamic templates.
