fix: disable i18next key/ns separator splitting at runtime to match parser config - #29161
Open
BLACKTHOMAS wants to merge 1 commit into
Open
fix: disable i18next key/ns separator splitting at runtime to match parser config#29161BLACKTHOMAS wants to merge 1 commit into
BLACKTHOMAS wants to merge 1 commit into
Conversation
…next-parser config
Contributor
Author
|
Note on the failing
|
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.
Pull Request Checklist
devbranch.dev, no unrelated commits.fix.Changelog Entry
Description
i18next-parser.config.tsgenerates fully flat catalogs (keySeparator: false,namespaceSeparator: false), but the runtimeinit()insrc/lib/i18n/index.tsnever disabled i18next's default separators. As a result, any key containing:is split by the defaultnsSeparatorat runtime and never resolves, rendering blank or mangled in every locale, including English.keySeparator: falseandnsSeparator: falsetoinit(), restoring parity between runtime and parser configuration.Changed
src/lib/i18n/index.ts— addedkeySeparator: falseandnsSeparator: falseto the runtimeinit()options (2 lines, no other changes).Fixed
Warning:rendered as an empty string in the Functions and Tools editors; now renders the translated label (e.g.Uwaga:,Warnung:) in every locale.//localhost.8000,//mineru.net/api/v4); now render the full, correct URLs.How this was verified
The fix was verified against the real, shipped locale catalogs in an isolated environment, using the exact i18next version pinned by this repository's lockfile on the Node version used by this project's CI (Node 22).
init()options frominitI18n()(same fallbacks,returnEmptyString: false, interpolation settings) — one without the fix (currentdevbehavior) and one with the fix — and compared call-by-call.t()invocations per run. After the fix, output matched the expected catalog/fallback value in 100% of calls (0 mismatches), including i18next's full language-resolution hierarchy (e.g.ar-BH → ar → en-US, andfr-CA → fr-FRvia the existingfallbackLngconfiguration).:and are the broken ones from the linked issue. Zero behavior change on the other 3,089 keys, including all keys containing.and all keys with:protected by i18next's natural-language heuristic (57 keys).{{variables}}— identical output before and after.getFixedT, no additionalcreateInstancecalls, no array-keyt()usage, and no per-call separator overrides — the application exclusively uses the single default instance with string keys and an options object, which is exactly the configuration exercised by the matrix above.t()invocations across the three runs; all 45 assertions passed, 0 failures.Additional Information
Warning:→Uwaga:in pl-PL) and become reachable again with this change.returnEmptyString: falsebehavior), so nothing new is introduced there.Contributor License Agreement