Localize Article editor UI based on Bolt backend locale - #49
Open
Vondry wants to merge 5 commits into
Open
Conversation
The Article editor had no localization: it shipped no language files and its UI was English-only, with no way to follow the per-user Bolt backend locale that Bolt already resolves (LocaleSubscriber sets the request locale from the user's `_backend_locale`). - ArticleConfig sets `editor.lang` to the current request locale after the config merge, so the toolbar/popups always follow each user's Bolt locale. It is intentionally not overridable — driven solely by the user's Bolt admin locale. - article_includes() auto-loads the matching `assets/article/langs/<code>.js`, emitted BEFORE the plugin scripts so each plugin's own `translations.en` deep-merges on top and the English fallback stays complete for every enabled plugin. Locales without a file fall back to the built-in English. - Ship `langs/en.js` (the canonical, editable English set) and `langs/cs.js` (Czech). Adding a language is copy en.js -> <code>.js and translate; missing keys fall back to English. - Document the behaviour in the README.
resolveLocale() set editor.lang to the raw request locale even when no matching langs/<code>.js is shipped, while article_includes() skipped the missing file. The editor does not fall back on its own: an unknown lang table resolves every toolbar label to undefined, rendering an empty UI. Resolve the locale against the actually-shipped language file so editor.lang and the loaded file always agree, falling back to English otherwise.
Audited all twelve editor language files against the strings the editor and plugins actually resolve, then fixed what was wrong in the eleven translated locales. en.js needed no change: its 235 keys and values are byte-identical to the built-in English set in article-editor.min.js plus each plugin's own `translations.en`. Structure - cs.js was the only locale whose inline comments had been translated; restored to English so all eleven files mirror en.js exactly. Key sets and key order already matched everywhere. Grammar - add-column-after/before (and add-row-below/above in cs, sk) were translated word-for-word, leaving dangling prepositions. Reworded directionally in cs, sk, pl, ru, hr, sl. Wrong language - sl.js carried the Croatian `Neuredivo` for blocks.noneditable. Wrong meaning for the context - handle.handle labels the @-mention autocomplete plugin, not a drag grip; every locale had translated it as a physical handle. - selector.selector edits a block's id/class, so cs `Výběr`, sk `Výber` and sl `Izbirnik` become `Selektor`. - ru filelink.title is a link label field, not a heading. - editor.multiple is the breadcrumb for a multi-block selection; bare adjectives read as fragments, so use noun phrases. Label collisions on one surface - fr blocks.line vs blocks.row, sl blocks.address vs blocks.heading, hr and sl clips vs snippets. Spanish consistency - File is es-ES throughout: `Vídeo`, and `Incrustar` for embed so it no longer collides with `Insertar`; caption split into `Leyenda` for embeds and `Pie de imagen` for images; shorter `Sobresalir` for outset. Czech and Slovak accessibility.help-label dropped "rich". Left alone deliberately: fr/it share `Annuler`/`Annulla` for undo and cancel, which is standard and appears on different surfaces, and blocks.paragraph/quoteitem share a label upstream because a quote item is a paragraph.
Vondry
force-pushed
the
feature/reactive-editor-locale
branch
from
September 9, 2026 08:55
75b9202 to
29b61b1
Compare
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.
Localize the Article editor UI
Adds full localization to the Article rich-text editor. Previously the editor shipped no language files and was English-only, with no way to follow the per-user Bolt backend locale that Bolt already resolves.
What changed
ArticleConfigsetseditor.langto the current request locale after the config merge, so the toolbar and popups always follow each user's Bolt admin locale (viaLocaleSubscriber/_backend_locale). This is intentionally not overridable.article_includes()loads the matchingassets/article/langs/<code>.jsbefore the plugin scripts, so each plugin's owntranslations.endeep-merges on top and the English fallback stays complete for every enabled plugin.editor.langand the loaded file always agree. Unknown or unshipped locales fall back to the built-in English instead of rendering an empty toolbar.en.js, the canonical editable set) plus Czech, German, Spanish, French, Croatian, Italian, Dutch, Polish, Russian, Slovak, and Slovenian.Adding a language
Copy
langs/en.js→langs/<code>.jsand translate. Missing keys fall back to English automatically.Also
config.yaml.Testing
bolt-cms-article-localized.mp4