@goodandready/dsh-russian-lang 0.1.25 → 0.1.26

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.
Files changed (2) hide show
  1. package/lib/client.js +18 -2
  2. package/package.json +1 -1
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 = this.lookup(ns, pluralKey) ?? this.lookup('common', pluralKey)
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 = this.lookup(ns, pluralKey) ?? this.lookup('common', pluralKey)
3726
+ const template = lookup(ns, pluralKey) ?? lookup('common', pluralKey)
3711
3727
  if (template !== undefined) {
3712
3728
  return fill(template, params)
3713
3729
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-russian-lang",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
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",