Repository navigation
Replies: 1 comment
|
Filed a cross-cutting proposal that may change the shape of this: make the UI locale an ordered preference list (e.g. If that lands, requests like this one become mostly "add a dictionary and one config entry". Would value your input on the trade-offs there: #11699 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
The harness UI ships English and Simplified Chinese, and
dsh-client-localeexists so that language packs can add more languages. That works for screen strings: a plugin registers its dictionaries throughctx.locale.register(ns, ...), and any language pack can fill that namespace. As one measurement, our language pack covers both experimental client plugins completely,agent-teamat 25 of 25 keys andvoice-inputat 101 of 101, so those panels already read in Korean and Japanese.Plugin display text does not work that way.
readPluginMeta(specifier, parentURL)indsh-app-bootbuilds the title and description from the package's own files only:optionalResourcePath(specifier + '/locale/en.json')locale/directorydictionariesOf()takes every*.jsonnext to itlocalizedText('description', …, manifest.description)package.jsonOn the client side,
resolveText(text)returns a plain string unchanged and walks the locale fallback chain for a map. It never consults registered dictionaries.The consequence is visible on 0.2.0-rc.2. With the UI set to Korean or Japanese, the rows for the plugins bundled with the app stay English, because those packages ship
locale/en.jsonandlocale/zh.jsononly:dsh-experimental-agent-team-profile: "Agent Teams"dsh-experimental-auto-review: "Auto Authorization Review"dsh-experimental-schedule-bundle: "Automation tasks"dsh-experimental-voice-input-bundle: "Voice input"A reader cannot work around this. Those packages live inside the signed desktop
app.asar, and adding a locale file breaks the seal (codesign --verify --deep --strictreportsa sealed resource is missing or invalid). This repository also does not accept external pull requests at the moment, so there is no way for the community to contribute the missing files either.Behavior
When a plugin's display text is resolved and the package has no entry for the active language, consult a language-pack-provided source before falling back to English.
One shape to consider, though any equivalent would help:
locale/*.jsonas the primary source, so authors stay in control of their own text<profile>/plugin-locale/<package-name>/<lang>.json, or a namespace a language pack registers throughctx.localeThat keeps the trust model intact while making display text localizable the same way screen text already is.
Scope
This is not only about the four bundled experimental packages. The ecosystem has thousands of plugins and most authors will ship English only, so a language pack is the only realistic way for a reader of another language to get a localized plugin list. It also removes the need to touch signed application bundles.
To be explicit about what this does not change: a plugin's own screens. Screen strings are localizable only when the plugin registers them through
ctx.locale.register. A plugin that hardcodes its text stays as it is. Display text is different, because it lives in the manifest and in the package'slocale/files rather than in the plugin's code. That makes it the one part of every plugin that a pack can fill without touching the plugin at all.The Korean, Japanese, and Traditional Chinese text for the packages above already exists on our side and could be carried by a pack under this mechanism, if that is useful.
All reactions