@burdenoff/microfe-i18n 2026.1129.2 → 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.
- package/dist/generated/global-operations.d.ts +292 -0
- package/dist/generated/global-operations.js +143 -15
- package/dist/generated/global-types.js +3 -1
- package/dist/i18n/I18nRoutes.d.ts +4 -2
- package/dist/i18n/I18nRoutes.js +48 -47
- package/dist/i18n/v2/LanguageDialog.d.ts +17 -0
- package/dist/i18n/v2/LanguageDialog.js +193 -0
- package/dist/i18n/v2/LanguagesPage.js +81 -53
- package/dist/i18n/v2/ReviewTab.d.ts +3 -1
- package/dist/i18n/v2/ReviewTab.js +28 -27
- package/dist/i18n/v2/TabRedirect.d.ts +8 -0
- package/dist/i18n/v2/TabRedirect.js +26 -9
- package/dist/i18n/v2/language/FormatsTab.d.ts +6 -0
- package/dist/i18n/v2/language/FormatsTab.js +93 -0
- package/dist/i18n/v2/language/LanguagePage.d.ts +3 -0
- package/dist/i18n/v2/language/LanguagePage.js +245 -0
- package/dist/i18n/v2/language/TranslateDialog.d.ts +18 -0
- package/dist/i18n/v2/language/TranslateDialog.js +101 -0
- package/dist/i18n/v2/language/WordsTab.d.ts +11 -0
- package/dist/i18n/v2/language/WordsTab.js +190 -0
- package/dist/i18n/v2/language/useLanguage.d.ts +23 -0
- package/dist/i18n/v2/language/useLanguage.js +22 -0
- package/dist/i18n/v2/language/useWords.d.ts +31 -0
- package/dist/i18n/v2/language/useWords.js +51 -0
- package/dist/i18n/v2/languageModel.d.ts +61 -0
- package/dist/i18n/v2/languageModel.js +120 -0
- package/dist/i18n/v2/links.d.ts +4 -1
- package/dist/i18n/v2/links.js +11 -10
- package/dist/i18n/v2/useAddLanguage.d.ts +10 -0
- package/dist/i18n/v2/useAddLanguage.js +30 -0
- package/dist/i18n/v2/useDebouncedValue.d.ts +1 -0
- package/dist/i18n/v2/useDebouncedValue.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar-days.js +49 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.js +21 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/eye.js +12 -0
- package/package.json +1 -1
package/dist/i18n/I18nRoutes.js
CHANGED
|
@@ -7,97 +7,98 @@ import { ImportExportPage as a } from "./pages/ImportExportPage.js";
|
|
|
7
7
|
import { LocaleConfigPage as o } from "./pages/LocaleConfigPage.js";
|
|
8
8
|
import { joinPath as s } from "./utils/paths.js";
|
|
9
9
|
import { LanguagesPage as c } from "./v2/LanguagesPage.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { LanguagePage as l } from "./v2/language/LanguagePage.js";
|
|
11
|
+
import { AddLanguageRedirect as u, LanguageRedirect as d, TabRedirect as f } from "./v2/TabRedirect.js";
|
|
12
|
+
import { Navigate as p, Route as m, Routes as h } from "react-router";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import { useAccountPagesV2 as v } from "@burdenoff/fe-libs/ui/account-pages-v2";
|
|
14
15
|
// src/i18n/I18nRoutes.tsx
|
|
15
|
-
function
|
|
16
|
-
let t =
|
|
17
|
-
return /* @__PURE__ */
|
|
16
|
+
function y({ basePath: e = "/" }) {
|
|
17
|
+
let t = v();
|
|
18
|
+
return /* @__PURE__ */ g(b, {
|
|
18
19
|
basePath: e,
|
|
19
20
|
v2: t
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
basePath:
|
|
23
|
+
function b({ basePath: v, v2: y }) {
|
|
24
|
+
let b = s(v, "languages"), x = s(v, "products"), S = (e) => /* @__PURE__ */ g(f, {
|
|
25
|
+
basePath: v,
|
|
25
26
|
tab: e
|
|
26
27
|
});
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ _(h, { children: [
|
|
29
|
+
/* @__PURE__ */ g(m, {
|
|
29
30
|
index: !0,
|
|
30
|
-
element: /* @__PURE__ */ p
|
|
31
|
-
to:
|
|
31
|
+
element: /* @__PURE__ */ g(p, {
|
|
32
|
+
to: b,
|
|
32
33
|
replace: !0
|
|
33
34
|
})
|
|
34
35
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ g(m, {
|
|
36
37
|
path: "languages",
|
|
37
|
-
element:
|
|
38
|
+
element: y ? /* @__PURE__ */ g(c, { basePath: v }) : /* @__PURE__ */ g(e, {})
|
|
38
39
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ g(m, {
|
|
40
41
|
path: "languages/new",
|
|
41
|
-
element: /* @__PURE__ */
|
|
42
|
+
element: y ? /* @__PURE__ */ g(u, { basePath: v }) : /* @__PURE__ */ g(o, {})
|
|
42
43
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ g(m, {
|
|
44
45
|
path: "languages/:code",
|
|
45
|
-
element: /* @__PURE__ */
|
|
46
|
+
element: y ? /* @__PURE__ */ g(l, { basePath: v }) : /* @__PURE__ */ g(o, {})
|
|
46
47
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ g(m, {
|
|
48
49
|
path: "products",
|
|
49
|
-
element:
|
|
50
|
+
element: y ? S("products") : /* @__PURE__ */ g(t, {})
|
|
50
51
|
}),
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ g(m, {
|
|
52
53
|
path: "products/*",
|
|
53
|
-
element:
|
|
54
|
-
to:
|
|
54
|
+
element: y ? S("products") : /* @__PURE__ */ g(p, {
|
|
55
|
+
to: x,
|
|
55
56
|
replace: !0
|
|
56
57
|
})
|
|
57
58
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ g(m, {
|
|
59
60
|
path: "editor",
|
|
60
|
-
element: /* @__PURE__ */
|
|
61
|
+
element: /* @__PURE__ */ g(n, {})
|
|
61
62
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ g(m, {
|
|
63
64
|
path: "editor/:keyId",
|
|
64
|
-
element: /* @__PURE__ */
|
|
65
|
+
element: /* @__PURE__ */ g(n, {})
|
|
65
66
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ g(m, {
|
|
67
68
|
path: "editor/:keyId/:languageCode",
|
|
68
|
-
element: /* @__PURE__ */
|
|
69
|
+
element: /* @__PURE__ */ g(n, {})
|
|
69
70
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ g(m, {
|
|
71
72
|
path: "progress",
|
|
72
|
-
element:
|
|
73
|
+
element: y ? S("languages") : /* @__PURE__ */ g(r, {})
|
|
73
74
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ g(m, {
|
|
75
76
|
path: "review",
|
|
76
|
-
element:
|
|
77
|
+
element: y ? S("languages") : /* @__PURE__ */ g(i, {})
|
|
77
78
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ g(m, {
|
|
79
80
|
path: "import",
|
|
80
|
-
element: /* @__PURE__ */
|
|
81
|
+
element: /* @__PURE__ */ g(a, { mode: "import" })
|
|
81
82
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ g(m, {
|
|
83
84
|
path: "export",
|
|
84
|
-
element: /* @__PURE__ */
|
|
85
|
+
element: /* @__PURE__ */ g(a, { mode: "export" })
|
|
85
86
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ g(m, {
|
|
87
88
|
path: "locales",
|
|
88
|
-
element:
|
|
89
|
+
element: y ? S("languages") : /* @__PURE__ */ g(e, {})
|
|
89
90
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ g(m, {
|
|
91
92
|
path: "locales/:code",
|
|
92
|
-
element: /* @__PURE__ */
|
|
93
|
+
element: y ? /* @__PURE__ */ g(d, { basePath: v }) : /* @__PURE__ */ g(o, {})
|
|
93
94
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ g(m, {
|
|
95
96
|
path: "*",
|
|
96
|
-
element: /* @__PURE__ */ p
|
|
97
|
-
to:
|
|
97
|
+
element: /* @__PURE__ */ g(p, {
|
|
98
|
+
to: b,
|
|
98
99
|
replace: !0
|
|
99
100
|
})
|
|
100
101
|
})
|
|
101
102
|
] });
|
|
102
103
|
}
|
|
103
|
-
export {
|
|
104
|
+
export { b as I18nRouteTable, y as I18nRoutes };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LanguageDirection } from '../../generated/global-types';
|
|
2
|
+
/** What the dialog saves: a new language, or new names for one. */
|
|
3
|
+
export interface LanguageFields {
|
|
4
|
+
code: string;
|
|
5
|
+
name: string;
|
|
6
|
+
nativeName: string;
|
|
7
|
+
direction: LanguageDirection;
|
|
8
|
+
}
|
|
9
|
+
type SaveResult = "saved" | "taken" | "failed";
|
|
10
|
+
export declare function LanguageDialog({ open, editing, onSave, onClose, }: {
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** The language whose names change; null to add one. */
|
|
13
|
+
editing: LanguageFields | null;
|
|
14
|
+
onSave: (fields: LanguageFields) => Promise<SaveResult>;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}): import('react').JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { LanguageDirection as t } from "../../generated/global-types.js";
|
|
3
|
+
import { canSaveLanguage as n, codeProblem as r, factsForCode as i } from "./languageModel.js";
|
|
4
|
+
import { useId as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { Button as d, Input as f, Label as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogDescription as g, ResponsiveDialogFooter as _, ResponsiveDialogHeader as v, ResponsiveDialogTitle as y, Segmented as b } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
// src/i18n/v2/LanguageDialog.tsx
|
|
8
|
+
function x({ id: e, label: t, hint: n, children: r }) {
|
|
9
|
+
return /* @__PURE__ */ u("div", {
|
|
10
|
+
className: "flex flex-col gap-1.5",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ l(p, {
|
|
13
|
+
htmlFor: e,
|
|
14
|
+
children: t
|
|
15
|
+
}),
|
|
16
|
+
r,
|
|
17
|
+
n ? /* @__PURE__ */ l("p", {
|
|
18
|
+
id: `${e}-hint`,
|
|
19
|
+
className: "m-0 text-xs text-text-secondary",
|
|
20
|
+
children: n
|
|
21
|
+
}) : null
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function S({ id: t, value: n, problem: r, onChange: i }) {
|
|
26
|
+
let a = e();
|
|
27
|
+
return /* @__PURE__ */ l(x, {
|
|
28
|
+
id: t,
|
|
29
|
+
label: a("i18n.v3.add.code", "Language code"),
|
|
30
|
+
hint: r ?? a("i18n.v3.add.codeHint", "For example es, pt-BR or zh-Hans. It can’t be changed later."),
|
|
31
|
+
children: /* @__PURE__ */ l(f, {
|
|
32
|
+
id: t,
|
|
33
|
+
value: n,
|
|
34
|
+
onChange: (e) => i(e.target.value),
|
|
35
|
+
"aria-describedby": `${t}-hint`,
|
|
36
|
+
"aria-invalid": r ? !0 : void 0,
|
|
37
|
+
autoComplete: "off",
|
|
38
|
+
spellCheck: !1,
|
|
39
|
+
"data-testid": "language-code"
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function C({ id: n, value: r, onChange: i }) {
|
|
44
|
+
let a = e();
|
|
45
|
+
return /* @__PURE__ */ u("div", {
|
|
46
|
+
className: "flex flex-col gap-1.5",
|
|
47
|
+
children: [/* @__PURE__ */ l("span", {
|
|
48
|
+
id: n,
|
|
49
|
+
className: "text-sm font-medium",
|
|
50
|
+
children: a("i18n.v3.lang.reads", "Reads")
|
|
51
|
+
}), /* @__PURE__ */ l(b, {
|
|
52
|
+
"aria-labelledby": n,
|
|
53
|
+
value: r,
|
|
54
|
+
onValueChange: i,
|
|
55
|
+
options: [{
|
|
56
|
+
value: t.Ltr,
|
|
57
|
+
label: a("i18n.v3.lang.ltr", "Left to right")
|
|
58
|
+
}, {
|
|
59
|
+
value: t.Rtl,
|
|
60
|
+
label: a("i18n.v3.lang.rtl", "Right to left")
|
|
61
|
+
}]
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function w({ editing: t }) {
|
|
66
|
+
let n = e();
|
|
67
|
+
return /* @__PURE__ */ u(v, { children: [/* @__PURE__ */ l(y, { children: t ? n("i18n.v3.edit.title", "Change {{name}}’s names", { name: t.name }) : n("i18n.v3.add.title", "Add a language") }), /* @__PURE__ */ l(g, { children: t ? n("i18n.v3.edit.body", "How the language is named here, and to people who speak it.") : n("i18n.v3.add.body", "It is offered as soon as it is added; its words start untranslated.") })] });
|
|
68
|
+
}
|
|
69
|
+
function T({ id: t, name: n, nativeName: r, onName: i, onNativeName: a }) {
|
|
70
|
+
let o = e();
|
|
71
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(x, {
|
|
72
|
+
id: `${t}-name`,
|
|
73
|
+
label: o("i18n.v3.add.name", "Name"),
|
|
74
|
+
children: /* @__PURE__ */ l(f, {
|
|
75
|
+
id: `${t}-name`,
|
|
76
|
+
value: n,
|
|
77
|
+
onChange: (e) => i(e.target.value),
|
|
78
|
+
"data-testid": "language-name"
|
|
79
|
+
})
|
|
80
|
+
}), /* @__PURE__ */ l(x, {
|
|
81
|
+
id: `${t}-native`,
|
|
82
|
+
label: o("i18n.v3.add.nativeName", "Its own name"),
|
|
83
|
+
hint: o("i18n.v3.add.nativeHint", "What people who speak it call it, as the language menu shows it."),
|
|
84
|
+
children: /* @__PURE__ */ l(f, {
|
|
85
|
+
id: `${t}-native`,
|
|
86
|
+
value: r,
|
|
87
|
+
onChange: (e) => a(e.target.value),
|
|
88
|
+
"aria-describedby": `${t}-native-hint`,
|
|
89
|
+
dir: "auto",
|
|
90
|
+
"data-testid": "language-native"
|
|
91
|
+
})
|
|
92
|
+
})] });
|
|
93
|
+
}
|
|
94
|
+
function E({ editing: c, onSave: f, onClose: p }) {
|
|
95
|
+
let m = e(), g = a(), v = c === null, [y, b] = s(c ?? {
|
|
96
|
+
code: "",
|
|
97
|
+
name: "",
|
|
98
|
+
nativeName: "",
|
|
99
|
+
direction: t.Ltr
|
|
100
|
+
}), x = o({
|
|
101
|
+
name: !1,
|
|
102
|
+
nativeName: !1
|
|
103
|
+
}), [E, D] = s(!1), [O, k] = s(!1), A = v ? i(y.code) : null, j = v ? r(y.code, E) : null, M = {
|
|
104
|
+
taken: m("i18n.v3.add.taken", "There’s a language with this code already."),
|
|
105
|
+
badCode: m("i18n.v3.add.badCode", "Use a language code such as es, pt-BR or zh-Hans.")
|
|
106
|
+
}, N = (e) => {
|
|
107
|
+
D(!1);
|
|
108
|
+
let n = i(e);
|
|
109
|
+
b((r) => n ? {
|
|
110
|
+
code: e,
|
|
111
|
+
name: x.current.name ? r.name : n.name,
|
|
112
|
+
nativeName: x.current.nativeName ? r.nativeName : n.nativeName,
|
|
113
|
+
direction: n.rtl ? t.Rtl : t.Ltr
|
|
114
|
+
} : {
|
|
115
|
+
...r,
|
|
116
|
+
code: e
|
|
117
|
+
});
|
|
118
|
+
}, P = (e, t) => {
|
|
119
|
+
x.current[e] = !0, b((n) => ({
|
|
120
|
+
...n,
|
|
121
|
+
[e]: t
|
|
122
|
+
}));
|
|
123
|
+
}, F = async () => {
|
|
124
|
+
k(!0);
|
|
125
|
+
let e = "failed";
|
|
126
|
+
try {
|
|
127
|
+
e = await f({
|
|
128
|
+
code: A?.code ?? y.code.trim(),
|
|
129
|
+
name: y.name.trim(),
|
|
130
|
+
nativeName: y.nativeName.trim(),
|
|
131
|
+
direction: y.direction
|
|
132
|
+
});
|
|
133
|
+
} finally {
|
|
134
|
+
k(!1);
|
|
135
|
+
}
|
|
136
|
+
e === "saved" && p(), D(e === "taken");
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ u(h, {
|
|
139
|
+
"data-testid": "language-dialog",
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ l(w, { editing: c }),
|
|
142
|
+
/* @__PURE__ */ u("div", {
|
|
143
|
+
className: "flex flex-col gap-4",
|
|
144
|
+
children: [
|
|
145
|
+
v ? /* @__PURE__ */ l(S, {
|
|
146
|
+
id: `${g}-code`,
|
|
147
|
+
value: y.code,
|
|
148
|
+
problem: j ? M[j] : null,
|
|
149
|
+
onChange: N
|
|
150
|
+
}) : null,
|
|
151
|
+
/* @__PURE__ */ l(T, {
|
|
152
|
+
id: g,
|
|
153
|
+
name: y.name,
|
|
154
|
+
nativeName: y.nativeName,
|
|
155
|
+
onName: (e) => P("name", e),
|
|
156
|
+
onNativeName: (e) => P("nativeName", e)
|
|
157
|
+
}),
|
|
158
|
+
v ? /* @__PURE__ */ l(C, {
|
|
159
|
+
id: `${g}-reads`,
|
|
160
|
+
value: y.direction,
|
|
161
|
+
onChange: (e) => b((t) => ({
|
|
162
|
+
...t,
|
|
163
|
+
direction: e
|
|
164
|
+
}))
|
|
165
|
+
}) : null
|
|
166
|
+
]
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ u(_, { children: [/* @__PURE__ */ l(d, {
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
onClick: p,
|
|
171
|
+
children: m("i18n.v3.cancel", "Cancel")
|
|
172
|
+
}), /* @__PURE__ */ l(d, {
|
|
173
|
+
busy: O,
|
|
174
|
+
disabled: !n(y, A, v),
|
|
175
|
+
onClick: () => void F(),
|
|
176
|
+
"data-testid": "language-save",
|
|
177
|
+
children: v ? m("i18n.v3.addLanguage", "Add language") : m("i18n.v3.edit.save", "Save names")
|
|
178
|
+
})] })
|
|
179
|
+
]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function D({ open: e, editing: t, onSave: n, onClose: r }) {
|
|
183
|
+
return /* @__PURE__ */ l(m, {
|
|
184
|
+
open: e,
|
|
185
|
+
onOpenChange: (e) => e ? void 0 : r(),
|
|
186
|
+
children: e ? /* @__PURE__ */ l(E, {
|
|
187
|
+
editing: t,
|
|
188
|
+
onSave: n,
|
|
189
|
+
onClose: r
|
|
190
|
+
}) : null
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
export { D as LanguageDialog };
|
|
@@ -2,82 +2,110 @@ import e from "../../node_modules/lucide-react/dist/esm/icons/download.js";
|
|
|
2
2
|
import t from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
3
3
|
import n from "../../node_modules/lucide-react/dist/esm/icons/upload.js";
|
|
4
4
|
import { useTr as r } from "../hooks/useTr.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
5
|
+
import { LanguageDialog as i } from "./LanguageDialog.js";
|
|
6
|
+
import { ADD_LANGUAGE_DIALOG as a, languagesLinks as o } from "./links.js";
|
|
7
|
+
import { LanguagesTab as s } from "./LanguagesTab.js";
|
|
8
|
+
import { languageProgress as c, readLanguagesTab as l, shownTabs as u, sortLanguages as d } from "./model.js";
|
|
9
|
+
import { ProductsTab as f } from "./ProductsTab.js";
|
|
10
|
+
import { ReviewTab as p } from "./ReviewTab.js";
|
|
11
|
+
import { useAddLanguage as m } from "./useAddLanguage.js";
|
|
12
|
+
import { useLanguagesData as h } from "./useLanguagesData.js";
|
|
13
|
+
import { useWaitingCount as g } from "./useReviewQueue.js";
|
|
14
|
+
import { useMemo as _, useRef as v } from "react";
|
|
15
|
+
import { useNavigate as y, useSearchParams as b } from "react-router";
|
|
16
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
17
|
+
import { Button as C, PageTabs as w, useNotify as T } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
import { PageHeader as E } from "@burdenoff/fe-libs/chrome";
|
|
17
19
|
// src/i18n/v2/LanguagesPage.tsx
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
function D({ basePath: D }) {
|
|
21
|
+
let O = r(), k = y(), A = T(), [j, M] = b(), N = l(j.get("tab")), P = o(D), F = h(), I = m(), L = j.get("dialog") === a, R = v(null), z = () => {
|
|
22
|
+
let e = R.current;
|
|
23
|
+
if (R.current = null, e) {
|
|
24
|
+
k(P.language(e), { replace: !0 });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let t = new URLSearchParams(j);
|
|
28
|
+
t.delete("dialog"), M(t, { replace: !0 });
|
|
29
|
+
}, B = g(!1), V = _(() => c(F.coverage.byProduct), [F.coverage.byProduct]), H = _(() => d(F.languages), [F.languages]), U = {
|
|
30
|
+
...F,
|
|
31
|
+
languages: H
|
|
32
|
+
}, W = H.find((e) => e.isDefault)?.name ?? O("i18n.v3.sourceText", "Source text"), G = {
|
|
33
|
+
languages: O("i18n.v3.tab.languages", "Languages"),
|
|
34
|
+
products: O("i18n.v3.tab.products", "Products"),
|
|
35
|
+
review: O("i18n.v3.tab.review", "Review queue")
|
|
36
|
+
}, K = {
|
|
37
|
+
languages: F.languagesLoading ? void 0 : F.languages.length,
|
|
38
|
+
products: F.productsLoading ? void 0 : F.products.length,
|
|
39
|
+
review: B
|
|
30
40
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ S("div", {
|
|
32
42
|
"data-account-pages-v2": "languages",
|
|
33
43
|
className: "flex w-full min-w-0 flex-col",
|
|
34
44
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ x(E, {
|
|
36
46
|
variant: "compact",
|
|
37
|
-
title:
|
|
38
|
-
description:
|
|
39
|
-
primary: /* @__PURE__ */
|
|
40
|
-
onClick: () =>
|
|
47
|
+
title: O("i18n.v3.title", "Languages"),
|
|
48
|
+
description: O("i18n.v3.purpose", "Translations for every product, and what’s waiting for review."),
|
|
49
|
+
primary: /* @__PURE__ */ S(C, {
|
|
50
|
+
onClick: () => {
|
|
51
|
+
let e = new URLSearchParams(j);
|
|
52
|
+
e.set("dialog", a), M(e);
|
|
53
|
+
},
|
|
41
54
|
"data-testid": "languages-add",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
55
|
+
children: [/* @__PURE__ */ x(t, { "aria-hidden": "true" }), O("i18n.v3.addLanguage", "Add language")]
|
|
43
56
|
}),
|
|
44
57
|
more: [{
|
|
45
58
|
id: "import",
|
|
46
|
-
label:
|
|
59
|
+
label: O("i18n.v3.importWords", "Import translations"),
|
|
47
60
|
icon: n,
|
|
48
|
-
onSelect: () =>
|
|
61
|
+
onSelect: () => k(P.importWords)
|
|
49
62
|
}, {
|
|
50
63
|
id: "export",
|
|
51
|
-
label:
|
|
64
|
+
label: O("i18n.v3.exportWords", "Export translations"),
|
|
52
65
|
icon: e,
|
|
53
|
-
onSelect: () =>
|
|
66
|
+
onSelect: () => k(P.exportWords)
|
|
54
67
|
}],
|
|
55
|
-
moreLabel:
|
|
68
|
+
moreLabel: O("i18n.v3.more", "More for languages")
|
|
56
69
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
ariaLabel:
|
|
59
|
-
activeId:
|
|
60
|
-
tabs:
|
|
70
|
+
/* @__PURE__ */ x(w, {
|
|
71
|
+
ariaLabel: O("i18n.v3.title", "Languages"),
|
|
72
|
+
activeId: N,
|
|
73
|
+
tabs: u(!1).map((e) => ({
|
|
61
74
|
id: e,
|
|
62
|
-
label:
|
|
63
|
-
href:
|
|
64
|
-
badge:
|
|
75
|
+
label: G[e],
|
|
76
|
+
href: P.tab(e),
|
|
77
|
+
badge: K[e]
|
|
65
78
|
}))
|
|
66
79
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ x("div", {
|
|
68
81
|
className: "pt-4",
|
|
69
|
-
children:
|
|
70
|
-
languages:
|
|
71
|
-
sourceName:
|
|
72
|
-
onReviewed:
|
|
73
|
-
}) : /* @__PURE__ */
|
|
74
|
-
data:
|
|
75
|
-
progress:
|
|
76
|
-
links:
|
|
82
|
+
children: N === "products" ? /* @__PURE__ */ x(f, { data: U }) : N === "review" ? /* @__PURE__ */ x(p, {
|
|
83
|
+
languages: H,
|
|
84
|
+
sourceName: W,
|
|
85
|
+
onReviewed: F.coverage.reload
|
|
86
|
+
}) : /* @__PURE__ */ x(s, {
|
|
87
|
+
data: U,
|
|
88
|
+
progress: V,
|
|
89
|
+
links: P,
|
|
77
90
|
reviewQueue: !1
|
|
78
91
|
})
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ x(i, {
|
|
94
|
+
open: L,
|
|
95
|
+
editing: null,
|
|
96
|
+
onClose: z,
|
|
97
|
+
onSave: async (e) => {
|
|
98
|
+
let t = await I(e);
|
|
99
|
+
return t.outcome === "saved" ? (A({
|
|
100
|
+
title: O("i18n.v3.add.added", "Added {{name}}", { name: e.name }),
|
|
101
|
+
tone: "success"
|
|
102
|
+
}), R.current = t.code, "saved") : (t.outcome === "failed" && A({
|
|
103
|
+
title: O("i18n.v3.add.failed", "Couldn’t add it. Try again."),
|
|
104
|
+
tone: "error"
|
|
105
|
+
}), t.outcome);
|
|
106
|
+
}
|
|
79
107
|
})
|
|
80
108
|
]
|
|
81
109
|
});
|
|
82
110
|
}
|
|
83
|
-
export {
|
|
111
|
+
export { D as LanguagesPage };
|
|
@@ -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,
|
|
67
|
-
let
|
|
68
|
-
queue:
|
|
69
|
-
actions:
|
|
70
|
-
byCode:
|
|
71
|
-
sourceName:
|
|
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
|
+
byCode: _,
|
|
71
|
+
sourceName: f
|
|
72
72
|
});
|
|
73
|
-
return
|
|
74
|
-
what:
|
|
75
|
-
error:
|
|
76
|
-
onRetry:
|
|
77
|
-
}) : !
|
|
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:
|
|
82
|
-
actions:
|
|
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:
|
|
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:
|
|
95
|
-
}),
|
|
94
|
+
languages: c
|
|
95
|
+
}) : null,
|
|
96
96
|
/* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
97
|
-
|
|
97
|
+
b ? null : /* @__PURE__ */ u(d, {
|
|
98
98
|
variant: "outline",
|
|
99
99
|
size: "sm",
|
|
100
|
-
onClick: () => void
|
|
101
|
-
disabled:
|
|
102
|
-
"aria-busy":
|
|
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" }),
|
|
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
|
-
|
|
108
|
+
w
|
|
109
109
|
]
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
function T({ languages: e, sourceName: t, onReviewed: n }) {
|
|
113
|
-
let [
|
|
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:
|
|
115
|
+
languageCode: a,
|
|
116
|
+
pickLanguage: !r,
|
|
116
117
|
languages: e,
|
|
117
118
|
sourceName: t,
|
|
118
119
|
onReviewed: n
|
|
119
|
-
},
|
|
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;
|