Skip to content

fix(theme): translate the remaining bootstrap theme messages and localise sizes - #3468

Merged
marevol merged 1 commit into
mainfrom
fix/theme-i18n-159
Sep 23, 2026
Merged

marevol merged 1 commit into
mainfrom
fix/theme-i18n-159

Conversation

@marevol

@marevol marevol commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Why

The bootstrap static theme is now the default search UI, and in eight of its sixteen locales (hi, id, it, nl, pl, ru, tr, zh-TW) some of its most visible strings were still English:

  • A search with no hits in a Russian or Turkish browser showed Your search — … — did not match any documents., where the JSP search page showed it translated.
  • The login-required and session-expired notices, the "Options" and "Search" labels, the empty facet filter message and the chat progress lines were English as well.
  • theme.yml declared only 8 supportedLocales, and /api/v2/ui/config echoes that list as theme.supported_locales.
  • File sizes were 578 B / 1.4 KB in every locale; the JSP page printed localised units (578 bytes, 578バイト).
  • A browser language outside the sixteen (e.g. zh-Hant, zh-HK, sr-Latn) fell back to English, including the language names on the advanced search page, which the JSP page gave in the browser's language.

What changes

  • i18n/messages.{hi,id,it,nl,pl,ru,tr,zh-TW}.json: translate the 14 keys that were still English (search.did_not_match, search.did_not_match_suggestion, flash.login_required, flash.session_expired, search.options, nav.search, facet.not_found, labels.chat_phase_*, labels.chat_fallback_*), reusing the wording of the matching fess_label_<lang>.properties entries where they exist.
  • theme.yml: supportedLocales lists all sixteen shipped bundles. BundledBootstrapThemeTest now requires it to match i18n/.
  • format.js: formatFileSize(bytes, locale) formats with Intl.NumberFormat unit styles; search.js passes the UI locale.
  • i18n.js:
    • zh-Hant, zh-HK and zh-MO pick the zh-TW bundle; other Chinese tags pick zh-CN. _ is accepted in place of -.
    • When no bundle matches the requested language, languageLabel() names languages in that language with Intl.DisplayNames.

The theme version stays 1.3.0: it was set for 15.9 and has not been released yet.

Verification

  • mvn test -Dtest=BundledBootstrapThemeTest,LabelMessageThemeParityTest,UiConfigHandlerTest,ThemeManifestTest: 176 tests passed. The new supportedLocales test fails on main.
  • Theme JS tests (src/test/js, npx vitest run): 589 passed, with new cases for the size units and the locale mapping.
  • Headless Chromium against a distribution built with this change, OpenSearch 3.8, before (main) → after:
Check Before After
Zero hits, ru Your search — zzqqnomatch — did not match any documents. По вашему запросу — zzqqnomatch — ничего не найдено.
Zero hits, tr same English text Aramanız — zzqqnomatch — herhangi bir belgeyle eşleşmedi.
Zero hits, zh-HK <html lang="en">, English <html lang="zh-TW">, 找不到與 zzqqnomatch 相符的文件。
Result size, ru / ja / en 578 B in all three 578 байт, 1,5 кБ / 578 バイト / 578 bytes, 1.5 kB
Advanced search, name of ja, sr-Latn / zh-Hant browser Japanese / Japanese japanski / 日語
theme.supported_locales in /api/v2/ui/config 8 locales 16 locales

…lise sizes

Eight of the sixteen locales of the bootstrap static theme (hi, id, it, nl,
pl, ru, tr, zh-TW) still carried English for the zero-result message and
its suggestion, the login-required and session-expired notices, the
options and search labels, the empty facet filter message and the chat
progress lines. A Russian or Turkish browser searching for a word with no
hits read "Your search - ... - did not match any documents.", while the
JSP search page showed it translated. Translate them, reusing the wording
of the matching fess_label_<lang> entries where they exist.

theme.yml listed only the first eight locales in supportedLocales, and
/api/v2/ui/config echoes that list. List all sixteen shipped bundles, and
make BundledBootstrapThemeTest require the list to match i18n/.

File sizes were printed as "578 B" / "1.4 KB" in every locale. Format them
with Intl.NumberFormat unit styles in the UI locale ("578 bytes",
"578 байт", "578 バイト", "1,4 kB").

A browser language outside the sixteen fell back to English, and so did
the language names of the advanced search page. Map zh-Hant, zh-HK and
zh-MO to the zh-TW bundle (other Chinese tags to zh-CN), and when no
bundle matches, name the languages in the browser's language with
Intl.DisplayNames ("japanski" for sr-Latn), as the JSP page did.
@marevol marevol added this to the 15.9.0 milestone Sep 23, 2026
@marevol marevol self-assigned this Sep 23, 2026
@marevol
marevol merged commit 1dc8d95 into main Sep 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant