Repository navigation
feat(i18n): add opt-in data-only UI locale extensions - #41
Closed
Xianbei233 wants to merge 2 commits into
Closed
Xianbei233 wants to merge 2 commits into
Xianbei233 wants to merge 2 commits into
Conversation
Author
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
Add a generic, opt-in UI localization capability to drop-in extensions, without shipping any language dictionary in Pocket itself.
PocketExtension.uiLocales: validated, copied/frozen plain dictionaries and named-placeholder templates./api/me; no public dictionary endpoint or browser-side extension scripts.t(source)/t(template, params)call sites across existing UI. Parameters are inserted once as text; user messages, names, paths, model/provider identifiers and raw errors stay unchanged.Based on current upstream
45685e1(0.12.1). This branch does not include model routing, context compression, local settings, or the Chinese dictionary. The independently distributed example pack is https://github.com/Xianbei233/pi-pocket-zh-cn .Scope and limitations
This is explicit call-site coverage, not a DOM-wide replacement pass or a claim of complete localization. New 0.12-specific surfaces may still be English. Service-worker/server push payloads and unauthenticated pages are not localized. Locale extensions remain trusted server-side code, like every other drop-in; only their validated dictionary data goes to the browser.
Validation
All runs used temporary data and scripted models; no live service restart, dependency installation, or build.
npm run check: pass.npm run format:check: pass (Prettier + ESLint).npm test: 350/351 pass, twice. The sole failure is the existing timing-ratio testa long session with many compactions reads in time that grows with its lengthintest/pi-sessions.test.ts(8.1x / 9.0x).45685e1: 336/337, failing the same timing test (9.6x). The isolatedtest/pi-sessions.test.tsrerun passes 18/18. The performance test and implementation are unchanged in this PR.The older 0.11-compatible branch is retained separately for existing deployments; no old-UI overwrite was used to resolve the 0.12 port.