Repository navigation
Conversation
The admin app gained Simplified Chinese in oddbit#71, and this extension's README promised the admin app's set, so a browser reporting zh-CN met a Chinese dashboard beside an English popup. zh.ts carries the 69 keys and joins SUPPORTED_LANGUAGES, whose table map is typed over the list, so a language registered without a table fails the typecheck instead of serving undefined. The language is the browser's, read by its primary subtag, so zh-CN, zh-SG and zh-Hans all resolve to zh. A script variant the set does not carry, zh-TW or zh-HK, also resolves to zh and reads Simplified: the extension carries one Chinese table and has no picker. detectLanguage() now says so, and a test pins it as a decision rather than an accident. The parity suites iterate SUPPORTED_LANGUAGES instead of naming id and sv, so this locale and any later one are covered the day they register, and the "accepts en, id, sv" case is replaced by every-language acceptance plus an assertion on the exact array. A new popup case renders with navigator.language set to zh-CN and asserts the Chinese labels, which is the whole path from the browser to the strings on screen. CHANGELOG.md gains the entry under Unreleased, RELEASE.md gains the locale step and the Chinese clip check on the two narrowest surfaces.
The README enumerated three languages and claimed they mirrored the admin app, which needed an edit for every locale on either side and read as false the moment one landed on only one side. It points at SUPPORTED_LANGUAGES now, which is also where a new locale is registered, and the test summary line no longer counts the languages it covers.
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.
What
Follow-up to the review of #71. The admin app gained Simplified Chinese there, and this extension's README promised the admin app's language set, so a browser reporting
zh-CNmet a Chinese dashboard next to an English popup.src/i18n/zh.tscarries the 69 keys the popup, the form, the error messages and the options page read.zhjoinsSUPPORTED_LANGUAGES. The table map beside it is typed over that list, so a language registered without a table fails the typecheck rather than resolving toundefinedat the firstt().zh-CN,zh-SGandzh-Hansall resolve tozh. A script variant the set does not carry,zh-TWorzh-HK, also resolves tozhand reads Simplified: the extension carries one Chinese table and has no picker to choose another.detectLanguage()documents that, and a test pins it as a decision rather than an accident. A Traditional table would have to be matched before the primary subtag is taken, which this does not do.SUPPORTED_LANGUAGES, which is also where a new locale is registered, so the claim cannot drift from the code.Tests
SUPPORTED_LANGUAGESinstead of namingidandsv, so this locale and any later one are covered the day they register. Theaccepts en, id, svcase became every-language acceptance plus an assertion on the exact array, and a new case checks that each table declares its own code in_lang.navigator.languageset tozh-CNand asserts the Chinese labels, which is the whole path from the browser to the strings on screen. Every other case in that file runs against theen-USpin intests/setup.ts.zhfails four cases; dropping a placeholder from thezhtable fails the placeholder parity case.yarn test: 9 files, 165 tests pass.yarn typecheck: clean.yarn build,scripts/verify-build.mjs: both targets build, 7 referenced files present, 45.1 KB zips.The Chinese labels are the widest strings the popup and options page carry, so
RELEASE.mdgains a step that checks them for clipping on those two surfaces before a tag.