@goodandready/dsh-russian-lang 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/lib/client.js +54 -7
- package/package.json +70 -70
package/README.md
CHANGED
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@goodandready/dsh-russian-lang"><img src="https://img.shields.io/npm/v/@goodandready/dsh-russian-lang.svg?style=for-the-badge&color=6366f1&labelColor=1e1b4b" alt="npm version"></a>
|
|
9
|
-
<a href="LICENSE"><img src="https://img.shields.io/
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-10b981.svg?style=for-the-badge&color=10b981&labelColor=064e3b" alt="license"></a>
|
|
10
10
|
<a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/DSH-Plugin-8b5cf6.svg?style=for-the-badge&labelColor=2e1065" alt="DSH Plugin"></a>
|
|
11
11
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-20%2B-f59e0b.svg?style=for-the-badge&labelColor=451a03" alt="Node version"></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://goodandready.app/"><img src="https://img.shields.io/badge/Все_проекты_автора-goodandready.app-ff4500.svg?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1a1a2e" alt="Все проекты автора"></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
14
18
|
</div>
|
|
15
19
|
|
|
16
20
|
---
|
package/lib/client.js
CHANGED
|
@@ -3682,6 +3682,22 @@ window.__ModuleLoader__.load({
|
|
|
3682
3682
|
} catch (err) { return {} }
|
|
3683
3683
|
}
|
|
3684
3684
|
const fill = (template, params) => template.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match)
|
|
3685
|
+
// lookup: в ядре 0.1.2 lookup(ns, key, chain) требует третий довод —
|
|
3686
|
+
// цепочку языков; в старых ядрах его два. Спрашиваем у самого метода
|
|
3687
|
+
// (lookup.length), цепочку берём у ядра (fallbackChain приватный, но в
|
|
3688
|
+
// собранном коде доступен), иначе минимальная [active]. Голый вызов без
|
|
3689
|
+
// chain ронял чужой слот sidebar.workspaces (chain is not iterable).
|
|
3690
|
+
const lookupChain = () => {
|
|
3691
|
+
try {
|
|
3692
|
+
const chain = runtime.fallbackChain && runtime.fallbackChain(runtime.getLocale().active)
|
|
3693
|
+
if (Array.isArray(chain) && chain.length) return chain
|
|
3694
|
+
} catch (err) { /* ignore */ }
|
|
3695
|
+
return [runtime.getLocale().active]
|
|
3696
|
+
}
|
|
3697
|
+
const lookup = (ns, key) => {
|
|
3698
|
+
const chain = lookupChain()
|
|
3699
|
+
return runtime.lookup.length >= 3 ? runtime.lookup(ns, key, chain) : runtime.lookup(ns, key)
|
|
3700
|
+
}
|
|
3685
3701
|
runtime.translate = function (ns, key, params) {
|
|
3686
3702
|
// 1. Пользовательский override — самый верхний слой.
|
|
3687
3703
|
const overrides = getOverrides()
|
|
@@ -3698,7 +3714,7 @@ window.__ModuleLoader__.load({
|
|
|
3698
3714
|
// Ядро выбирает .one/.other по n===1; русскому нужны few/many.
|
|
3699
3715
|
if (form === 'few' || form === 'many') {
|
|
3700
3716
|
const pluralKey = m[1] + '.' + form
|
|
3701
|
-
const template =
|
|
3717
|
+
const template = lookup(ns, pluralKey) ?? lookup('common', pluralKey)
|
|
3702
3718
|
if (template !== undefined) {
|
|
3703
3719
|
return fill(template, params)
|
|
3704
3720
|
}
|
|
@@ -3707,7 +3723,7 @@ window.__ModuleLoader__.load({
|
|
|
3707
3723
|
// Счётный ключ без суффикса: t('X', {n}). Если словарь даёт формы
|
|
3708
3724
|
// X.one / X.few / X.many - берём подходящую, иначе как раньше.
|
|
3709
3725
|
const pluralKey = key + '.' + form
|
|
3710
|
-
const template =
|
|
3726
|
+
const template = lookup(ns, pluralKey) ?? lookup('common', pluralKey)
|
|
3711
3727
|
if (template !== undefined) {
|
|
3712
3728
|
return fill(template, params)
|
|
3713
3729
|
}
|
|
@@ -3776,12 +3792,23 @@ window.__ModuleLoader__.load({
|
|
|
3776
3792
|
|
|
3777
3793
|
// 3. Флаг russianLang.enabled всегда повторяет активный язык: выбор
|
|
3778
3794
|
// английского или китайского в родном меню выключает русский и наоборот.
|
|
3795
|
+
// scope.set возвращает Promise<void> в v0.1.2-alpha.2, ошибка приходит
|
|
3796
|
+
// через rejection и try/catch её не ловит — обрабатываем оба канала.
|
|
3779
3797
|
const syncFlag = () => {
|
|
3780
3798
|
try {
|
|
3781
3799
|
const wantRu = runtime.getLocale().active === 'ru'
|
|
3782
3800
|
const value = scope.getSnapshot().value || {}
|
|
3783
|
-
if (!!value.enabled !== wantRu)
|
|
3784
|
-
|
|
3801
|
+
if (!!value.enabled !== wantRu) {
|
|
3802
|
+
const r = scope.set('enabled', wantRu)
|
|
3803
|
+
if (r && typeof r.catch === 'function') {
|
|
3804
|
+
r.catch((err) => {
|
|
3805
|
+
console.warn('dsh-russian-lang: scope.set enabled failed', err && err.message || err)
|
|
3806
|
+
})
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
} catch (err) {
|
|
3810
|
+
/* snapshot ещё не готов, либо scope.set синхронно бросил */
|
|
3811
|
+
}
|
|
3785
3812
|
}
|
|
3786
3813
|
ctx.effect(() => {
|
|
3787
3814
|
try { return runtime.subscribe(syncFlag) }
|
|
@@ -4224,7 +4251,17 @@ window.__ModuleLoader__.load({
|
|
|
4224
4251
|
const setTypo = (patch) => {
|
|
4225
4252
|
const next = Object.assign({}, typo, patch)
|
|
4226
4253
|
setTypoState(next) // мгновенно
|
|
4227
|
-
|
|
4254
|
+
// v0.1.2-alpha.2: scope.set returns Promise<void>, ошибка приходит через
|
|
4255
|
+
// promise rejection. catch на promise не обработает sync throw, поэтому
|
|
4256
|
+
// принимаем оба и логируем только реальные.
|
|
4257
|
+
try {
|
|
4258
|
+
const r = scope.set('typography', next)
|
|
4259
|
+
if (r && typeof r.catch === 'function') r.catch((err) => {
|
|
4260
|
+
console.warn('dsh-russian-lang: scope.set typography failed', err && err.message || err)
|
|
4261
|
+
})
|
|
4262
|
+
} catch (err) {
|
|
4263
|
+
console.warn('dsh-russian-lang: scope.set typography sync threw', err && err.message || err)
|
|
4264
|
+
}
|
|
4228
4265
|
}
|
|
4229
4266
|
const onEnabled = (ev) => { if (toggleRu) toggleRu(ev.target.checked) }
|
|
4230
4267
|
|
|
@@ -4276,8 +4313,18 @@ window.__ModuleLoader__.load({
|
|
|
4276
4313
|
(ev) => setTypo({ enabled: ev.target.checked }), !ruActive), t('typographyDesc')),
|
|
4277
4314
|
row(t('yo'), checkbox(typography.yo === true,
|
|
4278
4315
|
(ev) => setTypo({ yo: ev.target.checked }), !ruActive), t('yoDesc')),
|
|
4279
|
-
row(t('agentPrompt'), checkbox(value.agentPrompt === true,
|
|
4280
|
-
(ev) => {
|
|
4316
|
+
row(t('agentPrompt'), checkbox(value.overrides && value.overrides.agentPrompt === true,
|
|
4317
|
+
(ev) => {
|
|
4318
|
+
const next = Object.assign({}, value.overrides || {}, { agentPrompt: ev.target.checked })
|
|
4319
|
+
try {
|
|
4320
|
+
const r = scope.set('overrides', next)
|
|
4321
|
+
if (r && typeof r.catch === 'function') r.catch((err) => {
|
|
4322
|
+
console.warn('dsh-russian-lang: scope.set overrides failed', err && err.message || err)
|
|
4323
|
+
})
|
|
4324
|
+
} catch (err) {
|
|
4325
|
+
console.warn('dsh-russian-lang: scope.set overrides sync threw', err && err.message || err)
|
|
4326
|
+
}
|
|
4327
|
+
}, false), t('agentPromptDesc')),
|
|
4281
4328
|
React.createElement('div', { className: 'rl-note' },
|
|
4282
4329
|
t('overridesCount') + ': ' + overridesCount),
|
|
4283
4330
|
React.createElement('div', { className: 'rl-hint' }, t('altL')),
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@goodandready/dsh-russian-lang",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Russian localization for the DeepSeek Harness web UI: adds Русский as the third option in the native Settings - General - Language menu. Translates the full core surface (100% coverage of DSH 0.1.1-rc.2) plus 16 community plugin namespaces - 52 namespaces, 2795 strings (many machine-drafted, queued for manual review), with Russian plural forms, count-key plurals, a typography pass (guillemets, em dash, nbsp), a wrong-layout input hint and browser spellcheck. The locale runtime snapshot is extended at runtime on unpatched cores; no files in the DSH installation are modified. The choice is persisted through the plugin-owned russian-lang namespace.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./lib/index.js",
|
|
9
|
-
"./client": "./lib/client.js",
|
|
10
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
11
|
-
"./package.json": "./package.json"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"lib",
|
|
15
|
-
"ru",
|
|
16
|
-
"ru-plugins",
|
|
17
|
-
"cordis.patch.yml",
|
|
18
|
-
"README.md",
|
|
19
|
-
"LICENSE",
|
|
20
|
-
"docs/media"
|
|
21
|
-
],
|
|
22
|
-
"dsh": {
|
|
23
|
-
"bundle": {
|
|
24
|
-
"patch": "./cordis.patch.yml"
|
|
25
|
-
},
|
|
26
|
-
"client": {
|
|
27
|
-
"platform": "web",
|
|
28
|
-
"inject": [
|
|
29
|
-
"@deepseek-ai/dsh-client-locale",
|
|
30
|
-
"@deepseek-ai/dsh-client-ui-settings"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"deepseek-harness",
|
|
36
|
-
"dsh",
|
|
37
|
-
"dsh-plugin",
|
|
38
|
-
"i18n",
|
|
39
|
-
"locale",
|
|
40
|
-
"russian"
|
|
41
|
-
],
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=20"
|
|
45
|
-
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"build": "python3 build.py",
|
|
48
|
-
"check": "python3 check-coverage.py",
|
|
49
|
-
"test": "python3 test/test_extract.py",
|
|
50
|
-
"smoke": "python3 test/smoke.py"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"websocket-client": "^1.7.0"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
57
|
-
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
60
|
-
"@deepseek-ai/dsh-settings": "^0.1.2-alpha.2"
|
|
61
|
-
},
|
|
62
|
-
"repository": {
|
|
63
|
-
"type": "git",
|
|
64
|
-
"url": "git+https://github.com/GooDAnDReaDY/dsh-russian-lang.git"
|
|
65
|
-
},
|
|
66
|
-
"homepage": "https://github.com/GooDAnDReaDY/dsh-russian-lang#readme",
|
|
67
|
-
"bugs": {
|
|
68
|
-
"url": "https://github.com/GooDAnDReaDY/dsh-russian-lang/issues"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@goodandready/dsh-russian-lang",
|
|
3
|
+
"version": "0.1.27",
|
|
4
|
+
"description": "Russian localization for the DeepSeek Harness web UI: adds Русский as the third option in the native Settings - General - Language menu. Translates the full core surface (100% coverage of DSH 0.1.1-rc.2) plus 16 community plugin namespaces - 52 namespaces, 2795 strings (many machine-drafted, queued for manual review), with Russian plural forms, count-key plurals, a typography pass (guillemets, em dash, nbsp), a wrong-layout input hint and browser spellcheck. The locale runtime snapshot is extended at runtime on unpatched cores; no files in the DSH installation are modified. The choice is persisted through the plugin-owned russian-lang namespace.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./client": "./lib/client.js",
|
|
10
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib",
|
|
15
|
+
"ru",
|
|
16
|
+
"ru-plugins",
|
|
17
|
+
"cordis.patch.yml",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"docs/media"
|
|
21
|
+
],
|
|
22
|
+
"dsh": {
|
|
23
|
+
"bundle": {
|
|
24
|
+
"patch": "./cordis.patch.yml"
|
|
25
|
+
},
|
|
26
|
+
"client": {
|
|
27
|
+
"platform": "web",
|
|
28
|
+
"inject": [
|
|
29
|
+
"@deepseek-ai/dsh-client-locale",
|
|
30
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"deepseek-harness",
|
|
36
|
+
"dsh",
|
|
37
|
+
"dsh-plugin",
|
|
38
|
+
"i18n",
|
|
39
|
+
"locale",
|
|
40
|
+
"russian"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "python3 build.py",
|
|
48
|
+
"check": "python3 check-coverage.py",
|
|
49
|
+
"test": "python3 test/test_extract.py",
|
|
50
|
+
"smoke": "python3 test/smoke.py"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"websocket-client": "^1.7.0"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
60
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-alpha.2"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "git+https://github.com/GooDAnDReaDY/dsh-russian-lang.git"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://github.com/GooDAnDReaDY/dsh-russian-lang#readme",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/GooDAnDReaDY/dsh-russian-lang/issues"
|
|
69
|
+
}
|
|
70
|
+
}
|