feat: internationalization (i18n) system — EN, RU, ES - #134
Open
flathead wants to merge 10 commits into
Open
Conversation
Author
Merge order for related PRsThis repo currently has 4 open PRs from this fork. They touch some of the same files, so merging them in the right order avoids most conflicts:
If you merge #134 last, the only conflicts will be in:
All conflicts are straightforward - no logic changes, just placement of new blocks alongside each other. |
Introduces a full i18n infrastructure and migrates all hardcoded UI
strings across the codebase to use the new translation system.
## New files
- modules/services/I18n.qml — singleton service that loads JSON
translation files at runtime based on system locale or config
- translations/en.json — English (base, ~637 keys)
- translations/ru.json — Russian translation
- translations/es.json — Spanish translation
- translations/languages.json — language metadata registry
## Infrastructure
- I18n.qml detects locale via Qt.locale(), falls back to "en"
- Config.qml: added `language` property (default "auto") for manual
language override; added `rus` bool to OCR config
- config/defaults/system.js: added language and rus defaults
- .pragma library JS files (notification_utils.js, notes_utils.js)
receive `t` as a parameter from callers since they cannot access
QML singletons directly
## String migration
All hardcoded UI strings across 67 files replaced with I18n.t("key"):
- Bar: battery, layout selector, controls button, tools button
- Clock: month/day names (fixes Qt.locale() genitive case in RU),
weather day labels, pomodoro controls
- Dashboard controls: all settings panels (Compositor, Theme, Shell,
System, Binds, Color Picker, Wallpapers, Audio, Bluetooth, WiFi,
EasyEffects, Gradient editor, Variant editor)
- Dashboard widgets: calendar, clipboard (relative timestamps),
notes (relative timestamps), notifications, launcher, overview,
tmux, emoji, metrics, full/compact player, quick controls,
presets, power menu
- Tools: screenshot overlay/tool, screen recorder
- Sidebar: AI assistant slash command descriptions
- Dock, Desktop, CodeBlock, ModelSelectorPopup
## Bug fixes included
- ToolsMenu.qml: fixed `i18n()` calls (undefined function) that
caused OCR panel crash — replaced with `I18n.t()`
- WallpapersTab.qml: fixed Tint label showing "OLED" (key mismatch)
- CompositorPanel, ThemePanel, SystemPanel: subsection titles now
translated dynamically (was using raw capitalize() fallback)
- SchemeSelector.qml: added missing `import qs.modules.services`
## Translation notes
- Russian: uses nominative month names (not genitive from Qt.locale())
- All 637 keys verified present in all three locale files
- Dynamic key patterns (e.g. settings.shell.{sectionId}) verified
OSD.qml: fix i18n.t() -> I18n.t() (lowercase caused empty strings) Ai.qml: migrate hardcoded user-visible strings to I18n.t(): - /model command: model not found, switched to model messages - /help command: full help message - API key missing error (with model name and key_id substitution) - Network request failed error - No response from API message - Command executed successfully (no output) message - Model descriptions for all 6 providers translations: add 13 new keys to en/ru/es (ai.api_key_missing, ai.cmd_no_output, ai.desc_*, ai.env_variable, ai.help_message, ai.model_not_found, ai.network_failed, ai.no_response, ai.switched_to_model)
Adds keys for the new resource monitor settings screen: enabled toggle, location (bar/dashboard), bar side, visible items (CPU/RAM/GPU/disk), disk list title, save/unsaved status, and bar tooltip. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Wow nice, I was gonna add this to 1.3.0 lol but if this works it would be great. I'll test when I have the time. :) |
Adds 39 keys under calendar.bar.*, calendar.event.*, calendar.form.*, and calendar.settings.* namespaces for the calendar integration feature. Covers bar indicator labels, event form fields, validation errors, reminder options, and the barAlwaysShow setting toggle.
Add calendar.panel.* keys for all CalendarPanel UI strings (accounts, settings, form fields, section headers, arrival settings) and missing calendar.form.* keys (new_event, edit_event, time_placeholder) for EventPopup. All three languages: en, ru, es. 37 new keys each.
This was referenced Aug 31, 2026
# Conflicts: # config/defaults/system.js # modules/bar/BatteryIndicator.qml # modules/services/PowerProfile.qml # modules/services/WeatherService.qml # modules/widgets/dashboard/widgets/QuickControls.qml # modules/widgets/tools/ToolsMenu.qml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a runtime i18n system to Ambxst and migrates all hardcoded UI strings to use it. Three languages included: English, Russian, Spanish.
Translation quality
Russian and Spanish were translated mostly with machine translators and AI tools, then manually spot-checked. Quality may be uneven - wrong grammatical forms, unnatural phrasing, context mismatches are possible. Native speaker corrections are welcome.
How to add a new language
translations/en.jsontotranslations/{lang}.json(use standard locale codes:fr,de,ja, etc.)translations/languages.json:{ "code": "fr", "name": "Français", "direction": "ltr" }Config.system.language = "fr"in their configHow to fix or improve existing translations
Just edit the relevant
translations/{lang}.jsonfile. Keys are sorted alphabetically. Each key maps directly to a UI string - the key name usually makes the context clear (e.g."wallpapers.oled","settings.theme.colors").Architecture
modules/services/I18n.qml- new singleton that loads the JSON file and exposesI18n.t("key"). Detects locale viaQt.locale(), falls back to"en"..pragma libraryworkaround - JS files with.pragma librarycannot access QML singletons, sonotification_utils.jsandnotes_utils.jsreceive thetfunction as a parameter from their callers.Bug fixes included
ToolsMenu.qml:i18n()calls (undefined function) were crashing the OCR panel - replaced withI18n.t()WallpapersTab.qml: Tint label was showing "OLED" due to wrong keyCompositorPanel,ThemePanel,SystemPanel: subsection titles are now translated dynamicallySchemeSelector.qml: was usingI18n.t()without the required importFiles
72 files changed. New files:
modules/services/I18n.qml,translations/en.json,translations/ru.json,translations/es.json,translations/languages.json.Screenshots (idk what for 😄)
Install as a mod
Requires the native manager from PR #230. Paste the package link into Settings → Mods → Package source:
Or from the CLI:
ambxst mods install https://github.com/flathead/ambxst-mod-i18n.git ambxst mods enable community.i18n ambxst reloadThe package is rebased onto the current
devUI. It also includes the follow-up loader fix: translation files are read synchronously before first render, and a revision dependency updates existing bindings when the language changes.This package has its own repository, flathead/ambxst-mod-i18n. Other community packages declare
community.i18nin their manifestdependenciesand point at it throughdependencySources, so the manager can install and enable it on request. The Mods panel itself uses this translator only while the mod is enabled and keeps full English fallbacks, so Settings still opens without it.Merge into Ambxst core
For core review, take this PR's branch: the feature as ordinary Ambxst source on
dev.The package patch is a separate artifact. It targets a tree that already carries the mod manager from PR #230, because that is the only tree a mod can be installed on. To reproduce exactly what the manager composes:
git remote add flathead https://github.com/flathead/Ambxst.git git fetch flathead feature/mod-manager git switch -c mods/i18n flathead/feature/mod-manager git apply --3way ambxst-mod-i18n/patches/feature.patch go test ./... go vet ./...This is a broad UI patch because every visible string needs a stable key. It adds the I18n singleton and translation files, extends System Config with the language choice, and wraps current QML and shared JavaScript call sites. When reviewing for core, keep dynamic keys and the JavaScript callback pattern intact. Spanish remains machine-assisted and would benefit from a native-speaker pass.
Package parity
The package in flathead/ambxst-mod-i18n is generated from this branch on top of the mod manager, so the translator, the translation files, and the wrapped call sites are the same code. Only the mod manager's own strings are extra: they live in the package's translation files and are unused until that manager exists.