fix(i18n): skip regex fragments in the translation check - #223
Open
Caldalis wants to merge 1 commit into
Open
Conversation
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.
Problem
npm --prefix frontend-enterprise run i18n:checkcurrently exits 1 onmain:The literal was introduced by 120ce01 (
fix(chat): deduplicate knowledge citations). It is the citation-heading pattern thatstripTrailingCitationSummarycompiles into aRegExp— not UI copy.check-i18n.cjsflags every Chinese string literal that has noen.jsonentry and cannot tell the two apart, so it reports the regex as a missing translation.Change
Add the fragment to the
ignoredFragmentsallowlist that already exists incheck-i18n.cjs, plus a short comment recording what that list is for.Why not add it to en.json
localizeTextNode/localizeAttributeinsrc/i18n/index.tsxperform DOM-level replacement over text nodes and attributes; they never touch JS values. This fragment cannot reach the DOM, so anen.jsonentry would be a permanently unmatched row and would mix non-UI strings into the translation catalog.ignoredFragmentsexists for exactly this case and already carriesafter:content-['展开'](a CSScontentvalue).Risk
Low. Only the validation script changes — no runtime code, no build output, and
en.jsonis untouched.Tests
Run on this branch:
npm --prefix frontend-enterprise run i18n:check— passes (3235 translations)npm --prefix frontend-enterprise test— 50 files / 243 tests passednpm --prefix frontend-enterprise run build— passes (includestsc -b)npm --prefix frontend-enterprise run config:check— passesUI validation
Not applicable: this changes only a script under
frontend-enterprise/scripts/and affects no route or rendered output, so there are no routes/roles to verify and no screenshots.