@yuneta/gobj-ui 7.20.0 → 7.20.1

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.
@@ -10785,12 +10785,13 @@ function apply_view_mode(gobj) {
10785
10785
  if (priv.$mode_btn) {
10786
10786
  let icon = text_mode ? "yi-sitemap" : "yi-code";
10787
10787
  let key = text_mode ? "tree view" : "text view";
10788
+ let label = text_mode ? (0, i18next.t)("tree view") : (0, i18next.t)("text view");
10788
10789
  let $i = priv.$mode_btn.querySelector("i");
10789
10790
  if ($i) $i.className = icon;
10790
10791
  priv.$mode_btn.setAttribute("data-i18n-title", key);
10791
10792
  priv.$mode_btn.setAttribute("data-i18n-aria-label", key);
10792
- priv.$mode_btn.setAttribute("title", (0, i18next.t)(key));
10793
- priv.$mode_btn.setAttribute("aria-label", (0, i18next.t)(key));
10793
+ priv.$mode_btn.setAttribute("title", label);
10794
+ priv.$mode_btn.setAttribute("aria-label", label);
10794
10795
  }
10795
10796
  }
10796
10797
  /************************************************************
@@ -10780,12 +10780,13 @@ function apply_view_mode(gobj) {
10780
10780
  if (priv.$mode_btn) {
10781
10781
  let icon = text_mode ? "yi-sitemap" : "yi-code";
10782
10782
  let key = text_mode ? "tree view" : "text view";
10783
+ let label = text_mode ? t("tree view") : t("text view");
10783
10784
  let $i = priv.$mode_btn.querySelector("i");
10784
10785
  if ($i) $i.className = icon;
10785
10786
  priv.$mode_btn.setAttribute("data-i18n-title", key);
10786
10787
  priv.$mode_btn.setAttribute("data-i18n-aria-label", key);
10787
- priv.$mode_btn.setAttribute("title", t(key));
10788
- priv.$mode_btn.setAttribute("aria-label", t(key));
10788
+ priv.$mode_btn.setAttribute("title", label);
10789
+ priv.$mode_btn.setAttribute("aria-label", label);
10789
10790
  }
10790
10791
  }
10791
10792
  /************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.20.0",
3
+ "version": "7.20.1",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/c_yui_json.js CHANGED
@@ -396,15 +396,22 @@ function apply_view_mode(gobj)
396
396
 
397
397
  if(priv.$mode_btn) {
398
398
  let icon = text_mode? "yi-sitemap": "yi-code";
399
+ /* Both keys spelled out inside t(), never t(variable): the apps'
400
+ * validate-locales scans for t("literal"), and a key it cannot
401
+ * see is a key it cannot demand — i18next then answers an
402
+ * undefined key with the key ITSELF, so the button renders in
403
+ * lower-case English and never changes language. `key` still
404
+ * carries the data-i18n-* attrs refresh_language() reads. */
399
405
  let key = text_mode? "tree view": "text view";
406
+ let label = text_mode? t("tree view"): t("text view");
400
407
  let $i = priv.$mode_btn.querySelector('i');
401
408
  if($i) {
402
409
  $i.className = icon;
403
410
  }
404
411
  priv.$mode_btn.setAttribute("data-i18n-title", key);
405
412
  priv.$mode_btn.setAttribute("data-i18n-aria-label", key);
406
- priv.$mode_btn.setAttribute("title", t(key));
407
- priv.$mode_btn.setAttribute("aria-label", t(key));
413
+ priv.$mode_btn.setAttribute("title", label);
414
+ priv.$mode_btn.setAttribute("aria-label", label);
408
415
  }
409
416
  }
410
417