Repository navigation
Migrate localization to @vscode/l10n with request-scoped locale compatibility - #322
Draft
Matt Masson (mattmasson) wants to merge 6 commits into
Draft
Matt Masson (mattmasson) wants to merge 6 commits into
Matt Masson (mattmasson) wants to merge 6 commits into
Conversation
Preserve request-scoped locale selection and published template contracts through a compatibility adapter. Use l10n for named substitutions without configuring its global singleton, and validate bundle assets and external package consumers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…th-vscode-l10n Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> # Conflicts: # package-lock.json # packages/powerquery-language-services/package.json
Translate parameter documentation labels across supported locales and restore missing unknown-name diagnostics from existing translated resources. Preserve intentional technical tokens and native words, synchronize legacy target repairs, and validate locale/resource parity and packed consumers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep l10n bundles as the translation source and preserve the public TypeScript locale APIs using their required English key catalogs. Remove legacy JSON generation/import checks, clean stale build assets, and reject per-locale template JSON in tarballs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Document locale forwarding and unchanged parser errors in the existing settings guidance. Attribute the shared release's localization change to the parser without implying formatter-specific runtime code or dependencies. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep bundles as the only localization resources, deriving stable template IDs and metadata through code-defined bundle-key lookups. Preserve all public locale values and unique legacy context comments, remove unused LCX/manifests/JSON catalogs, and validate source/output/tarball cleanup and consumers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
bundle.l10n[.<locale>].jsonresources and use@vscode/l10nfor named-placeholder formatting.templates.tsAPI modules. No second translation catalog or new framework is introduced.Approved runtime/API compatibility
@vscode/l10n0.0.18 exposes singletonconfig()andt()functions, not a per-locale translator factory. The user approved a small adapter to preserve the per-request locale contract.The adapter selects the locale-bound bundle first and calls
l10n.tfor interpolation. It never callsl10n.configor mutates host-global locale state. Package-name comments namespace calls so ordinary host bundles cannot translate selected text again; hosts must not deliberately define matching<selected message>/@microsoft/powerquery-parseror<selected message>/@microsoft/powerquery-language-serviceskeys. No VS Code host, isolated module loading, or platform-specific context mechanism is required.All repeated placeholders are replaced, replacement text (including dollar patterns and braces) stays literal, and unmatched placeholders remain visible. The exported general-purpose
StringUtils.assertGetFormattedAPI is unchanged. Dynamic messages are maintained in bundles; extracting the adapter alone does not reconstruct them.Complete obsolete-resource cleanup
The user explicitly approved removing unused legacy template resources rather than maintaining hypothetical direct JSON deep-import compatibility.
localization/loc/<locale>/templateshandback trees: 82 LCX files.LocProject.jsonmanifests and both English template JSON catalogs.loc,templates, and manifest resource paths from output.templates.tsmodules remain. Their minimal typed ID-to-bundle-key lookups derive English messages and metadata from the English bundle, preserving stable public IDs, field shapes, English fallback, and metadata aliases without separate resource catalogs.Before deletion, all 4,018 active legacy message translations were confirmed present in bundles, including LCX-escaped closing brackets. The 41 unique translated developer-context comments were retained in the matching bundles using the supported
{ message, comment }object format. No message text changed during this cleanup.An exact before/after snapshot verified all 8,568 public locale message/metadata values and field shapes across both packages. All 4,284 bundle message values are unchanged by the resource cleanup. Obsolete imports, copy/generation machinery, legacy synchronization assertions, documentation references, and resource allowlists are updated or removed. No translation/publishing pipeline or live settings were changed; this removes only the replaced source-resource mechanism.
Translation coverage
The initial migration carried forward existing message translations except four malformed-placeholder repairs: Galician unknown-identifier suggestions, Portuguese (Portugal) named missing-argument and unnamed type-mismatch diagnostics, and Serbian (Cyrillic) argument-count diagnostics.
The subsequent audit completed 190 message values across 41 locales: 161 documentation headings and 29 unknown-name diagnostics restored from existing translations.
Typeis intentionally unchanged where it is also correct native terminology in Danish, Norwegian Bokmål, and Dutch. German quote and Portuguese escape defects were corrected during restoration.English source comments, keys, placeholders, code snippets and API names remain intact. English-identical parser values such as
CancellationError,InvariantError,null,minus, andtextare intentional technical/native terms. No unresolved English-prose candidates were found by the contextual audit; independent native-speaker certification was not performed.Upstream and release scope
Merged
origin/master60cb007 via d84598d, including #320 and #321. Root-owned shared tooling and runtime ranges are preserved, along with both localization dependencies. Formatter docs clarification is aa3a287; complete obsolete-resource cleanup is 4b43ae1. No extra dependency modernization or formatter runtime changes are introduced. The PR remains a draft and has not been merged.Verification
npm run cleanand dependency-orderednpm run build— passed; no legacy localization resource directories, manifests or catalogs remain in output.npm run lintandnpm test— all package, parser-resource and release-helper suites passed; the existing parser skip remains.npm run validate:release— passed again at the committed cleanup revision. All three actual tarballs install outside the workspaces; consumer type-checking and runtime checks cover template API imports, string/message-comment bundle forms, translated diagnostics/documentation, concurrent locales, parser/formatter propagation, literal substitutions, English fallback and unchanged host l10n configuration.