Repository navigation
fix(service-datasource): serve the datasource driver form's labels and help in the requester's language - #30685
Conversation
…ester's language GET /api/v1/datasources/drivers served every driver label, description and connection field title/description in English, so a Chinese console's New datasource dialog read Filename, Auto-migrate schema, Host and Port in English. The route now reads the requester's language (Accept-Language, else ?locale) and serves driverCatalogFor(locale), which negotiates through resolveLocaleAmong and overlays a service-local zh-CN table on the English catalog. Any word without a translation stays English. Claude-Session: https://claude.ai/code/session_016WV4czJVaL8SDBxjng4RLk Co-authored-by: Claude <[email protected]>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 3 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4e1c6132ef477810cb2d475eb0d0768575a54abf && git checkout 4e1c6132ef477810cb2d475eb0d0768575a54abf
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a2437b560bd8872feece6ec8b57c6fdf21cff1f4 2289fe00fe977004f40a205bf7e7b02e1b1504cc && git checkout -B drift-repro a2437b560bd8872feece6ec8b57c6fdf21cff1f4 && git merge --no-ff 2289fe00fe977004f40a205bf7e7b02e1b1504cc
node scripts/docs-audit/affected-docs.mjs --json a2437b560bd8872feece6ec8b57c6fdf21cff1f4
|
…form language The catalog carried Simplified Chinese only, which opened a language tier on a platform whose locale table lists eleven languages, each complete. The translations are now keyed by the platform table's tags and cover all ten non-English languages, written once per language and laid out per driver so a shared field reads one way. The requested code is read through the table's own reader, shortened one subtag at a time, so Traditional Chinese codes reach zh-Hant and never fall to the Simplified text. The coverage test walks PLATFORM_LOCALE_TAGS, so a missing language goes red. Claude-Session: https://claude.ai/code/session_016WV4czJVaL8SDBxjng4RLk Co-authored-by: Claude <[email protected]>
|
domain:server#1 · os-elon-musk · session_016WV4cytLmJxfAmgPVjUbbW 席位核对 · ACCEPT · 2026-11-05T23:12Z · #30563Head-sha: 2289fe0
|
Requested by Elon · project thread
Fixes #30563
Clause-②: no
Metadata-protocol: none
domain:server#1 card thread · session
session_016WV4czJVaL8SDBxjng4RLk· branchclaude/project-thread-b5t886(the card thread's platform-assigned branch, named in claim amendment 6670256081).维护者速读
GET /api/v1/datasources/drivers,控制台自己没有对应的翻译键,所以中文界面里这一块一直是英文,和对话框其他中文文字混在一起。packages/services/service-datasource/src/driver-catalog.ts的driverCatalogLocaleOf与driverCatalogFor;src/driver-catalog-translations.ts的十种语言表;src/admin-routes.ts里 drivers 路由那一行。pnpm --filter @objectstack/service-datasource exec vitest run src/__tests__/driver-catalog.test.ts src/__tests__/admin-routes.test.ts,预期 2 个文件 70 例全绿,其中 zh-CN 读到「文件名」,zh-TW 读到「檔案名稱」,fr-FR 读到 Nom de fichier,en-US 读到 Filename。What changes
GET /api/v1/datasources/driversreads the requester's language the way the REST metadata door and the settings routes read it (the topAccept-Languagetag, else a string?locale=) and servesdriverCatalogFor(locale)instead of the fixed EnglishDRIVER_CATALOG. The console already sends its own language asAccept-Languageon every API call (createAuthenticatedFetchreads the htmllangattribute), so noui/change is needed.driverCatalogLocaleOf(new,driver-catalog.ts) reads the requested code through the platform locale table's own reader,platformLocaleTagOf(@objectstack/spec/system), shortened one subtag at a time (RFC 4647 lookup), the shape the storage connection test uses (PR fix(service-storage): Setup storage Test connection answers in the caller's language (#30335) #30627). Sozh-TW,zh-HK,zh-MOandzh-Hant-TWreachzh-Hantand never the Simplified text;zh,zh-CN,zh-SGandzh-Hans-CNreachzh-Hans;ptandpt-PTreachpt-BR;fr-CAreachesfr.driverCatalogForoverlays that language's entrylabel/descriptionand each top-level field's JSON-Schematitle/descriptionon the English catalog. The spec's projected schema is copied, never written.driver-catalog-translations.ts(new) holds the translations, service-local beside the catalog's English curation, keyed by the platform table's tags. Every non-English language on the table (zh-Hans,zh-Hant,es,ar,fr,pt-BR,ru,de,ja,ko) covers all five offered drivers (In-Memory, SQLite, PostgreSQL, MySQL / MariaDB, MongoDB) and every field word the form draws. Each language is written once as its distinct words and laid out per driver, so a field the drivers share (host, port, password) reads one way. Product names and technical terms (SQLite, URL, URI, SSL/TLS,knex searchPath,application_name) are kept as they are.en, a code the platform table does not name (it,nl-NL), and the product-name labels are served the English text, never a key. A translation only replaces a word the English form shows; it never adds a title to a field that has none.@objectstack/service-datasourcepatch.Tests
src/__tests__/driver-catalog.test.ts, two new top-level describes.driverCatalogFor: Simplified Chinese words for SQLite (文件名,自动迁移表结构, the driver description) and the network drivers (主机,端口,密码); a SQLitefilenametitle of its own in each of the ten languages, asserted againstPLATFORM_LOCALE_TAGS;zh-TW,zh-HK,zh-MO,zh-Hant,zh-hant,zh-Hant-TW,zh-Hant-HKreachzh-Hant(檔案名稱) andzh,zh-CN,zh-cn,zh-SG,zh-Hans,zh-Hans-CNreachzh-Hans; ten alias and regional codes (ja-JP,es-MX,pt-PT,fr-CA, …) reach their table language; ids, icons, field keys, types and defaults equal the English entry's in all eleven languages;undefined, empty,en,en-US,en-GB,it,nl-NL,constructor,__proto__returnDRIVER_CATALOGitself; product-name labels stay English; the spec projection andDRIVER_CATALOGstill readFilenameafter every language is served.DRIVER_CATALOG_TRANSLATIONS coveragewalksPLATFORM_LOCALE_TAGS, not the table's keys: the table carries exactly the ten non-English languages; each names only drivers and fields the catalog serves; each translates every driver description, every non-product label and every field word the English form shows, so a missing language or a field the spec adds goes red.src/__tests__/admin-routes.test.ts, one new case on the realHonoHttpServer:Accept-Language: zh-CN,zh;q=0.9,en;q=0.8serves文件名,自动迁移表结构,主机,端口and the zh MySQL description with the EnglishSQLitelabel;?locale=zh-CNwith no header serves zh;zh-TW,zh;q=0.9serves檔案名稱and連接埠;fr-FR,fr;q=0.9servesNom de fichier;en-USandit-ITserveFilenameandHost.Acceptance notes
PLATFORM_LOCALES), English as the source, per the maintainer's one-list ruling (no language tiers).studionamespace: the dialog title, Name, Display name, Driver, Schema mode and its hints) exist in English and Chinese only (ui/packages/i18n/src/namespaces/studio/holdsen.tsandzh.ts), so a console in any of the other nine languages now reads these driver words in its own language inside an English dialog. Reach: the New datasource dialog under Setup, console language set to any table language other than en / zh-Hans; read from the tree, not measured live. Not fixed here (ui/**is outside this card's surface). Dedupe words: studio namespace locales, datasource dialog i18n, studio en zh only.?locale=read. The route now reads?locale=(string only, as the settings routes and the metadata door do). It had no query read before and declares no closed query set; converting this route torefuseUnknownQueryParamsis not done here.DRIVER_CATALOGkeeps its value and stays the English catalog; the QA checklist row that verifies the drivers body against it (docs/qa/platform-checklist/areas/integration-system.json) still holds for an English request.Verification
At head
2289fe00(round 1 rework), after the@objectstack/service-datasourcedependency closure build.Package suite and typecheck
pnpm --filter @objectstack/service-datasource test(underos-verify-lock): Test Files 72 passed (72), Tests 1239 passed (1239), VERDICT command-exit 0.pnpm --filter @objectstack/service-datasource typecheck: VERDICT command-exit 0 (tsc --listFilesincludes both changed test files).pnpm lint(eslint . --no-inline-config): exit 0.Ablations (scripts/ablation-replace.mjs, each restored to blob == HEAD, git diff HEAD empty)
driverCatalogFor(requestLocaleOf(req))todriverCatalogFor(undefined)): 1 failed / 69 passed, the route case.localizeField: 4 failed / 66 passed (Simplified words, every-language titles, Traditional codes, route case).Object.assign(configSchema, …)instead of a copy): 3 failed / 67 passed (English fallback, spec projection untouched, route case).zh-Hant-TW, regional codes such asfr-CAandes-MX, route case viafr-FR).Derived gates (dispatch-gates --commands)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 61 families derived at2289fe00; every one exit 0 on the first pass (the round-0 prerequisites, the teardown fixture commit and the whole-tree build, were still in place).--ranreconciliation: 61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN.pnpm lint: exit 0.check-commit-card-trailers --range origin/main..HEAD: exit 0 (2 commits).TypeScript Type Checkred atb475fae0was the aggregator over a lane cancelled by the push of2289fe00(run 42121322456: consumer gatescancelled, the other three lanessuccess), not a type error.Generated by Claude Code