mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-04-17 09:45:40 +00:00
Update README with instructions for adding langauge
This commit is contained in:
26
README.md
26
README.md
@@ -270,6 +270,32 @@ Security and integrity details:
|
||||
- Built-in integrity checks and HTTPS/WSS defaults in app runtime
|
||||
- CI scanning workflows in `.gitea/workflows/`
|
||||
|
||||
## Adding a Language
|
||||
|
||||
Locale discovery is automatic. To add a new language, create a single JSON file:
|
||||
|
||||
1. Generate a blank template from `en.json`:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
This writes `locales.json` with every key set to an empty string.
|
||||
|
||||
2. Rename it to your language code and move it into the locales directory:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. Set `_languageName` at the top of the file to the native name of the language (e.g. `"Espanol"`, `"Francais"`). This is displayed in the language selector.
|
||||
|
||||
4. Translate all remaining values.
|
||||
|
||||
5. Run `pnpm test -- tests/frontend/i18n.test.js --run` to verify key parity with `en.json`.
|
||||
|
||||
No other code changes are required. The app, language selector, and tests all discover locales from the `meshchatx/src/frontend/locales/` directory at build time.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - Original Reticulum MeshChat
|
||||
|
||||
@@ -223,6 +223,30 @@ task build:all
|
||||
- Integrierte Integritaetspruefungen und HTTPS/WSS-Standardeinstellungen
|
||||
- CI-Scanning-Workflows in `.gitea/workflows/`
|
||||
|
||||
## Sprache hinzufuegen
|
||||
|
||||
Die Spracherkennung erfolgt automatisch. Um eine neue Sprache hinzuzufuegen, genuegt eine einzige JSON-Datei:
|
||||
|
||||
1. Vorlage aus `en.json` generieren:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
2. Datei umbenennen und in das Locale-Verzeichnis verschieben:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. `_languageName` am Anfang der Datei auf den nativen Sprachnamen setzen (z.B. `"Espanol"`, `"Francais"`).
|
||||
|
||||
4. Alle uebrigen Werte uebersetzen.
|
||||
|
||||
5. Schluesselparitaet pruefen: `pnpm test -- tests/frontend/i18n.test.js --run`
|
||||
|
||||
Keine weiteren Code-Aenderungen noetig.
|
||||
|
||||
## Mitwirkende
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - Originales Reticulum MeshChat
|
||||
|
||||
@@ -223,6 +223,30 @@ task build:all
|
||||
- Controlli di integrita integrati e HTTPS/WSS predefiniti
|
||||
- Workflow di scansione CI in `.gitea/workflows/`
|
||||
|
||||
## Aggiungere una lingua
|
||||
|
||||
Il rilevamento delle lingue e automatico. Per aggiungere una nuova lingua basta un singolo file JSON:
|
||||
|
||||
1. Generare un modello da `en.json`:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
2. Rinominare e spostare nella cartella delle lingue:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. Impostare `_languageName` all'inizio del file con il nome nativo della lingua (es. `"Espanol"`, `"Francais"`).
|
||||
|
||||
4. Tradurre tutti i valori rimanenti.
|
||||
|
||||
5. Verificare la corrispondenza delle chiavi: `pnpm test -- tests/frontend/i18n.test.js --run`
|
||||
|
||||
Nessuna altra modifica al codice necessaria.
|
||||
|
||||
## Crediti
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - Reticulum MeshChat originale
|
||||
|
||||
@@ -223,6 +223,30 @@ task build:all
|
||||
- 組み込みの整合性チェックと HTTPS/WSS デフォルト設定
|
||||
- `.gitea/workflows/` の CI スキャンワークフロー
|
||||
|
||||
## 言語の追加
|
||||
|
||||
ロケールの検出は自動です。新しい言語を追加するには JSON ファイル1つだけで済みます:
|
||||
|
||||
1. `en.json` からテンプレートを生成:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
2. ファイル名を変更しロケールディレクトリに移動:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. ファイル先頭の `_languageName` にその言語の母語名を設定 (例: `"Espanol"`, `"Francais"`)。
|
||||
|
||||
4. 残りの値をすべて翻訳。
|
||||
|
||||
5. キーの整合性を確認: `pnpm test -- tests/frontend/i18n.test.js --run`
|
||||
|
||||
他のコード変更は不要です。
|
||||
|
||||
## クレジット
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - オリジナル Reticulum MeshChat
|
||||
|
||||
@@ -223,6 +223,30 @@ task build:all
|
||||
- Встроенные проверки целостности и HTTPS/WSS по умолчанию
|
||||
- CI-сканирование в `.gitea/workflows/`
|
||||
|
||||
## Добавление языка
|
||||
|
||||
Обнаружение локалей происходит автоматически. Для добавления нового языка достаточно одного JSON-файла:
|
||||
|
||||
1. Сгенерировать шаблон из `en.json`:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
2. Переименовать и переместить в каталог локалей:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. Установить `_languageName` в начале файла на название языка на этом языке (например `"Espanol"`, `"Francais"`).
|
||||
|
||||
4. Перевести все остальные значения.
|
||||
|
||||
5. Проверить соответствие ключей: `pnpm test -- tests/frontend/i18n.test.js --run`
|
||||
|
||||
Никаких других изменений кода не требуется.
|
||||
|
||||
## Авторы
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - Оригинальный Reticulum MeshChat
|
||||
|
||||
@@ -223,6 +223,30 @@ task build:all
|
||||
- 内置完整性检查和 HTTPS/WSS 默认设置
|
||||
- `.gitea/workflows/` 中的 CI 扫描工作流
|
||||
|
||||
## 添加语言
|
||||
|
||||
语言发现是自动的。添加新语言只需一个 JSON 文件:
|
||||
|
||||
1. 从 `en.json` 生成模板:
|
||||
|
||||
```bash
|
||||
python scripts/generate_locale_template.py
|
||||
```
|
||||
|
||||
2. 重命名并移动到语言目录:
|
||||
|
||||
```bash
|
||||
mv locales.json meshchatx/src/frontend/locales/xx.json
|
||||
```
|
||||
|
||||
3. 将文件顶部的 `_languageName` 设置为该语言的母语名称 (例如 `"Espanol"`, `"Francais"`)。
|
||||
|
||||
4. 翻译所有其他值。
|
||||
|
||||
5. 验证键一致性: `pnpm test -- tests/frontend/i18n.test.js --run`
|
||||
|
||||
无需其他代码更改。
|
||||
|
||||
## 致谢
|
||||
|
||||
- [Liam Cottle](https://github.com/liamcottle) - 原始 Reticulum MeshChat
|
||||
|
||||
Reference in New Issue
Block a user