mirror of
https://github.com/serrebidev/BlindRSS.git
synced 2026-08-13 10:59:27 -07:00
Implement Interface Internationalization Support #41
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
serrebi/BlindRSS#41
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is required to enable interface internationalization (i18n) for BlindRSS to broaden its usability for users from different countries. Currently, the application’s UI is fixed in English, limiting accessibility for non‑English‑speaking users.
Given that a related component of the BlindRSS ecosystem (VLC) already leverages the gettext framework for localization, it is proposed to adopt the same solution for the main BlindRSS interface. gettext is a widely used, mature system with accessible tooling for translators and a straightforward implementation model: original English strings serve as translation keys, so migration mainly involves wrapping static UI strings in gettext calls and setting up the necessary infrastructure.
Additionally, language preferences should not be strictly tied to the system locale. Users may prefer a different interface language than the OS default. Therefore, the application must provide an explicit language selection mechanism in the menu, while keeping “System Default” as the out‑of‑the‑box option.
Implementation Overview for gettext in Existing Codebases
It is proposed to follow this practical approach to integrate gettext into a project where UI element labels are currently hardcoded:
Identify and Wrap Static Strings
gettext("Save")or the conventional shorthand_("Save")).ngettext()where appropriate (e.g., “1 item”, “2 items”).Extract Strings into a POT File
xgettextto scan the source code and generate a Portable Object Template (.pot) file containing all translatable strings.Create PO Files for Target Languages
ru.po,de.po) based on the .pot template.Compile to MO Files
msgfmt. These are the files loaded at runtime for fast lookup./usr/share/locale/<lang>/LC_MESSAGES/blindrss.mo).Initialize gettext at Application Startup
bindtextdomain()to specify where locale files are stored.textdomain()to set the domain name (e.g.,"blindrss").bind_textdomain_codeset()to define the character encoding (usually UTF‑8).Handle Language Switching at Runtime
Proposed UI Changes
It is proposed to add a language selection option in the application menu with the following behavior:
A new submenu (e.g., “Language” under “Settings” or “Help”) lists available languages plus a special entry labeled “As in System”.
“As in System” is selected by default, meaning the app uses the OS locale setting.
Selecting a specific language overrides the system setting for the current session (or permanently, depending on implementation).
The UI immediately reflects the chosen language wherever gettext strings are used.
Expected Behavior
After implementation, the following behavior is expected:
Default Behavior
User-Initiated Language Change
Technical Consistency
Additional Notes
ngettext()must be used where count‑based messages appear.The gettext infrastructure you proposed landed in v1.78.0.
What's in place:
Settings → General → Interface language(restart required). "Automatic" follows the OS locale, including the Windows UI language; the dropdown lists only languages that ship a compiled catalog. Also settable via the"language"key in config.json.locale/blindrss.potis the template (regenerated bypython tools/extract_strings.py); the standardmsginit/msgmerge/msgfmttoolchain produceslocale/<lang>/LC_MESSAGES/blindrss.mo, which the app and both build specs pick up automatically.locale/README.mddocuments the process, including placeholder and menu-access-key (&) conventions.If you (or anyone reading) want to contribute a translation — Russian would be a great first catalog — the README has the exact commands, and Poedit works well with NVDA.
Thanks for the suggestion!
I propose refining the localization workflow with gettext to align it with best practices and reduce the burden on translators.
Suggested changes:
Rationale:
Let me know if there are any specific constraints or environment considerations I should be aware of.
Implemented in v1.78.3. Generated *.mo files are now ignored, build.bat/build.sh compile locale//LC_MESSAGES/blindrss.po catalogs with tools/compile_translations.py before PyInstaller runs, and locale/README.md documents the new translator workflow where .po files are the committed source.