fix(theme): translate the remaining bootstrap theme messages and localise sizes - #3468
Merged
Merged
Conversation
…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.
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.
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:
Your search — … — did not match any documents., where the JSP search page showed it translated.theme.ymldeclared only 8supportedLocales, and/api/v2/ui/configechoes that list astheme.supported_locales.578 B/1.4 KBin every locale; the JSP page printed localised units (578 bytes,578バイト).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 matchingfess_label_<lang>.propertiesentries where they exist.theme.yml:supportedLocaleslists all sixteen shipped bundles.BundledBootstrapThemeTestnow requires it to matchi18n/.format.js:formatFileSize(bytes, locale)formats withIntl.NumberFormatunit styles;search.jspasses the UI locale.i18n.js:zh-Hant,zh-HKandzh-MOpick the zh-TW bundle; other Chinese tags pick zh-CN._is accepted in place of-.languageLabel()names languages in that language withIntl.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 newsupportedLocalestest fails on main.src/test/js,npx vitest run): 589 passed, with new cases for the size units and the locale mapping.Your search — zzqqnomatch — did not match any documents.По вашему запросу — zzqqnomatch — ничего не найдено.Aramanız — zzqqnomatch — herhangi bir belgeyle eşleşmedi.<html lang="en">, English<html lang="zh-TW">,找不到與 zzqqnomatch 相符的文件。578 Bin all three578 байт,1,5 кБ/578 バイト/578 bytes,1.5 kBja, sr-Latn / zh-Hant browserJapanese/Japanesejapanski/日語theme.supported_localesin/api/v2/ui/config