@burdenoff/microfe-i18n 2026.1129.1 → 2026.1129.3

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 (46) hide show
  1. package/dist/generated/global-operations.d.ts +292 -0
  2. package/dist/generated/global-operations.js +143 -15
  3. package/dist/generated/global-types.js +3 -1
  4. package/dist/i18n/I18nRoutes.d.ts +5 -3
  5. package/dist/i18n/I18nRoutes.js +48 -47
  6. package/dist/i18n/v2/LanguageDialog.d.ts +17 -0
  7. package/dist/i18n/v2/LanguageDialog.js +193 -0
  8. package/dist/i18n/v2/LanguagesPage.js +82 -53
  9. package/dist/i18n/v2/LanguagesTab.d.ts +3 -1
  10. package/dist/i18n/v2/LanguagesTab.js +31 -26
  11. package/dist/i18n/v2/ReviewRows.js +2 -2
  12. package/dist/i18n/v2/ReviewTab.d.ts +3 -1
  13. package/dist/i18n/v2/ReviewTab.js +27 -26
  14. package/dist/i18n/v2/TabRedirect.d.ts +8 -0
  15. package/dist/i18n/v2/TabRedirect.js +26 -9
  16. package/dist/i18n/v2/language/FormatsTab.d.ts +6 -0
  17. package/dist/i18n/v2/language/FormatsTab.js +93 -0
  18. package/dist/i18n/v2/language/LanguagePage.d.ts +3 -0
  19. package/dist/i18n/v2/language/LanguagePage.js +245 -0
  20. package/dist/i18n/v2/language/TranslateDialog.d.ts +18 -0
  21. package/dist/i18n/v2/language/TranslateDialog.js +101 -0
  22. package/dist/i18n/v2/language/WordsTab.d.ts +11 -0
  23. package/dist/i18n/v2/language/WordsTab.js +190 -0
  24. package/dist/i18n/v2/language/useLanguage.d.ts +23 -0
  25. package/dist/i18n/v2/language/useLanguage.js +22 -0
  26. package/dist/i18n/v2/language/useWords.d.ts +31 -0
  27. package/dist/i18n/v2/language/useWords.js +51 -0
  28. package/dist/i18n/v2/languageModel.d.ts +61 -0
  29. package/dist/i18n/v2/languageModel.js +120 -0
  30. package/dist/i18n/v2/links.d.ts +4 -1
  31. package/dist/i18n/v2/links.js +11 -10
  32. package/dist/i18n/v2/model.d.ts +12 -2
  33. package/dist/i18n/v2/model.js +17 -14
  34. package/dist/i18n/v2/reviewMessages.d.ts +1 -1
  35. package/dist/i18n/v2/useAddLanguage.d.ts +10 -0
  36. package/dist/i18n/v2/useAddLanguage.js +30 -0
  37. package/dist/i18n/v2/useDebouncedValue.d.ts +1 -0
  38. package/dist/i18n/v2/useDebouncedValue.js +10 -0
  39. package/dist/i18n/v2/useReviewActions.d.ts +3 -1
  40. package/dist/i18n/v2/useReviewActions.js +24 -24
  41. package/dist/i18n/v2/useReviewQueue.d.ts +5 -2
  42. package/dist/i18n/v2/useReviewQueue.js +9 -6
  43. package/dist/node_modules/lucide-react/dist/esm/icons/calendar-days.js +49 -0
  44. package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.js +21 -0
  45. package/dist/node_modules/lucide-react/dist/esm/icons/eye.js +12 -0
  46. package/package.json +1 -1
@@ -55,8 +55,8 @@ function u({ queue: n, actions: u, byCode: d, sourceName: f }) {
55
55
  onClick: () => void u.approveOne(t),
56
56
  disabled: u.bulk || u.busy.has(t.id),
57
57
  "aria-busy": u.busy.has(t.id) || void 0,
58
- "aria-label": p("i18n.v3.approveWhere", "Approve: {{where}}", { where: r(t.key) }),
59
- children: [/* @__PURE__ */ i(e, { "aria-hidden": "true" }), p("i18n.v3.approve", "Approve")]
58
+ "aria-label": p("i18n.v3.approveLiveWhere", "Approve and put live: {{where}}", { where: r(t.key) }),
59
+ children: [/* @__PURE__ */ i(e, { "aria-hidden": "true" }), p("i18n.v3.approveLive", "Approve and put live")]
60
60
  }),
61
61
  footer: n.hasMore ? /* @__PURE__ */ i(o, {
62
62
  variant: "outline",
@@ -1,6 +1,8 @@
1
1
  import { LanguageRow } from './useLanguagesData';
2
- export declare function ReviewTab({ languages, sourceName, onReviewed, }: {
2
+ export declare function ReviewTab({ languages, sourceName, onReviewed, fixedLanguage, }: {
3
3
  languages: readonly LanguageRow[];
4
4
  sourceName: string;
5
5
  onReviewed: () => void;
6
+ /** On a language's page: that language, with no picker. */
7
+ fixedLanguage?: string;
6
8
  }): import('react').JSX.Element;
@@ -63,23 +63,23 @@ function C({ languageName: t }) {
63
63
  description: t ? r("i18n.v3.nothingToReviewIn", "Nothing in {{name}} waits for review. New translations wait here until someone checks them.", { name: t }) : r("i18n.v3.nothingToReviewBody", "New translations wait here until someone checks them.")
64
64
  });
65
65
  }
66
- function w({ languageCode: e, languages: i, sourceName: c, onReviewed: f }) {
67
- let m = n(), h = s(e), g = o(h, f), _ = new Map(i.map((e) => [e.code, e])), v = h.rows.length === 0, y = /* @__PURE__ */ l(a, {
68
- queue: h,
69
- actions: g,
66
+ function w({ languageCode: e, pickLanguage: i, languages: c, sourceName: f, onReviewed: m }) {
67
+ let h = n(), g = s(e), _ = new Map(c.map((e) => [e.code, e])), v = e ? _.get(e)?.name ?? e : null, y = o(g, v, m), b = g.rows.length === 0, w = /* @__PURE__ */ l(a, {
68
+ queue: g,
69
+ actions: y,
70
70
  byCode: _,
71
- sourceName: c
71
+ sourceName: f
72
72
  });
73
- return h.error && v ? y = /* @__PURE__ */ l(p, {
74
- what: m("i18n.v3.tab.review", "Review queue"),
75
- error: h.error,
76
- onRetry: h.retry
77
- }) : !h.loading && v && (y = /* @__PURE__ */ l(C, { languageName: e ? _.get(e)?.name ?? e : null })), /* @__PURE__ */ u("div", {
73
+ return g.error && b ? w = /* @__PURE__ */ l(p, {
74
+ what: h("i18n.v3.tab.review", "Review queue"),
75
+ error: g.error,
76
+ onRetry: g.retry
77
+ }) : !g.loading && b && (w = /* @__PURE__ */ l(C, { languageName: v })), /* @__PURE__ */ u("div", {
78
78
  className: "flex flex-col gap-3",
79
79
  children: [
80
80
  /* @__PURE__ */ l(S, {
81
- queue: h,
82
- actions: g
81
+ queue: g,
82
+ actions: y
83
83
  }),
84
84
  /* @__PURE__ */ u("div", {
85
85
  className: "flex flex-wrap items-center gap-2",
@@ -87,35 +87,36 @@ function w({ languageCode: e, languages: i, sourceName: c, onReviewed: f }) {
87
87
  /* @__PURE__ */ l("b", {
88
88
  className: "text-sm font-semibold text-text-primary",
89
89
  "data-testid": "review-waiting",
90
- children: m("i18n.v3.waitingCount", "{{count}} waiting", { count: r.format(h.total) })
90
+ children: h("i18n.v3.waitingCount", "{{count}} waiting", { count: r.format(g.total) })
91
91
  }),
92
- /* @__PURE__ */ l(x, {
92
+ i ? /* @__PURE__ */ l(x, {
93
93
  languageCode: e,
94
- languages: i
95
- }),
94
+ languages: c
95
+ }) : null,
96
96
  /* @__PURE__ */ l("span", { className: "flex-1" }),
97
- v ? null : /* @__PURE__ */ u(d, {
97
+ b ? null : /* @__PURE__ */ u(d, {
98
98
  variant: "outline",
99
99
  size: "sm",
100
- onClick: () => void g.approveShown(),
101
- disabled: g.bulk,
102
- "aria-busy": g.bulk || void 0,
100
+ onClick: () => void y.approveShown(),
101
+ disabled: y.bulk,
102
+ "aria-busy": y.bulk || void 0,
103
103
  "data-testid": "review-approve-all",
104
- children: [/* @__PURE__ */ l(t, { "aria-hidden": "true" }), m("i18n.v3.approveAll", "Approve all shown")]
104
+ children: [/* @__PURE__ */ l(t, { "aria-hidden": "true" }), h("i18n.v3.approveLiveAll", "Approve and put live ({{count}})", { count: r.format(g.rows.length) })]
105
105
  })
106
106
  ]
107
107
  }),
108
- y
108
+ w
109
109
  ]
110
110
  });
111
111
  }
112
- function T({ languages: e, sourceName: t, onReviewed: n }) {
113
- let [r] = c(), i = r.get("language") || null;
112
+ function T({ languages: e, sourceName: t, onReviewed: n, fixedLanguage: r }) {
113
+ let [i] = c(), a = r ?? (i.get("language") || null);
114
114
  return /* @__PURE__ */ l(w, {
115
- languageCode: i,
115
+ languageCode: a,
116
+ pickLanguage: !r,
116
117
  languages: e,
117
118
  sourceName: t,
118
119
  onReviewed: n
119
- }, i ?? b);
120
+ }, a ?? b);
120
121
  }
121
122
  export { T as ReviewTab };
@@ -2,3 +2,11 @@ export declare function TabRedirect({ basePath, tab, }: {
2
2
  basePath: string;
3
3
  tab: string;
4
4
  }): import('react').JSX.Element;
5
+ /** `languages/new`: Languages with Add language open. */
6
+ export declare function AddLanguageRedirect({ basePath }: {
7
+ basePath: string;
8
+ }): import('react').JSX.Element;
9
+ /** `locales/<code>`: the language's own page. */
10
+ export declare function LanguageRedirect({ basePath }: {
11
+ basePath: string;
12
+ }): import('react').JSX.Element;
@@ -1,14 +1,31 @@
1
1
  import { joinPath as e } from "../utils/paths.js";
2
- import { Navigate as t, useSearchParams as n } from "react-router";
3
- import { jsx as r } from "react/jsx-runtime";
2
+ import { ADD_LANGUAGE_DIALOG as t } from "./links.js";
3
+ import { Navigate as n, useParams as r, useSearchParams as i } from "react-router";
4
+ import { jsx as a } from "react/jsx-runtime";
4
5
  // src/i18n/v2/TabRedirect.tsx
5
- function i({ basePath: i, tab: a }) {
6
- let [o] = n(), s = new URLSearchParams(o);
7
- a === "languages" ? s.delete("tab") : s.set("tab", a);
8
- let c = s.toString(), l = e(i, "languages");
9
- return /* @__PURE__ */ r(t, {
10
- to: c ? `${l}?${c}` : l,
6
+ function o(e, t) {
7
+ let n = t.toString();
8
+ return n ? `${e}?${n}` : e;
9
+ }
10
+ function s({ basePath: t, tab: r }) {
11
+ let [s] = i(), c = new URLSearchParams(s);
12
+ return r === "languages" ? c.delete("tab") : c.set("tab", r), /* @__PURE__ */ a(n, {
13
+ to: o(e(t, "languages"), c),
14
+ replace: !0
15
+ });
16
+ }
17
+ function c({ basePath: r }) {
18
+ let [s] = i(), c = new URLSearchParams(s);
19
+ return c.set("dialog", t), /* @__PURE__ */ a(n, {
20
+ to: o(e(r, "languages"), c),
21
+ replace: !0
22
+ });
23
+ }
24
+ function l({ basePath: t }) {
25
+ let { code: s = "" } = r(), [c] = i();
26
+ return /* @__PURE__ */ a(n, {
27
+ to: o(e(t, `languages/${encodeURIComponent(s)}`), new URLSearchParams(c)),
11
28
  replace: !0
12
29
  });
13
30
  }
14
- export { i as TabRedirect };
31
+ export { c as AddLanguageRedirect, l as LanguageRedirect, s as TabRedirect };
@@ -0,0 +1,6 @@
1
+ import { UpdateLanguageInput } from '../../../generated/global-types';
2
+ import { LanguageDetail } from './useLanguage';
3
+ export declare function FormatsTab({ language, onUpdate, }: {
4
+ language: LanguageDetail;
5
+ onUpdate: (input: UpdateLanguageInput) => Promise<void>;
6
+ }): import('react').JSX.Element;
@@ -0,0 +1,93 @@
1
+ import e from "../../../node_modules/lucide-react/dist/esm/icons/calendar-days.js";
2
+ import { useTr as t } from "../../hooks/useTr.js";
3
+ import { LanguageDirection as n } from "../../../generated/global-types.js";
4
+ import { DATE_FORMATS as r, TIME_FORMATS as i, formatExample as a, formatOptions as o } from "../languageModel.js";
5
+ import { useState as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { Segmented as u, Select as d, SelectContent as f, SelectItem as p, SelectTrigger as m, SelectValue as h, SettingRow as g, SettingsSection as _, useNotify as v } from "@burdenoff/fe-libs/ui";
8
+ // src/i18n/v2/language/FormatsTab.tsx
9
+ function y({ value: e, offered: t, disabled: n, onChange: r, ids: i, testId: s }) {
10
+ return /* @__PURE__ */ l(d, {
11
+ value: e,
12
+ onValueChange: r,
13
+ disabled: n,
14
+ children: [/* @__PURE__ */ c(m, {
15
+ className: "w-auto min-w-40",
16
+ "aria-labelledby": i.labelId,
17
+ "aria-describedby": i.descriptionId,
18
+ "data-testid": s,
19
+ children: /* @__PURE__ */ c(h, {})
20
+ }), /* @__PURE__ */ c(f, { children: o(t, e).map((e) => /* @__PURE__ */ c(p, {
21
+ value: e,
22
+ children: a(e)
23
+ }, e)) })]
24
+ });
25
+ }
26
+ function b({ language: o, onUpdate: d }) {
27
+ let f = t(), p = v(), [m, h] = s(!1), b = async (e) => {
28
+ h(!0);
29
+ try {
30
+ await d(e), p({
31
+ title: f("i18n.v3.lang.saved", "Saved"),
32
+ tone: "success"
33
+ });
34
+ } catch {
35
+ p({
36
+ title: f("i18n.v3.lang.saveFailed", "Couldn’t save it. Try again."),
37
+ tone: "error"
38
+ });
39
+ } finally {
40
+ h(!1);
41
+ }
42
+ };
43
+ return /* @__PURE__ */ l(_, {
44
+ icon: e,
45
+ title: f("i18n.v3.lang.formats", "Dates and numbers"),
46
+ description: f("i18n.v3.lang.formatsBody", "How {{name}} writes dates and times.", { name: o.name }),
47
+ children: [
48
+ /* @__PURE__ */ c(g, {
49
+ label: f("i18n.v3.lang.dates", "Dates"),
50
+ description: f("i18n.v3.lang.example", "Example: {{example}}", { example: a(o.dateFormat) }),
51
+ control: (e) => /* @__PURE__ */ c(y, {
52
+ value: o.dateFormat,
53
+ offered: r,
54
+ disabled: m,
55
+ onChange: (e) => void b({ dateFormat: e }),
56
+ ids: e,
57
+ testId: "lang-date-format"
58
+ })
59
+ }),
60
+ /* @__PURE__ */ c(g, {
61
+ label: f("i18n.v3.lang.times", "Times"),
62
+ description: f("i18n.v3.lang.example", "Example: {{example}}", { example: a(o.timeFormat) }),
63
+ control: (e) => /* @__PURE__ */ c(y, {
64
+ value: o.timeFormat,
65
+ offered: i,
66
+ disabled: m,
67
+ onChange: (e) => void b({ timeFormat: e }),
68
+ ids: e,
69
+ testId: "lang-time-format"
70
+ })
71
+ }),
72
+ /* @__PURE__ */ c(g, {
73
+ label: f("i18n.v3.lang.reads", "Reads"),
74
+ description: f("i18n.v3.lang.readsBody", "Right-to-left languages mirror the whole layout."),
75
+ control: (e) => /* @__PURE__ */ c(u, {
76
+ "aria-labelledby": e.labelId,
77
+ "aria-describedby": e.descriptionId,
78
+ disabled: m,
79
+ value: o.direction,
80
+ onValueChange: (e) => void b({ direction: e }),
81
+ options: [{
82
+ value: n.Ltr,
83
+ label: f("i18n.v3.lang.ltr", "Left to right")
84
+ }, {
85
+ value: n.Rtl,
86
+ label: f("i18n.v3.lang.rtl", "Right to left")
87
+ }]
88
+ })
89
+ })
90
+ ]
91
+ });
92
+ }
93
+ export { b as FormatsTab };
@@ -0,0 +1,3 @@
1
+ export declare function LanguagePage({ basePath }: {
2
+ basePath: string;
3
+ }): import('react').JSX.Element;
@@ -0,0 +1,245 @@
1
+ import e from "../../../node_modules/lucide-react/dist/esm/icons/download.js";
2
+ import t from "../../../node_modules/lucide-react/dist/esm/icons/eye.js";
3
+ import n from "../../../node_modules/lucide-react/dist/esm/icons/eye-off.js";
4
+ import r from "../../../node_modules/lucide-react/dist/esm/icons/languages.js";
5
+ import i from "../../../node_modules/lucide-react/dist/esm/icons/pencil.js";
6
+ import { useTr as a } from "../../hooks/useTr.js";
7
+ import { LanguageDirection as o, LanguageStatus as s } from "../../../generated/global-types.js";
8
+ import { COUNT as c, SHARE as l } from "../formats.js";
9
+ import { LanguageDialog as u } from "../LanguageDialog.js";
10
+ import { readLanguageTab as d, shownLanguageTabs as f } from "../languageModel.js";
11
+ import { languagesLinks as p } from "../links.js";
12
+ import { languageProgress as m } from "../model.js";
13
+ import { ReviewTab as h } from "../ReviewTab.js";
14
+ import { useLanguagesData as g } from "../useLanguagesData.js";
15
+ import { FormatsTab as _ } from "./FormatsTab.js";
16
+ import { useLanguage as v } from "./useLanguage.js";
17
+ import { WordsTab as y } from "./WordsTab.js";
18
+ import { useMemo as b, useState as x } from "react";
19
+ import { Link as S, useNavigate as C, useParams as w, useSearchParams as T } from "react-router";
20
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
21
+ import { EmptyState as O, IconTile as k, LoadError as A, PageTabs as j, Skeleton as M, StatusChip as N, SummaryCard as P, SummaryStrip as F, useConfirm as I, useNotify as L } from "@burdenoff/fe-libs/ui";
22
+ import { PageHeader as R } from "@burdenoff/fe-libs/chrome";
23
+ // src/i18n/v2/language/LanguagePage.tsx
24
+ function z({ language: e, progress: t }) {
25
+ let n = a();
26
+ return e.status === s.Draft ? /* @__PURE__ */ E(N, {
27
+ status: "waiting",
28
+ children: n("i18n.v3.status.draft", "Draft")
29
+ }) : e.status === s.Deprecated ? /* @__PURE__ */ E(N, {
30
+ status: "paused",
31
+ children: n("i18n.v3.status.off", "Turned off")
32
+ }) : t ? t.total > 0 && t.missing === 0 ? /* @__PURE__ */ E(N, {
33
+ status: "ok",
34
+ children: n("i18n.v3.lang.complete", "Complete")
35
+ }) : t.waiting > 0 ? /* @__PURE__ */ E(N, {
36
+ status: "waiting",
37
+ children: n("i18n.v3.lang.waiting", "{{count}} waiting for review", { count: c.format(t.waiting) })
38
+ }) : null : null;
39
+ }
40
+ function B({ progress: e, loading: t }) {
41
+ let n = a();
42
+ if (t) return /* @__PURE__ */ E("div", {
43
+ className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3",
44
+ children: Array.from({ length: 3 }, (e, t) => /* @__PURE__ */ E(M, { className: "h-24 rounded-xl" }, t))
45
+ });
46
+ let r = e?.share ?? null;
47
+ return /* @__PURE__ */ D(F, {
48
+ "aria-label": n("i18n.v3.lang.summary", "Summary"),
49
+ children: [
50
+ /* @__PURE__ */ E(P, {
51
+ label: n("i18n.v3.col.translated", "Translated"),
52
+ value: r === null ? "—" : l.format(Math.floor(r * 100) / 100),
53
+ detail: e ? n("i18n.v3.lang.ofTexts", "{{translated}} of {{total}} texts", {
54
+ translated: c.format(e.translated),
55
+ total: c.format(e.total)
56
+ }) : void 0
57
+ }),
58
+ /* @__PURE__ */ E(P, {
59
+ label: n("i18n.v3.col.waiting", "Waiting for review"),
60
+ value: c.format(e?.waiting ?? 0)
61
+ }),
62
+ /* @__PURE__ */ E(P, {
63
+ label: n("i18n.v3.lang.missing", "Missing"),
64
+ value: c.format(e?.missing ?? 0),
65
+ tone: (e?.missing ?? 0) > 0 ? "warn" : void 0
66
+ })
67
+ ]
68
+ });
69
+ }
70
+ function V({ basePath: c, language: v, update: S }) {
71
+ let w = a(), O = C(), A = L(), M = I(), [N] = T(), [P, F] = x(!1), V = p(c), H = g(), U = b(() => m(H.coverage.byProduct).get(v.code), [H.coverage.byProduct, v.code]), W = d(N.get("tab"), !1), G = v.direction === o.Rtl, K = H.languages.find((e) => e.isDefault)?.name ?? w("i18n.v3.sourceText", "Source text"), q = H.productsLoading || H.coverage.loading, J = v.status === s.Active, Y = [
72
+ v.nativeName === v.name ? "" : v.nativeName,
73
+ v.code,
74
+ U && U.share !== null ? w("i18n.v3.lang.shareLine", "{{share}} of every product is translated", { share: l.format(Math.floor(U.share * 100) / 100) }) : "",
75
+ G ? w("i18n.v3.lang.readsRtl", "reads right to left") : ""
76
+ ].filter(Boolean), X = async (e) => {
77
+ if (e || await M({
78
+ title: w("i18n.v3.lang.offTitle", "Turn off {{name}}?", { name: v.name }),
79
+ description: w("i18n.v3.lang.offBody", "It stops being offered as a language. Its translations are kept, and you can turn it back on."),
80
+ confirmLabel: w("i18n.v3.lang.off", "Turn off"),
81
+ tone: "danger"
82
+ })) try {
83
+ await S({ status: e ? s.Active : s.Deprecated }), A({
84
+ title: e ? w("i18n.v3.lang.onDone", "{{name}} is offered again", { name: v.name }) : w("i18n.v3.lang.offDone", "{{name}} is turned off", { name: v.name }),
85
+ tone: "success"
86
+ }), H.retry();
87
+ } catch {
88
+ A({
89
+ title: w("i18n.v3.lang.saveFailed", "Couldn’t save it. Try again."),
90
+ tone: "error"
91
+ });
92
+ }
93
+ }, Z = [
94
+ {
95
+ id: "names",
96
+ label: w("i18n.v3.lang.editNames", "Change the names…"),
97
+ icon: i,
98
+ onSelect: () => F(!0)
99
+ },
100
+ {
101
+ id: "export",
102
+ label: w("i18n.v3.exportWords", "Export translations"),
103
+ icon: e,
104
+ onSelect: () => O(V.exportWords)
105
+ },
106
+ J ? {
107
+ id: "off",
108
+ label: w("i18n.v3.lang.offMenu", "Turn off…"),
109
+ icon: n,
110
+ danger: !0,
111
+ separatorBefore: !0,
112
+ onSelect: () => void X(!1)
113
+ } : {
114
+ id: "on",
115
+ label: w("i18n.v3.lang.on", "Turn on"),
116
+ icon: t,
117
+ separatorBefore: !0,
118
+ onSelect: () => void X(!0)
119
+ }
120
+ ], Q = {
121
+ words: w("i18n.v3.lang.words", "Words"),
122
+ review: w("i18n.v3.col.waiting", "Waiting for review"),
123
+ formats: w("i18n.v3.lang.formats", "Dates and numbers")
124
+ }, ee = (e) => {
125
+ let t = new URLSearchParams(N);
126
+ e === "words" ? t.delete("tab") : t.set("tab", e);
127
+ let n = t.toString();
128
+ return n ? `${V.language(v.code)}?${n}` : V.language(v.code);
129
+ }, $;
130
+ return $ = W === "formats" ? /* @__PURE__ */ E(_, {
131
+ language: v,
132
+ onUpdate: S
133
+ }) : W === "review" ? /* @__PURE__ */ E(h, {
134
+ languages: H.languages,
135
+ sourceName: K,
136
+ onReviewed: H.coverage.reload,
137
+ fixedLanguage: v.code
138
+ }) : /* @__PURE__ */ E(y, {
139
+ products: H.products,
140
+ productsLoading: H.productsLoading,
141
+ languageCode: v.code,
142
+ languageName: v.name,
143
+ sourceName: K,
144
+ rtl: G,
145
+ onSaved: H.coverage.reload
146
+ }), /* @__PURE__ */ D("div", {
147
+ "data-account-pages-v2": "language",
148
+ className: "flex w-full min-w-0 flex-col gap-4",
149
+ children: [
150
+ /* @__PURE__ */ E(R, {
151
+ variant: "compact",
152
+ title: v.name,
153
+ description: Y.join(" · "),
154
+ back: {
155
+ label: w("i18n.v3.title", "Languages"),
156
+ to: V.page
157
+ },
158
+ icon: /* @__PURE__ */ E(k, {
159
+ size: "lg",
160
+ children: /* @__PURE__ */ E(r, { "aria-hidden": "true" })
161
+ }),
162
+ meta: /* @__PURE__ */ E(z, {
163
+ language: v,
164
+ progress: U
165
+ }),
166
+ more: Z,
167
+ moreLabel: w("i18n.v3.lang.moreFor", "More for {{name}}", { name: v.name })
168
+ }),
169
+ /* @__PURE__ */ E(B, {
170
+ progress: U,
171
+ loading: q
172
+ }),
173
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(j, {
174
+ ariaLabel: v.name,
175
+ activeId: W,
176
+ tabs: f(!1).map((e) => ({
177
+ id: e,
178
+ label: Q[e],
179
+ href: ee(e),
180
+ badge: e === "review" ? U?.waiting : void 0
181
+ }))
182
+ }), /* @__PURE__ */ E("div", {
183
+ className: "pt-4",
184
+ children: $
185
+ })] }),
186
+ /* @__PURE__ */ E(u, {
187
+ open: P,
188
+ editing: {
189
+ code: v.code,
190
+ name: v.name,
191
+ nativeName: v.nativeName,
192
+ direction: v.direction
193
+ },
194
+ onClose: () => F(!1),
195
+ onSave: async (e) => {
196
+ try {
197
+ return await S({
198
+ name: e.name,
199
+ nativeName: e.nativeName
200
+ }), A({
201
+ title: w("i18n.v3.lang.saved", "Saved"),
202
+ tone: "success"
203
+ }), H.retry(), "saved";
204
+ } catch {
205
+ return A({
206
+ title: w("i18n.v3.lang.saveFailed", "Couldn’t save it. Try again."),
207
+ tone: "error"
208
+ }), "failed";
209
+ }
210
+ }
211
+ })
212
+ ]
213
+ });
214
+ }
215
+ function H({ basePath: e }) {
216
+ let t = a(), { code: n = "" } = w(), i = v(n), o = p(e);
217
+ return i.language ? /* @__PURE__ */ E(V, {
218
+ basePath: e,
219
+ language: i.language,
220
+ update: i.update
221
+ }) : i.error ? /* @__PURE__ */ E(A, {
222
+ what: t("i18n.v3.lang.what", "this language"),
223
+ error: i.error,
224
+ onRetry: i.retry
225
+ }) : i.missing ? /* @__PURE__ */ E(O, {
226
+ kind: "not-found",
227
+ icon: /* @__PURE__ */ E(r, { "aria-hidden": "true" }),
228
+ title: t("i18n.v3.lang.notFound", "We can’t find that language"),
229
+ description: t("i18n.v3.lang.notFoundBody", "It may have a different code. Every language is on Languages."),
230
+ action: /* @__PURE__ */ E(S, {
231
+ to: o.page,
232
+ className: "text-sm font-semibold text-action-primary-bg hover:underline",
233
+ children: t("i18n.v3.lang.toLanguages", "Go to Languages")
234
+ })
235
+ }) : /* @__PURE__ */ D("div", {
236
+ className: "flex flex-col gap-4",
237
+ "aria-busy": "true",
238
+ children: [
239
+ /* @__PURE__ */ E(M, { className: "h-12 w-72 rounded-lg" }),
240
+ /* @__PURE__ */ E(M, { className: "h-24 rounded-xl" }),
241
+ /* @__PURE__ */ E(M, { className: "h-64 rounded-xl" })
242
+ ]
243
+ });
244
+ }
245
+ export { H as LanguagePage };
@@ -0,0 +1,18 @@
1
+ import { Word } from './useWords';
2
+ export interface TranslateTarget {
3
+ word: Word;
4
+ /** The live translation being changed, or null for a new one. */
5
+ translation: {
6
+ id: string;
7
+ value: string;
8
+ } | null;
9
+ }
10
+ export declare function TranslateDialog({ target, sourceName, languageName, languageCode, rtl, onSave, onClose, }: {
11
+ target: TranslateTarget | null;
12
+ sourceName: string;
13
+ languageName: string;
14
+ languageCode: string;
15
+ rtl: boolean;
16
+ onSave: (target: TranslateTarget, value: string) => Promise<boolean>;
17
+ onClose: () => void;
18
+ }): import('react').JSX.Element;
@@ -0,0 +1,101 @@
1
+ import { useTr as e } from "../../hooks/useTr.js";
2
+ import { COUNT as t } from "../formats.js";
3
+ import { useId as n, useState as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { Button as o, Label as s, ResponsiveDialog as c, ResponsiveDialogContent as l, ResponsiveDialogDescription as u, ResponsiveDialogFooter as d, ResponsiveDialogHeader as f, ResponsiveDialogTitle as p, Textarea as m } from "@burdenoff/fe-libs/ui";
6
+ // src/i18n/v2/language/TranslateDialog.tsx
7
+ function h({ target: c, sourceName: h, languageName: g, languageCode: _, rtl: v, onSave: y, onClose: b }) {
8
+ let x = e(), S = n(), [C, w] = r(c.translation?.value ?? ""), [T, E] = r(!1), D = c.word.characterLimit, O = D !== null && C.length > D, k = C.trim(), A = k === (c.translation?.value ?? "").trim(), j = async () => {
9
+ E(!0);
10
+ let e = !1;
11
+ try {
12
+ e = await y(k);
13
+ } finally {
14
+ E(!1);
15
+ }
16
+ e && b();
17
+ };
18
+ return /* @__PURE__ */ a(l, {
19
+ "data-testid": "translate-dialog",
20
+ children: [
21
+ /* @__PURE__ */ a(f, { children: [/* @__PURE__ */ i(p, { children: c.translation ? x("i18n.v3.word.editTitle", "Change the {{language}}", { language: g }) : x("i18n.v3.word.newTitle", "Translate into {{language}}", { language: g }) }), /* @__PURE__ */ i(u, { children: x("i18n.v3.word.liveNote", "It goes live straight away for everyone using {{language}}.", { language: g }) })] }),
22
+ /* @__PURE__ */ a("div", {
23
+ className: "flex flex-col gap-4",
24
+ children: [/* @__PURE__ */ a("div", {
25
+ className: "flex flex-col gap-1",
26
+ children: [
27
+ /* @__PURE__ */ i("span", {
28
+ className: "text-xs font-medium text-text-secondary",
29
+ children: c.word.namespace?.displayName ? x("i18n.v3.word.sourceIn", "{{source}} · {{where}}", {
30
+ source: h,
31
+ where: c.word.namespace.displayName
32
+ }) : h
33
+ }),
34
+ /* @__PURE__ */ i("p", {
35
+ className: "m-0 text-sm text-text-primary",
36
+ children: c.word.defaultValue ?? "—"
37
+ }),
38
+ c.word.description ? /* @__PURE__ */ i("p", {
39
+ className: "m-0 text-xs text-text-secondary",
40
+ children: c.word.description
41
+ }) : null
42
+ ]
43
+ }), /* @__PURE__ */ a("div", {
44
+ className: "flex flex-col gap-1.5",
45
+ children: [
46
+ /* @__PURE__ */ i(s, {
47
+ htmlFor: `${S}-value`,
48
+ children: g
49
+ }),
50
+ /* @__PURE__ */ i(m, {
51
+ id: `${S}-value`,
52
+ rows: 3,
53
+ value: C,
54
+ lang: _,
55
+ dir: v ? "rtl" : void 0,
56
+ onChange: (e) => w(e.target.value),
57
+ "aria-describedby": D === null ? void 0 : `${S}-limit`,
58
+ "aria-invalid": O || void 0,
59
+ "data-testid": "translate-value"
60
+ }),
61
+ D === null ? null : /* @__PURE__ */ i("p", {
62
+ id: `${S}-limit`,
63
+ className: O ? "m-0 text-xs text-status-error-text" : "m-0 text-xs text-text-secondary",
64
+ children: x("i18n.v3.word.limit", "{{used}} of {{limit}} characters", {
65
+ used: t.format(C.length),
66
+ limit: t.format(D)
67
+ })
68
+ })
69
+ ]
70
+ })]
71
+ }),
72
+ /* @__PURE__ */ a(d, { children: [/* @__PURE__ */ i(o, {
73
+ variant: "ghost",
74
+ onClick: b,
75
+ children: x("i18n.v3.cancel", "Cancel")
76
+ }), /* @__PURE__ */ i(o, {
77
+ busy: T,
78
+ disabled: !k || O || A,
79
+ onClick: () => void j(),
80
+ "data-testid": "translate-save",
81
+ children: x("i18n.v3.word.save", "Save and put live")
82
+ })] })
83
+ ]
84
+ });
85
+ }
86
+ function g({ target: e, sourceName: t, languageName: n, languageCode: r, rtl: a, onSave: o, onClose: s }) {
87
+ return /* @__PURE__ */ i(c, {
88
+ open: e !== null,
89
+ onOpenChange: (e) => e ? void 0 : s(),
90
+ children: e ? /* @__PURE__ */ i(h, {
91
+ target: e,
92
+ sourceName: t,
93
+ languageName: n,
94
+ languageCode: r,
95
+ rtl: a,
96
+ onSave: (t) => o(e, t),
97
+ onClose: s
98
+ }, e.word.id) : null
99
+ });
100
+ }
101
+ export { g as TranslateDialog };
@@ -0,0 +1,11 @@
1
+ import { ProductRow } from '../useLanguagesData';
2
+ export declare function WordsTab({ products, productsLoading, languageCode, languageName, sourceName, rtl, onSaved, }: {
3
+ products: readonly ProductRow[];
4
+ productsLoading: boolean;
5
+ languageCode: string;
6
+ languageName: string;
7
+ sourceName: string;
8
+ rtl: boolean;
9
+ /** A translation was saved: the page's numbers ask again. */
10
+ onSaved: () => void;
11
+ }): import('react').JSX.Element;