Repository navigation
Fix: choose plural forms by the language's own rules - #167
Merged
Merged
Conversation
Counted messages picked between a singular and a plural key on count === 1.
That is an English rule. French and Persian both put zero in the `one`
category, and Chinese has a single form for every count.
A counted message is now stored once per plural category as `key_<category>`,
and `t()` selects with Intl.PluralRules against the active locale, falling back
to `other` for a category a catalog does not carry. Callers pass a numeric
`count`, which also fills `{count}`.
The locale registry gains an English name and a status, marking the five
non-source catalogs as machine translation that no speaker has checked.
Direction for an unlisted tag now comes from the runtime's locale data rather
than a language-subtag set alone.
Two development locales are reachable by URL and are not in the registry:
`en-XA` accents and pads every message, and `cimode` renders each string as its
key.
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.
Summary
key_one,key_other, ...) instead of a singular key plus a...Pluraltwin, and rename their{n}placeholder to{count}.t()withIntl.PluralRulesagainst the active locale, resolving active category, activeother, English category, Englishother, then the key.count === 1call sites witht(key, { count })and deleterefusedNoticeKey, whose only job was picking between the two keys.badge-logic.jsthe same category resolution over its injected-translator English fallback map, keeping the module import-free.source/machinestatus, and exportSOURCE_LANGandisSupported.Intl.Localetext info, keeping the language-subtag set as the fallback for runtimes that carry none.en-XAaccents, pads and brackets every message;cimodeloads no catalog so each string renders as its key.docs/i18n.mdaround the registry table, the per-key fallback policy, the counted-message workflow, a glossary, the development locales, and the validation command.Testing
All green: 1080 frontend tests, the backend suite at 94.35% lines, lint, format, both typechecks, the cache-busting check, and the Docker build. Added 15 tests covering plural categories across the six locales, decimal and zero counts, catalog and placeholder parity, the registry, and the pseudolocale transform.
Checklist