Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,27 @@ curl -X POST http://<IP>/auth/password-local \
-d '{"password": "test123"}'
```


### End to End Testing

The UI has been set up with some end-to-end tests to ensure basic functionality. It's ideal that as you add featured, you add new tests and update existing ones. At minimum, ensure that existing end-to-end tests continue to pass.

#### Setup

The end-to-end tests require a connection to GitHub and the GitHub GH CLI to be installed and authorized. See [installation instructions](https://github.com/cli/cli?tab=readme-ov-file#installation). After confirming the GH install works, authorize the CLI using

```bash
gh auth login
```

#### Running the tests

Before starting a pull-request (PR) on GitHub, make sure that the system still passes all end-to-end tests. Use the following command after ensuring the setup above has been completed. The test will do a complete native, UI build, and device service. It will then ask for the IP of your test device. **Warning**, this will deploy your changes to the specified JetKVM device, so recovery may be required if something severe breaks. It may also **reset the configuration** of the test device, so be prepared to re-adopt and configure when done. You will need to ensure the KVM is connected to an HDMI and USB port of an actual machine that is on and active so that keyboard status, mouse movement, and display capture are testable.

```bash
make test_e2e
```

---

## Common Issues & Solutions
Expand Down Expand Up @@ -484,7 +505,7 @@ If you enable the [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtensi
"thing_edit_this_is_a_test": "This is a test",
```

3. Add the key and string to the _en.json_ like this:
3. Add the key and string to the _ui/localization/messages/en.json_ like this:

- **Note** if the string has replacement parameters (line a user-entered name), the syntax for the localized string has `{ }` around the replacement token (e.g. _This is your name: {name}_). An complex example:

Expand All @@ -496,20 +517,23 @@ If you enable the [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtensi
})}
```

4. Save the _en.json_ file and execute `npm run i18n` to resort the language files, validate the translations, and create the m-functions
4. Save the _en.json_ file and execute `npm run i18n:resort` to resort the language files, `npm run i18n:validate` to validate the translations, and `npm run i18n:compile` to create the m-functions (you can use `npm run i18n` to do all three steps in order)
5. Edit the _.tsx_ file and replace the string with the calls to the new m-function which will be the key-string you chose in snake-case. For example `This is a test` in _thing edit page_ turns into `m.thing_edit_this_is_a_test()`
- **Note** if the string has a replacement token, supply that to the m-function, for example for the literal `I will call you {name}`, use `m.profile_i_will_call_you({ name: edit.value })`
6. When all your strings are extracted, run `npm run i18n:machine-translate` to get a first-stab at the translations for the other supported languages. Make sure you use an LLM (you can use [aifiesta](https://chat.aifiesta.ai/chat/) to use multiple LLMs) or a [translator](https://translate.google.com) of some form to back-translate each **new** machine-generation in each _language_ to ensure those terms translate reasonably.

### Adding a new language

1. Get the [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) (for example AT for Austria)
2. Create a new file in the _ui/localization/messages_ directory (example _at.json_)
3. Add the new country code to the _ui/localizations/settings.json_ file in both the `"locales"` and the `"languageTags"` section (inlang and Sherlock aren't exactly current to each other, so we need it in both places).
4. That file also declares the baseLocale/sourceLanguageTag which is `"en"` because this project started out in English. Do NOT change that.
5. Run `npm run i18n:machine-translate` to do an initial pass at localizing all existing messages to the new language.
2. Create a **new empty** file in the _ui/localization/messages_ directory (example _at.json_)
3. Add the new country code to the _ui/localization/jetKVM.UI.inlang/settings.json_ file in both the `"locales"` and the `"languageTags"` section (inlang and Sherlock aren't exactly current to each other, so we need it in both places). That file also declares the `baseLocale/sourceLanguageTag` which is `"en"` because this project started out in English. **Do NOT change that**.
4. Add the locale name of the language to **all** the _ui/localization/messages/_ files (example `"locale_at.json": "Österreichisches Deutsch",`)
- In the _en.json_ file, use the name of the language **in that language**. For example `"locale_es": "Español"`.
- In all other translation files, use the name of the language **in the language of the containing file** (example, in _local_da.json_ (Danish), we have `"locale_de": "Tysk",` for German).
5. Run `npm run i18n:machine-translate` to do an initial pass at localizing all other existing messages to the new language then correct anything that looks incorrect. We're aiming for translations that make sense to the native speakers of the target language.
- **Note** you will get an error _DB has been closed_, ignore that message, we're not using a database.
- **Note** you likely will get errors while running this command due to rate limits and such (it uses anonymous Google Translate). Just keep running the command over and over... it'll translate a bunch each time until it says _Machine translate complete_
- **Note** you likely will get errors while running this command due to rate limits and such (it uses anonymous Google Translate).
Just keep running the command over and over... it'll translate a bunch each time until it says _Machine translate complete_.

### Other notes

Expand Down
8 changes: 4 additions & 4 deletions ui/localization/jetKVM.UI.inlang/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"es",
"fr",
"it",
"ja",
"nb",
"pt",
"sv",
"zh",
"zh-tw",
"ja"
"zh"
],
"languageTags": [
"en",
Expand All @@ -23,12 +23,12 @@
"es",
"fr",
"it",
"ja",
"nb",
"pt",
"sv",
"zh",
"zh-tw",
"ja"
"zh"
],
"modules": [
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Spansk",
"locale_fr": "Fransk",
"locale_it": "Italiensk",
"locale_ja": "Japansk",
"locale_nb": "Norsk (bokmål)",
"locale_pt": "Portugisisk",
"locale_sv": "Svensk",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Kinesisk (forenklet)",
"locale_zh_tw": "Kinesisk (traditionel)",
"log_in": "Log ind",
"log_out": "Log ud",
"logged_in_as": "Logget ind som",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Spanisch",
"locale_fr": "Französisch",
"locale_it": "Italienisch",
"locale_ja": "Japanisch",
"locale_nb": "Norwegisch (bokmål)",
"locale_pt": "Portugiesisch",
"locale_sv": "Schwedisch",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Chinesisch (vereinfacht)",
"locale_zh_tw": "Chinesisch (traditionell)",
"log_in": "Einloggen",
"log_out": "Abmelden",
"logged_in_as": "Angemeldet als",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"advanced_download_diagnostics_description": "Download system diagnostics, crash logs, and configuration for troubleshooting",
"advanced_download_diagnostics_title": "Download Diagnostics",
"advanced_enable_usb_emulation": "Enable USB Emulation",
"advanced_error_loopback_disable": "Failed to disable loopback-only mode: {error}",
"advanced_error_download_diagnostics": "Failed to download diagnostics: {error}",
"advanced_error_loopback_disable": "Failed to disable loopback-only mode: {error}",
"advanced_error_loopback_enable": "Failed to enable loopback-only mode: {error}",
"advanced_error_reset_config": "Failed to reset configuration: {error}",
"advanced_error_set_dev_channel": "Failed to set dev channel state: {error}",
Expand All @@ -95,8 +95,8 @@
"advanced_ssh_default_user": "The default SSH user is",
"advanced_ssh_public_key_label": "SSH Public Key",
"advanced_ssh_public_key_placeholder": "Enter your SSH public key",
"advanced_success_loopback_disabled": "Loopback-only mode disabled. Restart your device to apply.",
"advanced_success_download_diagnostics": "Diagnostics downloaded successfully",
"advanced_success_loopback_disabled": "Loopback-only mode disabled. Restart your device to apply.",
"advanced_success_loopback_enabled": "Loopback-only mode enabled. Restart your device to apply.",
"advanced_success_reset_config": "Configuration reset to default successfully",
"advanced_success_update_ssh_key": "SSH key updated successfully",
Expand Down Expand Up @@ -444,7 +444,9 @@
"locale_es": "Español",
"locale_fr": "Français",
"locale_it": "Italiano",
"locale_ja": "日本語",
"locale_nb": "Norsk (bokmål)",
"locale_pt": "Português",
"locale_sv": "Svenska",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Español",
"locale_fr": "Francés",
"locale_it": "Italiano",
"locale_ja": "Japonés",
"locale_nb": "Noruego (bokmål)",
"locale_pt": "Portugués",
"locale_sv": "Sueco",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Chino (simplificado)",
"locale_zh_tw": "Chino (tradicional)",
"log_in": "Acceso",
"log_out": "Finalizar la sesión",
"logged_in_as": "Inició sesión como",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Espagnol",
"locale_fr": "Français",
"locale_it": "Italien",
"locale_ja": "Japonais",
"locale_nb": "Norvégien (bokmål)",
"locale_pt": "Portugais",
"locale_sv": "Suédois",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Chinois (simplifié)",
"locale_zh_tw": "Chinois (traditionnel)",
"log_in": "Se connecter",
"log_out": "Se déconnecter",
"logged_in_as": "Connecté en tant que",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Spagnolo",
"locale_fr": "Francese",
"locale_it": "Italiano",
"locale_ja": "Giapponese",
"locale_nb": "Norvegese (bokmål)",
"locale_pt": "Portoghese",
"locale_sv": "Svedese",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Cinese (semplificato)",
"locale_zh_tw": "Cinese (tradizionale)",
"log_in": "Login",
"log_out": "Esci",
"logged_in_as": "Accesso come",
Expand Down
25 changes: 14 additions & 11 deletions ui/localization/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"advanced_download_diagnostics_description": "トラブルシューティング用にシステム診断、クラッシュログ、設定をダウンロードします",
"advanced_download_diagnostics_title": "診断データのダウンロード",
"advanced_enable_usb_emulation": "USBエミュレーションを有効化",
"advanced_error_loopback_disable": "ループバック専用モードの無効化に失敗しました: {error}",
"advanced_error_download_diagnostics": "診断データのダウンロードに失敗しました: {error}",
"advanced_error_loopback_disable": "ループバック専用モードの無効化に失敗しました: {error}",
"advanced_error_loopback_enable": "ループバック専用モードの有効化に失敗しました: {error}",
"advanced_error_reset_config": "設定のリセットに失敗しました: {error}",
"advanced_error_set_dev_channel": "Devチャンネル状態の設定に失敗しました: {error}",
Expand All @@ -95,8 +95,8 @@
"advanced_ssh_default_user": "デフォルトのSSHユーザーは",
"advanced_ssh_public_key_label": "SSH公開鍵",
"advanced_ssh_public_key_placeholder": "SSH公開鍵を入力してください",
"advanced_success_loopback_disabled": "ループバック専用モードが無効になりました。適用するにはデバイスを再起動してください。",
"advanced_success_download_diagnostics": "診断データが正常にダウンロードされました",
"advanced_success_loopback_disabled": "ループバック専用モードが無効になりました。適用するにはデバイスを再起動してください。",
"advanced_success_loopback_enabled": "ループバック専用モードが有効になりました。適用するにはデバイスを再起動してください。",
"advanced_success_reset_config": "設定が正常にデフォルトにリセットされました",
"advanced_success_update_ssh_key": "SSHキーが正常に更新されました",
Expand Down Expand Up @@ -438,15 +438,18 @@
"local_auth_update_password_button": "パスワードを更新",
"locale_auto": "自動",
"locale_change_success": "言語が {locale} に変更されました",
"locale_da": "Dansk",
"locale_de": "Deutsch",
"locale_en": "English",
"locale_es": "Español",
"locale_fr": "Français",
"locale_it": "Italiano",
"locale_nb": "Norsk (bokmål)",
"locale_sv": "Svenska",
"locale_zh": "中文 (简体)",
"locale_da": "デンマーク語",
"locale_de": "ドイツ語",
"locale_en": "英語",
"locale_es": "スペイン語",
"locale_fr": "フランス語",
"locale_it": "イタリア語",
"locale_ja": "日本語",
"locale_nb": "ノルウェー語 (bokmål)",
"locale_pt": "ポルトガル語",
"locale_sv": "スウェーデン語",
"locale_zh": "中国語 (簡体字)",
"locale_zh_tw": "中国語 (繁體字)",
"log_in": "ログイン",
"log_out": "ログアウト",
"logged_in_as": "ログイン中: ",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Spansk",
"locale_fr": "Fransk",
"locale_it": "Italiensk",
"locale_ja": "Japansk",
"locale_nb": "Norsk (bokmål)",
"locale_pt": "Portugisisk",
"locale_sv": "Svensk",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Kinesisk (forenklet)",
"locale_zh_tw": "Kinesisk (tradisjonell)",
"log_in": "Logg inn",
"log_out": "Logg ut",
"logged_in_as": "Logget inn som",
Expand Down
24 changes: 13 additions & 11 deletions ui/localization/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"advanced_download_diagnostics_description": "Baixe diagnósticos do sistema, logs de falha e configuração para solução de problemas",
"advanced_download_diagnostics_title": "Baixar Diagnósticos",
"advanced_enable_usb_emulation": "Ativar Emulação USB",
"advanced_error_loopback_disable": "Falha ao desativar modo somente loopback: {error}",
"advanced_error_download_diagnostics": "Falha ao baixar diagnósticos: {error}",
"advanced_error_loopback_disable": "Falha ao desativar modo somente loopback: {error}",
"advanced_error_loopback_enable": "Falha ao ativar modo somente loopback: {error}",
"advanced_error_reset_config": "Falha ao redefinir configuração: {error}",
"advanced_error_set_dev_channel": "Falha ao definir estado do canal de desenvolvimento: {error}",
Expand All @@ -95,8 +95,8 @@
"advanced_ssh_default_user": "O usuário SSH padrão é",
"advanced_ssh_public_key_label": "Chave Pública SSH",
"advanced_ssh_public_key_placeholder": "Digite sua chave pública SSH",
"advanced_success_loopback_disabled": "Modo somente loopback desativado. Reinicie seu dispositivo para aplicar.",
"advanced_success_download_diagnostics": "Diagnósticos baixados com sucesso",
"advanced_success_loopback_disabled": "Modo somente loopback desativado. Reinicie seu dispositivo para aplicar.",
"advanced_success_loopback_enabled": "Modo somente loopback ativado. Reinicie seu dispositivo para aplicar.",
"advanced_success_reset_config": "Configuração redefinida para o padrão com sucesso",
"advanced_success_update_ssh_key": "Chave SSH atualizada com sucesso",
Expand Down Expand Up @@ -438,16 +438,18 @@
"local_auth_update_password_button": "Atualizar Senha",
"locale_auto": "Automático",
"locale_change_success": "Idioma alterado com sucesso para {locale}",
"locale_da": "Dansk",
"locale_de": "Deutsch",
"locale_en": "English",
"locale_es": "Español",
"locale_fr": "Français",
"locale_da": "Dinamarquês",
"locale_de": "Alemão",
"locale_en": "Inglês",
"locale_es": "Espanhol",
"locale_fr": "Francês",
"locale_it": "Italiano",
"locale_nb": "Norsk (bokmål)",
"locale_pt": "Português (Brasil)",
"locale_sv": "Svenska",
"locale_zh": "中文 (简体)",
"locale_ja": "Japonês",
"locale_nb": "Norueguês (bokmål)",
"locale_pt": "Português",
"locale_sv": "Sueco",
"locale_zh": "Chinês (Simplificado)",
"locale_zh_tw": "Chinês (Tradicional)",
"log_in": "Entrar",
"log_out": "Sair",
"logged_in_as": "Logado como",
Expand Down
6 changes: 4 additions & 2 deletions ui/localization/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,12 @@
"locale_es": "Spanska",
"locale_fr": "Franska",
"locale_it": "Italienska",
"locale_ja": "Japanska",
"locale_nb": "Norska (bokmål)",
"locale_pt": "Portugisiska",
"locale_sv": "Svenska",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_zh": "Kinesiska (förenklad)",
"locale_zh_tw": "Kinesiska (traditionell)",
"log_in": "Logga in",
"log_out": "Logga ut",
"logged_in_as": "Inloggad som",
Expand Down
22 changes: 12 additions & 10 deletions ui/localization/messages/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,18 @@
"local_auth_update_password_button": "更新密碼",
"locale_auto": "自動",
"locale_change_success": "語言已成功變更為 {locale}",
"locale_da": "Dansk",
"locale_de": "Deutsch",
"locale_en": "English",
"locale_es": "Español",
"locale_fr": "Français",
"locale_it": "Italiano",
"locale_nb": "Norsk (bokmål)",
"locale_sv": "Svenska",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
"locale_da": "丹麥語",
"locale_de": "德語",
"locale_en": "英語",
"locale_es": "西班牙語",
"locale_fr": "法語",
"locale_it": "義大利語",
"locale_ja": "日語",
"locale_nb": "挪威語 (bokmål)",
"locale_pt": "葡萄牙語",
"locale_sv": "瑞典語",
"locale_zh": "中文 (簡體字)",
"locale_zh_tw": "中文 (繁體字)",
"log_in": "登入",
"log_out": "登出",
"logged_in_as": "目前登入身分為",
Expand Down
4 changes: 3 additions & 1 deletion ui/localization/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@
"locale_es": "西班牙语",
"locale_fr": "法语",
"locale_it": "意大利语",
"locale_nb": "挪威语(书面)",
"locale_ja": "日语",
"locale_nb": "挪威语 (bokmål)",
"locale_pt": "葡萄牙语",
"locale_sv": "瑞典语",
"locale_zh": "中文 (简体)",
"locale_zh_tw": "中文 (繁體)",
Expand Down
Loading