Repository navigation
Add Russian localisation - #1
Merged
Merged
Conversation
A Russian browser now gets Russian menu rows, dialog, batch bar and plugin page instead of the zh/en fallback. - add a ru dictionary (same 98 keys as zh/en, function entries included) - recognise ru in browserLang() and resolve the dictionary through a single activeDictionary() helper - register ru with the host locale namespace, so a host that resolves ru natively picks it up unchanged - for a Russian browser the plugin dictionary answers before the host translator (DOM layer and session-menu rows): DSH ships no ru locale and would otherwise answer in zh or en. The zh/en path is untouched - tests: ru key parity with zh, and Russian menu labels under a ru navigator
DDDMUC
added a commit
that referenced
this pull request
Nov 16, 2026
俄语(社区贡献,PR #1,作者 @aleXela17) - 新增 ru 字典,98 条与 zh/en 完全对齐,函数型条目仍是函数(数字照常渲染) - browserLang() 认 ru;activeDictionary() 把「用哪本字典」收成一处 - ru 随 zh/en 一起注册进宿主 locale 命名空间 - DSH 自身没有 ru 语言包,所以俄语浏览器下插件字典优先;中英路径不变,宿主仍是权威 - 两条新增测试:ru 键集与 zh 完全一致;ru-RU 浏览器下菜单行取插件字典 拖拽标签的占位符 - dropRelease 模板是「松手删除「{name}」」,但 localizedTranslator 的插值参数表 只有 n/done/total/ok/fail/path,没有 name;调用处又把标题当裸字符串传进去 - 结果三种语言都原样显示 {name}。现在传 { name },标题真正进到句子里 - dropHint 没有占位符,顺手不再传参 - 这是 v0.2.4 引入拖拽时留下的,当时的测试只匹配了「松手删除」前缀 - 新增两条测试:不得残留 {name}、必须带上被拖动的会话标题 测试:宿主 98 项、客户端 121 项。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a Russian (
ru) dictionary to the client bundle and wires it into every surface the plugin renders, so a Russian browser gets Russian text instead of the zh/en fallback.What changes
src/client.jsrudictionary with exactly the keyszhandencarry (98 entries), including the function-valued ones for counts and paths, so the numbers still render as numbers.browserLang()recognisesru, and a newactiveDictionary()resolves the dictionary once next to the language detection instead of at each call site. Unknown languages keep the historicalzhfallback.ruis registered with the host locale namespace ({ zh, en, ru }), so a host that resolvesrunatively picks the dictionary up without any further change.t()) and for the two session-menu rows through a newslotTranslator(). DSH ships norulocale of its own, and its translator would answer in Chinese or English, so the new dictionary would otherwise never be seen. The zh/en path is untouched: the host translator stays the authority there, which keeps the menu in step when the UI language is changed in the settings.test/checkbox.dom.test.jsTwo tests:
rureaches the host namespace with exactly thezhkey set - a missing key would silently fall back to Chinese mid-dialog.navigator.languageset toru-RUthe menu rows render Russian while the harness translator still answers in Chinese, i.e. the Russian choice really comes from the plugin.README.mdThe language claim is now three languages in both language sections.
Not in this pull request
The host-side error bodies in
src/index.js(for example the "session is still open" refusal and the file-manager failures) are still Chinese-only. Localising them means teaching the host which language a request wants, which is a larger change and touches the HTTP layer rather than the dictionaries. The client already localises the two refusals a user actually meets -busyandnot-foundare mapped tobusy/notFoundbefore they reach the dialog - so the dialogs and the plugin page are fully Russian; only raw host messages on rarer failures stay Chinese.Verification
Both suites pass on Node 22:
node test/checkbox.dom.test.js- 119 tests, 119 passnode test/artifacts.host.test.js- 98 tests, 98 pass(The files were run directly because the sandbox this was prepared in cannot spawn the test runner's per-file children;
node --test "test/*.test.js"is what CI should use.)