@goodandready/dsh-russian-lang 0.1.14 → 0.1.15
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/lib/client.js +32 -13
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2702,7 +2702,7 @@ window.__ModuleLoader__.load({
|
|
|
2702
2702
|
}
|
|
2703
2703
|
|
|
2704
2704
|
// Подписи собственной карточки настроек (namespace russian-lang).
|
|
2705
|
-
RU['russian-lang'] = {"cardTitle": "Русская локализация", "cardSub": "Язык интерфейса, типографика, раскладка", "enabled": "Русский язык включён", "typography": "Типографика вывода", "yo": "Буква ё", "overridesCount": "Своих переопределений", "statusLoading": "Настройки загружаются…", "statusUnavailable": "Настройки недоступны на этом хосте", "hint": "Машинные переводы помечены в очереди выверки; ручная правка словарей приоритетна.", "altL": "Alt+L — конвертировать раскладку текущего поля"}
|
|
2705
|
+
RU['russian-lang'] = {"cardTitle": "Русская локализация", "cardSub": "Язык интерфейса, типографика, раскладка", "enabled": "Русский язык включён", "typography": "Типографика вывода", "typographyDesc": "Исправляет типографику в тексте ответов: кавычки-«ёлочки», тире вместо дефисов, неразрывные пробелы после коротких предлогов. Код и ссылки не трогаются.", "yo": "Буква ё", "yoDesc": "Восстанавливать «ё» в частых словах (ещё, чёрный, идёт и др.), написанных через «е». Неоднозначные слова (например «все/всё») не трогаются.", "overridesCount": "Своих переопределений", "statusLoading": "Настройки загружаются…", "statusUnavailable": "Настройки недоступны на этом хосте", "hint": "Машинные переводы помечены в очереди выверки; ручная правка словарей приоритетна.", "altL": "Alt+L — конвертировать раскладку текущего поля"}
|
|
2706
2706
|
|
|
2707
2707
|
const SETTINGS_NS_NAME = 'russian-lang'
|
|
2708
2708
|
|
|
@@ -3189,31 +3189,49 @@ window.__ModuleLoader__.load({
|
|
|
3189
3189
|
const [open, setOpen] = React.useState(false)
|
|
3190
3190
|
const [snap, setSnap] = React.useState(
|
|
3191
3191
|
() => (scope && scope.getSnapshot ? scope.getSnapshot() : { status: 'loading', value: {} }))
|
|
3192
|
+
const [ruActive, setRuActive] = React.useState(
|
|
3193
|
+
() => { try { return runtime.getLocale().active === 'ru' } catch (e) { return false } })
|
|
3194
|
+
// Оптимистичное состояние типографики: галочка переключается сразу,
|
|
3195
|
+
// а host-подтверждение (scope.subscribe) лишь синхронизирует его позже.
|
|
3196
|
+
const [typo, setTypoState] = React.useState(() =>
|
|
3197
|
+
(snap.value && snap.value.typography) || {})
|
|
3198
|
+
|
|
3192
3199
|
React.useEffect(() => {
|
|
3193
3200
|
if (!scope || !scope.subscribe) return undefined
|
|
3194
|
-
const un = scope.subscribe(() =>
|
|
3201
|
+
const un = scope.subscribe(() => {
|
|
3202
|
+
const s = scope.getSnapshot()
|
|
3203
|
+
setSnap(s)
|
|
3204
|
+
if (s.value && s.value.typography) setTypoState(s.value.typography)
|
|
3205
|
+
})
|
|
3195
3206
|
setSnap(scope.getSnapshot())
|
|
3196
3207
|
return un
|
|
3197
3208
|
}, [])
|
|
3209
|
+
React.useEffect(() => {
|
|
3210
|
+
try {
|
|
3211
|
+
const un = runtime.subscribe(() => {
|
|
3212
|
+
try { setRuActive(runtime.getLocale().active === 'ru') } catch (e) { /* ignore */ }
|
|
3213
|
+
})
|
|
3214
|
+
return un
|
|
3215
|
+
} catch (e) { return undefined }
|
|
3216
|
+
}, [])
|
|
3198
3217
|
|
|
3199
3218
|
const status = snap.status || 'loading'
|
|
3200
3219
|
const value = snap.value || {}
|
|
3201
|
-
const typography =
|
|
3220
|
+
const typography = typo
|
|
3202
3221
|
const overridesCount = Object.keys(value.overrides || {}).length
|
|
3203
3222
|
|
|
3204
|
-
const ruActive = (() => {
|
|
3205
|
-
try { return runtime.getLocale().active === 'ru' } catch (err) { return false }
|
|
3206
|
-
})()
|
|
3207
|
-
|
|
3208
3223
|
const setTypo = (patch) => {
|
|
3209
|
-
const next = Object.assign({},
|
|
3224
|
+
const next = Object.assign({}, typo, patch)
|
|
3225
|
+
setTypoState(next) // мгновенно
|
|
3210
3226
|
try { scope.set('typography', next) } catch (err) { /* ignore */ }
|
|
3211
3227
|
}
|
|
3212
3228
|
const onEnabled = (ev) => { if (toggleRu) toggleRu(ev.target.checked) }
|
|
3213
3229
|
|
|
3214
|
-
const row = (label, control) =>
|
|
3230
|
+
const row = (label, control, desc) =>
|
|
3215
3231
|
React.createElement('div', { className: 'rl-field' },
|
|
3216
|
-
React.createElement('span', { className: 'rl-label' }, label),
|
|
3232
|
+
React.createElement('span', { className: 'rl-label' }, label),
|
|
3233
|
+
control,
|
|
3234
|
+
desc ? React.createElement('div', { className: 'rl-desc' }, desc) : null)
|
|
3217
3235
|
|
|
3218
3236
|
const checkbox = (checked, onChange, disabled) =>
|
|
3219
3237
|
React.createElement('input', {
|
|
@@ -3239,11 +3257,11 @@ window.__ModuleLoader__.load({
|
|
|
3239
3257
|
statusLine || t('cardSub'))),
|
|
3240
3258
|
React.createElement('span', { className: 'rl-chev' }, open ? '▾' : '▸')),
|
|
3241
3259
|
open && React.createElement('div', { className: 'rl-body' },
|
|
3242
|
-
row(t('enabled'), checkbox(ruActive, onEnabled, false)),
|
|
3260
|
+
row(t('enabled'), checkbox(ruActive, onEnabled, false), null),
|
|
3243
3261
|
row(t('typography'), checkbox(typography.enabled !== false && ruActive,
|
|
3244
|
-
(ev) => setTypo({ enabled: ev.target.checked }), !ruActive)),
|
|
3262
|
+
(ev) => setTypo({ enabled: ev.target.checked }), !ruActive), t('typographyDesc')),
|
|
3245
3263
|
row(t('yo'), checkbox(typography.yo === true,
|
|
3246
|
-
(ev) => setTypo({ yo: ev.target.checked }), !ruActive)),
|
|
3264
|
+
(ev) => setTypo({ yo: ev.target.checked }), !ruActive), t('yoDesc')),
|
|
3247
3265
|
React.createElement('div', { className: 'rl-note' },
|
|
3248
3266
|
t('overridesCount') + ': ' + overridesCount),
|
|
3249
3267
|
React.createElement('div', { className: 'rl-hint' }, t('altL')),
|
|
@@ -3261,6 +3279,7 @@ window.__ModuleLoader__.load({
|
|
|
3261
3279
|
'.rl-body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}',
|
|
3262
3280
|
'.rl-field{display:flex;flex-direction:column;gap:6px;padding:12px 0}',
|
|
3263
3281
|
'.rl-label{color:var(--dsw-alias-label-primary);font-size:13px}',
|
|
3282
|
+
'.rl-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.4}',
|
|
3264
3283
|
'.rl-check{width:16px;height:16px;accent-color:var(--dsw-alias-label-primary)}',
|
|
3265
3284
|
'.rl-note{color:var(--dsw-alias-label-secondary);font-size:12px;padding:8px 0 4px}',
|
|
3266
3285
|
'.rl-hint{color:var(--dsw-alias-label-secondary);font-size:12px;padding:4px 0 8px}',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-russian-lang",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|