fix(i18n): add worktree translation to all 19 third-language dicts (#285)
PR #285 added the zh/en 'worktree' key but the 19 third-language dicts (de/fr/pt/ko/ar/hi/id/tr/vi/th/ru/it/nl/sv/pl/zhHK/zhTW/zhMO) were missing it — only ja was patched in the prior commit. The dicts are typed Record<keyof typeof zh, string> via an unchecked 'as' cast, so tsc did not catch the gap. This commit: - adds the worktree translation to all 19 dicts - strengthens tests/locales.spec.ts to assert key-set equality for EVERY shipped dictionary (not just zh/en/ja), preventing future regressions
This commit is contained in:
@@ -107,6 +107,7 @@ export const ar: Record<string, string> = {
|
||||
commit: 'تثبيت',
|
||||
commitError: 'فشل التثبيت',
|
||||
branch: 'الفرع',
|
||||
worktree: 'شجرة العمل',
|
||||
checkoutError: 'فشل تبديل الفرع',
|
||||
history: 'السجل',
|
||||
changes: 'التغييرات',
|
||||
|
||||
@@ -92,6 +92,7 @@ export const de: Record<string, string> = {
|
||||
commit: 'Committen',
|
||||
commitError: 'Commit fehlgeschlagen',
|
||||
branch: 'Branch',
|
||||
worktree: 'Worktree',
|
||||
checkoutError: 'Branchenwechsel fehlgeschlagen',
|
||||
history: 'Verlauf',
|
||||
changes: 'Änderungen',
|
||||
|
||||
@@ -99,6 +99,7 @@ export const fr: Record<string, string> = {
|
||||
commit: 'Valider',
|
||||
commitError: 'Échec du commit',
|
||||
branch: 'Branche',
|
||||
worktree: 'Arborescence de travail',
|
||||
checkoutError: 'Échec du changement de branche',
|
||||
history: 'Historique',
|
||||
changes: 'Modifications',
|
||||
|
||||
@@ -106,6 +106,7 @@ export const hi: Record<string, string> = {
|
||||
commit: 'कमिट',
|
||||
commitError: 'कमिट विफल',
|
||||
branch: 'ब्रांच',
|
||||
worktree: 'वर्कट्री',
|
||||
checkoutError: 'ब्रांच स्विच विफल',
|
||||
history: 'इतिहास',
|
||||
changes: 'बदलाव',
|
||||
|
||||
@@ -104,6 +104,7 @@ export const id: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit gagal',
|
||||
branch: 'Branch',
|
||||
worktree: 'Worktree',
|
||||
checkoutError: 'Beralih branch gagal',
|
||||
history: 'Riwayat',
|
||||
changes: 'Perubahan',
|
||||
|
||||
@@ -97,6 +97,7 @@ export const it: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit non riuscito',
|
||||
branch: 'Ramo',
|
||||
worktree: 'Albero di lavoro',
|
||||
checkoutError: 'Cambio di ramo non riuscito',
|
||||
history: 'Cronologia',
|
||||
changes: 'Modifiche',
|
||||
|
||||
@@ -98,6 +98,7 @@ export const ko: Record<string, string> = {
|
||||
commit: '커밋',
|
||||
commitError: '커밋 실패',
|
||||
branch: '브랜치',
|
||||
worktree: '워크트리',
|
||||
checkoutError: '브랜치 전환 실패',
|
||||
history: '기록',
|
||||
changes: '변경 사항',
|
||||
|
||||
@@ -104,6 +104,7 @@ export const nl: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit mislukt',
|
||||
branch: 'Branch',
|
||||
worktree: 'Worktree',
|
||||
checkoutError: 'Wisselen van branch mislukt',
|
||||
history: 'Geschiedenis',
|
||||
changes: 'Wijzigingen',
|
||||
|
||||
@@ -108,6 +108,7 @@ export const pl: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit nie powiódł się',
|
||||
branch: 'Gałąź',
|
||||
worktree: 'Drzewo robocze',
|
||||
checkoutError: 'Przełączenie gałęzi nie powiodło się',
|
||||
history: 'Historia',
|
||||
changes: 'Zmiany',
|
||||
|
||||
@@ -89,6 +89,7 @@ export const pt: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Falha no commit',
|
||||
branch: 'Branch',
|
||||
worktree: 'Worktree',
|
||||
checkoutError: 'Falha ao alternar de branch',
|
||||
history: 'Histórico',
|
||||
changes: 'Alterações',
|
||||
|
||||
@@ -102,6 +102,7 @@ export const ru: Record<string, string> = {
|
||||
commit: 'Закоммитить',
|
||||
commitError: 'Сбой коммита',
|
||||
branch: 'Ветка',
|
||||
worktree: 'Рабочее дерево',
|
||||
checkoutError: 'Сбой переключения ветки',
|
||||
history: 'История',
|
||||
changes: 'Изменения',
|
||||
|
||||
@@ -89,6 +89,7 @@ export const sv: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit misslyckades',
|
||||
branch: 'Gren',
|
||||
worktree: 'Arbetsträd',
|
||||
checkoutError: 'Grenbyte misslyckades',
|
||||
history: 'Historik',
|
||||
changes: 'Ändringar',
|
||||
|
||||
@@ -106,6 +106,7 @@ export const th: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit ล้มเหลว',
|
||||
branch: 'Branch',
|
||||
worktree: 'เวิร์กทรี',
|
||||
checkoutError: 'สลับ branch ล้มเหลว',
|
||||
history: 'ประวัติ',
|
||||
changes: 'การเปลี่ยนแปลง',
|
||||
|
||||
@@ -106,6 +106,7 @@ export const tr: Record<string, string> = {
|
||||
commit: 'İşle',
|
||||
commitError: 'İşleme başarısız',
|
||||
branch: 'Dal',
|
||||
worktree: 'Çalışma ağacı',
|
||||
checkoutError: 'Dal değiştirme başarısız',
|
||||
history: 'Geçmiş',
|
||||
changes: 'Değişiklikler',
|
||||
|
||||
@@ -106,6 +106,7 @@ export const vi: Record<string, string> = {
|
||||
commit: 'Commit',
|
||||
commitError: 'Commit thất bại',
|
||||
branch: 'Branch',
|
||||
worktree: 'Worktree',
|
||||
checkoutError: 'Chuyển branch thất bại',
|
||||
history: 'Lịch sử',
|
||||
changes: 'Thay đổi',
|
||||
|
||||
@@ -121,6 +121,7 @@ export const zhHK: Record<string, string> = {
|
||||
commit: '提交',
|
||||
commitError: '提交失敗',
|
||||
branch: '分支',
|
||||
worktree: '工作樹',
|
||||
checkoutError: '切換分支失敗',
|
||||
history: '歷史',
|
||||
changes: '變更',
|
||||
|
||||
@@ -121,6 +121,7 @@ export const zhMO: Record<string, string> = {
|
||||
commit: '提交',
|
||||
commitError: '提交失敗',
|
||||
branch: '分支',
|
||||
worktree: '工作樹',
|
||||
checkoutError: '切換分支失敗',
|
||||
history: '歷史',
|
||||
changes: '變更',
|
||||
|
||||
@@ -121,6 +121,7 @@ export const zhTW: Record<string, string> = {
|
||||
commit: '提交',
|
||||
commitError: '提交失敗',
|
||||
branch: '分支',
|
||||
worktree: '工作樹',
|
||||
checkoutError: '切換分支失敗',
|
||||
history: '歷史',
|
||||
changes: '變更',
|
||||
|
||||
+13
-1
@@ -6,7 +6,7 @@
|
||||
* interpolation.
|
||||
*/
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { LOCALE_NS, attachBetterLocale, attachLocale, en, isZh, ja, relativeTime, t, zh } from '../src/client/locales.ts'
|
||||
import { LOCALE_NS, attachBetterLocale, attachLocale, en, isZh, ja, relativeTime, t, zh, de, fr, pt, ko, ar, hi, id as idDict, tr, vi, th, ru, it as itDict, nl, sv, pl, zhHK, zhTW, zhMO } from '../src/client/locales.ts'
|
||||
|
||||
/** Minimal structural fake of the DSH LocaleService face the sidebar uses. */
|
||||
class FakeLocale {
|
||||
@@ -111,6 +111,18 @@ describe('locales (DSH i18n following)', () => {
|
||||
it('keeps the ja dictionary key-set-equal to zh', () => {
|
||||
expect(Object.keys(ja).sort()).toEqual(Object.keys(zh).sort())
|
||||
})
|
||||
|
||||
it('keeps every shipped third-language dictionary key-set-equal to zh', () => {
|
||||
// The third-language dicts are typed `Record<keyof typeof zh, string>` via
|
||||
// an `as` cast (unchecked by tsc). This test catches missing/extra keys
|
||||
// introduced when a zh key is added without updating every language.
|
||||
const thirdLangs = {
|
||||
de, fr, pt, ko, ar, hi, idDict, tr, vi, th, ru, itDict, nl, sv, pl, zhHK, zhTW, zhMO,
|
||||
}
|
||||
for (const [lang, dict] of Object.entries(thirdLangs)) {
|
||||
expect(Object.keys(dict as Record<string, string>).sort(), lang).toEqual(Object.keys(zh).sort())
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
/** Minimal fake of the better-locale override store (the subset t()/isZh() read). */
|
||||
|
||||
Reference in New Issue
Block a user