Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/lucky-pears-translate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@object-ui/i18n': patch
---

回填 `perm` + `home` 两命名空间 14 个缺失语言 key,十个语言包补齐(#3546 切片六)

`scripts/check-i18n-call-site-keys.mjs` 实测:14 个不重复 key / 14 个调用点(1:1),分布在权限集
记录的授权面摘要(`PermissionFacetLink`,ADR-0056 P1)与"一键发布全部草稿"的其余几条 toast
(`usePublishAllDrafts`:ADR-0038 L3 探针健康、示例数据健康、ADR-0066 ⑨ 能力引用巡检)。

这 14 处都带内联 `defaultValue`,所以英文一直正常渲染,**十种语言都翻不了** —— 修的是这一半。
英文字串一字未改:9 处静态 `defaultValue` 与 en 逐字节相同;另外 4 个计数标签(对象 / 字段规则 /
RLS 策略 / 标签页规则)的 `defaultValue` 是带英文单复数分支的模板串,改用 i18next 复数族
(`key` + `key_one`)后逐个计数渲染结果与模板串一致。

复数族刻意带**基础 key** 而不是只写 `_one`/`_other`:i18next 只按语言的 CLDR 类别取一个后缀,
取不到就沿 fallback 链落到 `en`。ru(few 2-4、many 5-20)与 ar(two、few 3-10、many 11-99)
恰好在用户最先遇到的计数上会因此显示英文;基础 key 让这些类别落回**本语言**。
10 changes: 5 additions & 5 deletions packages/i18n/src/__tests__/auth-namespace-3546.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ describe('objectui#3546 slice three — the auth / oauth / acceptInvitation name
);
expect(stillBaselined).toEqual([]);
// 163 before this slice, 54 removed — then slice four (console, 41 keys) took
// it to 68 and slice five (marketplace + preview, 37 keys) to 31. The other
// namespaces' debt is not this slice's to spend, and this number is what
// catches a slice that overreaches; it moves once per slice, and only
// downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(31);
// it to 68, slice five (marketplace + preview, 37 keys) to 31 and slice six
// (perm + home, 14 keys) to 17. The other namespaces' debt is not this
// slice's to spend, and this number is what catches a slice that overreaches;
// it moves once per slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(17);
// None of the template-key FAMILIES belonged to the auth family, so this slice
// left all four. Slice four then took `console.ai.group.` (it is a `console`
// key) and slice five `marketplace.disclosure.runtime.`, leaving two. This
Expand Down
7 changes: 4 additions & 3 deletions packages/i18n/src/__tests__/console-namespace-3546.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,10 @@ describe('objectui#3546 slice four — the console namespace', () => {
};
expect(Object.keys(baseline.missingKeys).filter((k) => k.startsWith('console.'))).toEqual([]);
// 109 before this slice, 41 removed — then slice five (marketplace + preview,
// 37 keys) took it to 31. The other namespaces' debt is not this slice's to
// spend; this number moves once per slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(31);
// 37 keys) took it to 31 and slice six (perm + home, 14 keys) to 17. The other
// namespaces' debt is not this slice's to spend; this number moves once per
// slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(17);
// The prefix family this slice handled is GONE from the ratchet, and the ones
// that remain are untouched — none of them belongs to `console`. Slice five
// then took `marketplace.disclosure.runtime.`, leaving two.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,10 @@ describe('objectui#3546 slice five — the marketplace and preview namespaces',
(k) => k.startsWith('marketplace.') || k.startsWith('preview.'),
),
).toEqual([]);
// 68 before this slice, 37 removed. The other namespaces' debt is not this
// slice's to spend; this number moves once per slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(31);
// 68 before this slice, 37 removed — then slice six (perm + home, 14 keys)
// took it to 17. The other namespaces' debt is not this slice's to spend;
// this number moves once per slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(17);
// The prefix family this slice handled is GONE from the ratchet, and the two
// that remain are untouched — neither belongs to these namespaces.
expect(Object.keys(baseline.missingPrefixes).sort()).toEqual([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ describe('objectui#3546 slice two — the organization namespace', () => {
expect(Object.keys(baseline.missingPrefixes)).toContain('organization.invitations.status.');
// The other namespaces' debt is not this slice's to spend. Slice three
// (auth/oauth/acceptInvitation, 54 keys) took it from 163 to 109, slice four
// (console, 41 keys) to 68 and slice five (marketplace + preview, 37 keys) to
// 31; this number moves once per slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(31);
// (console, 41 keys) to 68, slice five (marketplace + preview, 37 keys) to 31
// and slice six (perm + home, 14 keys) to 17; this number moves once per
// slice, and only downwards.
expect(Object.keys(baseline.missingKeys).length).toBe(17);
});

describe('through the real binding — bare useObjectTranslation, provider mounted', () => {
Expand Down
Loading
Loading