Skip to content

feat(client): add Russian (ru) locale - #67

Merged
cloader merged 2 commits into
cloader:devfrom
reysonk:feat/i18n-ru
Oct 31, 2026
Merged

cloader merged 2 commits into
cloader:devfrom
reysonk:feat/i18n-ru

Conversation

@reysonk

@reysonk reysonk commented Oct 30, 2026 •

Copy link
Copy Markdown

What

Adds a native Russian (ru) locale to the task board UI.

src/client/i18n/ru.ts carries the same 654 keys as en.ts/zh.ts and is typed as TaskboardDict, so the existing parity test keeps every dictionary in sync.

Why native, not a DOM-patching pack

Until now Russian came only from an external translation pack that rewrites text nodes at runtime by matching English strings (DOM_EN_TEXT + TreeWalker). That approach breaks on new copy, misses attributes and cannot translate placeholders. A first-class dictionary is checked by the type system and by the unit tests.

Changes

file change
src/client/i18n/ru.ts new dictionary, 654 keys, export const ru: TaskboardDict
src/client/i18n/runtime.ts LocaleId = 'zh' | 'en' | 'ru', DICTS = { zh, en, ru }, isLocaleId, ru branches in detectFallbackLocale() (<html lang> + navigator.languages)
src/client/i18n/templates.ts templateLocale() narrows the locale to 'zh' | 'en'; built-in template bodies stay English for ru (BuiltinTemplateLocale is not widened)
tests/i18n.spec.ts parity test over three dictionaries, non-empty values, enum maps, ru resolution via <html lang="ru-RU">, placeholder substitution, template fallback
changelog.md Unreleased entry

Activation note

The core locale service (@deepseek-ai/dsh-client-locale) accepts arbitrary string locale ids (LocaleId = string) but only exposes languages that have been registered. The dictionary here is ready to use; a language-pack plugin registers the entry point with:

ctx.locale.addLanguage({ id: 'ru', label: 'Русский', fallback: 'en' })

Without that registration the stored preference resolves back to the provisional locale, so this PR is safe to merge on its own and does not change behaviour for zh/en users.

Verification

  • npx vitest run tests/i18n.spec.ts → 21 passed
  • npx vitest run → 44 files / 585 tests passed
  • npx tsc --noEmit → exit 0
  • npm run build:client → lib/client.js 396.66 kB (gzip 99.80 kB)

Terminology (reviewed by a native Russian speaker)

  • worktree → «рабочее дерево» (paths such as .dsh-worktrees and the shell command git worktree remove are left untouched)
  • claim / release a claim → «взятие в работу» / «отменить взятие в работу»
  • Acceptance checklist (DoD) → «Чек-лист приёмки (DoD)»
  • Reasoning effort → «Уровень рассуждений»
  • Needs Human → «Требуется человек»; the Waiting for Me filter reads «Ждут меня»
  • column Todo → «К выполнению» (never «очередь»)
  • unlinked → «непривязанный», uncommitted changes → «незакоммиченные изменения»

Notes

  • A reactivation pass found no user-visible string in ru.ts that contradicts en.ts; placeholders, emoji, \n escapes and {{lastExecution}}/{{lastComments}} markers are preserved verbatim.
  • Follow-up (not in this PR): the board never renders task.id, only the search box matches it — showing it in the detail panel would be a separate change.

- add src/client/i18n/ru.ts (654 keys, key set identical to zh/en)
- widen LocaleId to 'zh' | 'en' | 'ru', register the dictionary and
  accept ru in isLocaleId() and in the <html lang> / navigator fallback
- built-in templates keep the English bodies for ru (templateLocale())
- cover trilingual parity, non-empty values, enum maps, ru detection,
  placeholder substitution, template fallback and the source scan
- changelog entry under Unreleased

Tested: npx vitest run (44 files, 585 tests), npx tsc --noEmit (clean),
npm run build:client.
@cloader
cloader merged commit 5346ecb into cloader:dev Oct 31, 2026
1 check passed
@cloader

cloader commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

维护者补充(2026-10-31)

感谢 @reysonk 的贡献!

本 PR 已在 #68 之后合入 dev。集成提交 77b4bf4 补齐了 3 个俄语任务 ID 复制提示词条,合并了更新日志条目,并扩展测试以覆盖不同语言下复制成功、失败的提示。

当时集成后的类型检查和完整构建通过,测试共 45 个文件、589 项,GitHub CI 也已通过。后续 #65 / #69 集成又增加了 4 个俄语词条,0.9.7 的俄语字典现为 661 个键,与中英文字典完全一致。相关变更已纳入 0.9.7 更新日志。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants