Localization of back-end and admin front-end - #296
Open
pbouda wants to merge 2 commits into
Open
Conversation
Adds a small gettext-style translation layer for the management interface: msgids are the English source strings, catalogs are generated at build time from lsp/lang/*.po into an embedded lookup table, and the browser picks a language from navigator.language (with a manual picker) and sends it back to the API via Accept-Language on every request. Menu/tab labels and a couple of dialog buttons are wrapped as a first pass; identifiers used for routing (data-tab) stay untranslated so navigation isn't affected by the active language.
The JSON API is consumed standalone and by other front-ends that can't do client-side translation lookups, so capability strings (friendly/desc) now get translated server-side based on the request's Accept-Language header before the response is sent. This is a separate gettext-style catalog from the LSP's (src/lang/*.po vs lsp/lang/*.po) with its own embedded lookup table, generated by the same gen_lang_header.py/po2json.py tooling shared between both tracks. lib/tr.h provides an identity tr() used only to mark capability strings for xgettext extraction; the real per-request lookup lives in Controller::tr(). Wraps three output plugins (flac/mp4/ogg) as a first pass.
pbouda
marked this pull request as ready for review
August 16, 2026 20:06
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.
Localization for MistServer, in two independent gettext-style tracks:
The two tracks are deliberately separate catalogs (lsp/lang/.po vs src/lang/.po) with independent .pot/.po files, built into embedded lookup tables at build time by shared tooling (scripts/gen_lang_header.py, scripts/po2json.py). No OS locale/libintl dependency, everything's a pure in-memory dict lookup so it works the same in the embedded binary regardless of host locale config.
Both tracks currently wrap only a small first-pass set of strings (menu labels + a couple of buttons on the frontend; 3 output plugins' capability strings on the backend) as a proof of concept for the mechanism. German (de-DE) is the only translation provided so far.
Structure
How to review
Note
One loose end, not addressed: lsp/server.html, server_min.html, server_screenlog.html are committed pre-built files whose generation process I couldn't identify in this repo (not part of generateLSP.sh or the meson build path. Those produce a separate build/generated/server.html, which is correctly regenerated and verified working). They were already stale/modified before (?).