Replies: 2 comments 1 reply
-
|
I suggest defining language tags according to Typically, we would choose only the For example:
For greater precision, a For example:
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the detailed feedback, @HelioMorri. Both comments are very useful and touch on things we should get right before implementation begins. Language codes Agreed on adopting RFC 4646 with Translation platform: Crowdin Rather than asking contributors to fork the repo and submit PRs with raw JSON files, we are going to use Crowdin (free for open source projects). This addresses several of your concerns directly:
This means contributors just need a Crowdin account to start translating. No local dev environment, no JSON editing, no PR workflow to learn. Projects like Home Assistant and Uptime Kuma use the same approach successfully. Scoped translation files Instead of one large JSON file per language, we will split translations by feature area ( Pluralization We will wire up ICU message format support from the start. Strings like device counts and hour durations need proper plural rules, and languages like Chinese and Russian have very different pluralization than English. Retrofitting this later is painful. Translator guidelines Incorporating your suggestions into the translation guidelines:
Language switcher On the question of codes vs flags vs names: we will use the native language name (English, Espanol, Francais, etc.). Flags are problematic because many languages span multiple countries. The native name is unambiguous and recognizable to the people who would select it. Phased rollout We will convert the highest-visibility components first (dashboard, device detail, settings) and ship that as the i18n foundation. Remaining components will be converted incrementally in follow-up PRs. This keeps each change reviewable and gets the infrastructure merged faster. Initial languages Starting with English, Spanish, and French as proposed. We will seed each new language in Crowdin with an AI-generated baseline so translators have something to refine rather than starting from empty strings. Given your offer to handle Simplified Chinese -- we would welcome that as one of the first community-contributed languages once the Crowdin project is set up. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion is a request for feedback on the proposed design for issue #325 -- adding internationalization (i18n) support to the Scrutiny frontend.
#325
Summary
Scrutiny currently has no i18n infrastructure. All user-facing strings (~144) are hardcoded in Angular templates and TypeScript pipes. The goal is to add runtime language switching with English, Spanish, and French as the initial languages, and to create a straightforward path for community volunteers to contribute additional translations.
Key Design Decisions
Library: @jsverse/transloco
Angular's built-in
@angular/localizeonly supports compile-time locale switching, which means a separate build per language and no in-app language toggle. Transloco supports runtime switching via JSON files loaded over HTTP, which is what we want.Translation files: nested JSON
Files live at
webapp/frontend/src/assets/i18n/{lang}.json. Keys are dot-separated and namespaced by component (e.g.,dashboard.subtitle,device_status.failed_smart). This makes the files readable for translators who are not developers.Language preference: localStorage
Stored client-side. Initialized before first render so there is no flash of untranslated content. Falls back to browser language, then English.
Language switcher: header toolbar
A compact button placed next to the existing theme toggle. Clicking it opens a menu with the available languages.
AI-assisted initial translations
A Node.js script using the Anthropic SDK will generate the initial
es.jsonandfr.jsonfromen.json. The generated files will be reviewed before committing. Community contributors can refine them or add new languages via PR.Validation in CI
A script checks that every key in
en.jsonexists in all other language files. It runs on every PR, so incomplete translations are caught before merge.What Gets Built
TranslocoHttpLoader-- loads JSON files using the configured base href (required for the/web/mount path)LanguageService-- manages active language, localStorage persistence, and browser language detectionLanguageSwitcherComponent-- header button with dropdown menu, following the same module pattern as the existing theme toggleen.json-- canonical English strings across 10 namespaceses.json/fr.json-- AI-generated initial translations, reviewed and committed as a baselinetranslocopipe, prioritized by string densityDeviceStatusPipe,DeviceHoursPipe, andThemeToggleComponentupdated to return translated stringstranslate.mjs-- script for generating or refreshing translations via the Anthropic APIvalidate-translations.mjs-- CI script that enforces translation completenessAdding a New Language (for community contributors)
en.jsonto{lang_code}.json(ISO 639-1 codes, e.g.,de.jsonfor German){{ count }},{{ theme }}LanguageServiceandLanguageSwitcherComponentnpm run validate-translationslocally to confirm no keys are missingdevelopQuestions for the Community
All feedback is welcome. Once we have enough input we will move forward with implementation.
Beta Was this translation helpful? Give feedback.
All reactions