@burdenoff/microfe-i18n 2026.1125.1 → 2026.1129.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.
- package/dist/generated/global-operations.d.ts +299 -0
- package/dist/generated/global-operations.js +135 -0
- package/dist/generated/global-types.d.ts +34021 -0
- package/dist/generated/global-types.js +11 -0
- package/dist/i18n/I18nRoot.js +43 -42
- package/dist/i18n/I18nRoutes.d.ts +20 -1
- package/dist/i18n/I18nRoutes.js +59 -37
- package/dist/i18n/utils/paths.d.ts +6 -0
- package/dist/i18n/utils/paths.js +5 -0
- package/dist/i18n/v2/LanguagesPage.d.ts +3 -0
- package/dist/i18n/v2/LanguagesPage.js +82 -0
- package/dist/i18n/v2/LanguagesTab.d.ts +8 -0
- package/dist/i18n/v2/LanguagesTab.js +102 -0
- package/dist/i18n/v2/ProductsTab.d.ts +4 -0
- package/dist/i18n/v2/ProductsTab.js +60 -0
- package/dist/i18n/v2/ReviewRows.d.ts +9 -0
- package/dist/i18n/v2/ReviewRows.js +71 -0
- package/dist/i18n/v2/ReviewTab.d.ts +6 -0
- package/dist/i18n/v2/ReviewTab.js +121 -0
- package/dist/i18n/v2/ShareBar.d.ts +5 -0
- package/dist/i18n/v2/ShareBar.js +28 -0
- package/dist/i18n/v2/TabRedirect.d.ts +4 -0
- package/dist/i18n/v2/TabRedirect.js +14 -0
- package/dist/i18n/v2/__tests__/routeShapes.d.ts +7 -0
- package/dist/i18n/v2/formats.d.ts +3 -0
- package/dist/i18n/v2/formats.js +6 -0
- package/dist/i18n/v2/links.d.ts +13 -0
- package/dist/i18n/v2/links.js +16 -0
- package/dist/i18n/v2/model.d.ts +76 -0
- package/dist/i18n/v2/model.js +87 -0
- package/dist/i18n/v2/reviewMessages.d.ts +9 -0
- package/dist/i18n/v2/reviewMessages.js +40 -0
- package/dist/i18n/v2/useLanguagesData.d.ts +35 -0
- package/dist/i18n/v2/useLanguagesData.js +62 -0
- package/dist/i18n/v2/useReviewActions.d.ts +9 -0
- package/dist/i18n/v2/useReviewActions.js +56 -0
- package/dist/i18n/v2/useReviewQueue.d.ts +44 -0
- package/dist/i18n/v2/useReviewQueue.js +60 -0
- package/dist/node_modules/@apollo/client/react/context/ApolloContext.js +15 -0
- package/dist/node_modules/@apollo/client/react/hooks/constants.js +3 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js +11 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js +5 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/wrapHook.js +13 -0
- package/dist/node_modules/@apollo/client/react/hooks/useApolloClient.js +9 -0
- package/dist/node_modules/@apollo/client/react/hooks/useMutation.js +96 -0
- package/dist/node_modules/@apollo/client/react/hooks/useQuery.js +125 -0
- package/dist/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js +34 -0
- package/dist/node_modules/@apollo/client/react/internal/index.js +3 -0
- package/dist/node_modules/@apollo/client/utilities/internal/canUseDOM.js +4 -0
- package/dist/node_modules/@apollo/client/utilities/internal/compact.js +11 -0
- package/dist/node_modules/@apollo/client/utilities/internal/constants.js +3 -0
- package/dist/node_modules/@apollo/client/utilities/internal/deepFreeze.js +14 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +5 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/internal/maybeDeepFreeze.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/internal/mergeOptions.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/preventUnhandledRejection.js +5 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +54 -0
- package/dist/node_modules/@apollo/client/version.js +3 -0
- package/dist/node_modules/@wry/equality/lib/index.js +86 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/pencil.js +10 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +18 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Scheduler.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +114 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +94 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +43 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +22 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/Action.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsapAction.js +19 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsapScheduler.js +24 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js +43 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js +27 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/asap.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/immediateProvider.js +14 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/Immediate.js +17 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +10 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +18 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +3 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +11 -0
- package/dist/node_modules/tslib/tslib.es6.js +49 -0
- package/package.json +13 -5
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import e from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
2
|
+
import { useTr as t } from "../hooks/useTr.js";
|
|
3
|
+
import { LanguageDirection as n } from "../../generated/global-types.js";
|
|
4
|
+
import { whereItAppears as r } from "./model.js";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { Button as o, DataRows as s } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
// src/i18n/v2/ReviewRows.tsx
|
|
8
|
+
function c({ row: e }) {
|
|
9
|
+
return e.key.defaultValue ? /* @__PURE__ */ i("span", {
|
|
10
|
+
className: "text-sm text-text-primary",
|
|
11
|
+
children: e.key.defaultValue
|
|
12
|
+
}) : /* @__PURE__ */ i("span", {
|
|
13
|
+
className: "text-sm text-text-secondary",
|
|
14
|
+
children: "—"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function l({ row: e, language: t }) {
|
|
18
|
+
return /* @__PURE__ */ i("span", {
|
|
19
|
+
className: "text-sm text-text-primary",
|
|
20
|
+
lang: e.languageCode,
|
|
21
|
+
dir: t?.direction === n.Rtl ? "rtl" : void 0,
|
|
22
|
+
children: e.value
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function u({ queue: n, actions: u, byCode: d, sourceName: f }) {
|
|
26
|
+
let p = t(), m = (e) => d.get(e)?.name ?? e;
|
|
27
|
+
return /* @__PURE__ */ i(s, {
|
|
28
|
+
items: n.rows,
|
|
29
|
+
getId: (e) => e.id,
|
|
30
|
+
label: p("i18n.v3.tab.review", "Review queue"),
|
|
31
|
+
loading: n.loading,
|
|
32
|
+
skeletonRows: 4,
|
|
33
|
+
lead: {
|
|
34
|
+
header: p("i18n.v3.col.where", "Where"),
|
|
35
|
+
width: "minmax(0,1.2fr)",
|
|
36
|
+
title: (e) => r(e.key),
|
|
37
|
+
subtitle: (e) => e.key.namespace?.displayName ? `${e.key.product.displayName} · ${m(e.languageCode)}` : m(e.languageCode)
|
|
38
|
+
},
|
|
39
|
+
columns: [{
|
|
40
|
+
id: "source",
|
|
41
|
+
header: f,
|
|
42
|
+
width: "minmax(0,1.4fr)",
|
|
43
|
+
cell: (e) => /* @__PURE__ */ i(c, { row: e })
|
|
44
|
+
}, {
|
|
45
|
+
id: "translation",
|
|
46
|
+
header: p("i18n.v3.col.translation", "Translation"),
|
|
47
|
+
width: "minmax(0,1.4fr)",
|
|
48
|
+
cell: (e) => /* @__PURE__ */ i(l, {
|
|
49
|
+
row: e,
|
|
50
|
+
language: d.get(e.languageCode)
|
|
51
|
+
})
|
|
52
|
+
}],
|
|
53
|
+
actions: (t) => /* @__PURE__ */ a(o, {
|
|
54
|
+
size: "sm",
|
|
55
|
+
onClick: () => void u.approveOne(t),
|
|
56
|
+
disabled: u.bulk || u.busy.has(t.id),
|
|
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")]
|
|
60
|
+
}),
|
|
61
|
+
footer: n.hasMore ? /* @__PURE__ */ i(o, {
|
|
62
|
+
variant: "outline",
|
|
63
|
+
size: "sm",
|
|
64
|
+
onClick: n.showMore,
|
|
65
|
+
disabled: n.loadingMore,
|
|
66
|
+
"aria-busy": n.loadingMore || void 0,
|
|
67
|
+
children: p("i18n.v3.showMore", "Show more")
|
|
68
|
+
}) : void 0
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export { u as ReviewRows };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import e from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
2
|
+
import t from "../../node_modules/lucide-react/dist/esm/icons/check-check.js";
|
|
3
|
+
import { useTr as n } from "../hooks/useTr.js";
|
|
4
|
+
import { COUNT as r } from "./formats.js";
|
|
5
|
+
import { LANGUAGE_PARAM as i } from "./model.js";
|
|
6
|
+
import { ReviewRows as a } from "./ReviewRows.js";
|
|
7
|
+
import { useReviewActions as o } from "./useReviewActions.js";
|
|
8
|
+
import { useReviewQueue as s } from "./useReviewQueue.js";
|
|
9
|
+
import { useSearchParams as c } from "react-router";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
+
import { Button as d, EmptyState as f, LoadError as p, Notice as m, Select as h, SelectContent as g, SelectItem as _, SelectTrigger as v, SelectValue as y } from "@burdenoff/fe-libs/ui";
|
|
12
|
+
// src/i18n/v2/ReviewTab.tsx
|
|
13
|
+
var b = "all";
|
|
14
|
+
function x({ languageCode: e, languages: t }) {
|
|
15
|
+
let r = n(), [a, o] = c(), s = (e) => {
|
|
16
|
+
let t = new URLSearchParams(a);
|
|
17
|
+
e === b ? t.delete(i) : t.set(i, e), o(t, { replace: !0 });
|
|
18
|
+
}, d = t.filter((e) => !e.isDefault), f = e && !d.some((t) => t.code === e) ? e : null;
|
|
19
|
+
return /* @__PURE__ */ u(h, {
|
|
20
|
+
value: e ?? b,
|
|
21
|
+
onValueChange: s,
|
|
22
|
+
children: [/* @__PURE__ */ l(v, {
|
|
23
|
+
className: "w-auto min-w-44",
|
|
24
|
+
"aria-label": r("i18n.v3.reviewLanguage", "Language"),
|
|
25
|
+
"data-testid": "review-language",
|
|
26
|
+
children: /* @__PURE__ */ l(y, {})
|
|
27
|
+
}), /* @__PURE__ */ u(g, { children: [
|
|
28
|
+
/* @__PURE__ */ l(_, {
|
|
29
|
+
value: b,
|
|
30
|
+
children: r("i18n.v3.allLanguages", "All languages")
|
|
31
|
+
}),
|
|
32
|
+
d.map((e) => /* @__PURE__ */ l(_, {
|
|
33
|
+
value: e.code,
|
|
34
|
+
children: e.name
|
|
35
|
+
}, e.code)),
|
|
36
|
+
f ? /* @__PURE__ */ l(_, {
|
|
37
|
+
value: f,
|
|
38
|
+
children: f
|
|
39
|
+
}) : null
|
|
40
|
+
] })]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function S({ queue: e, actions: t }) {
|
|
44
|
+
let i = n();
|
|
45
|
+
return e.notLiveTotal === 0 ? null : /* @__PURE__ */ l(m, {
|
|
46
|
+
tone: "info",
|
|
47
|
+
action: /* @__PURE__ */ l(d, {
|
|
48
|
+
size: "sm",
|
|
49
|
+
variant: "outline",
|
|
50
|
+
onClick: () => void t.putLive(),
|
|
51
|
+
disabled: t.bulk,
|
|
52
|
+
children: i("i18n.v3.putLive", "Put them live")
|
|
53
|
+
}),
|
|
54
|
+
children: e.notLiveTotal === 1 ? i("i18n.v3.oneNotLive", "One approved translation isn’t live yet.") : i("i18n.v3.someNotLive", "{{count}} approved translations aren’t live yet.", { count: r.format(e.notLiveTotal) })
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function C({ languageName: t }) {
|
|
58
|
+
let r = n();
|
|
59
|
+
return /* @__PURE__ */ l(f, {
|
|
60
|
+
kind: "all-done",
|
|
61
|
+
icon: /* @__PURE__ */ l(e, { "aria-hidden": "true" }),
|
|
62
|
+
title: r("i18n.v3.nothingToReview", "Nothing to review"),
|
|
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
|
+
});
|
|
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,
|
|
70
|
+
byCode: _,
|
|
71
|
+
sourceName: c
|
|
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", {
|
|
78
|
+
className: "flex flex-col gap-3",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ l(S, {
|
|
81
|
+
queue: h,
|
|
82
|
+
actions: g
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ u("div", {
|
|
85
|
+
className: "flex flex-wrap items-center gap-2",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ l("b", {
|
|
88
|
+
className: "text-sm font-semibold text-text-primary",
|
|
89
|
+
"data-testid": "review-waiting",
|
|
90
|
+
children: m("i18n.v3.waitingCount", "{{count}} waiting", { count: r.format(h.total) })
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ l(x, {
|
|
93
|
+
languageCode: e,
|
|
94
|
+
languages: i
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
97
|
+
v ? null : /* @__PURE__ */ u(d, {
|
|
98
|
+
variant: "outline",
|
|
99
|
+
size: "sm",
|
|
100
|
+
onClick: () => void g.approveShown(),
|
|
101
|
+
disabled: g.bulk,
|
|
102
|
+
"aria-busy": g.bulk || void 0,
|
|
103
|
+
"data-testid": "review-approve-all",
|
|
104
|
+
children: [/* @__PURE__ */ l(t, { "aria-hidden": "true" }), m("i18n.v3.approveAll", "Approve all shown")]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
y
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function T({ languages: e, sourceName: t, onReviewed: n }) {
|
|
113
|
+
let [r] = c(), i = r.get("language") || null;
|
|
114
|
+
return /* @__PURE__ */ l(w, {
|
|
115
|
+
languageCode: i,
|
|
116
|
+
languages: e,
|
|
117
|
+
sourceName: t,
|
|
118
|
+
onReviewed: n
|
|
119
|
+
}, i ?? b);
|
|
120
|
+
}
|
|
121
|
+
export { T as ReviewTab };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SHARE as e } from "./formats.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { Skeleton as r } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
// src/i18n/v2/ShareBar.tsx
|
|
5
|
+
function i({ share: i, loading: a }) {
|
|
6
|
+
if (a) return /* @__PURE__ */ t(r, { className: "h-4 w-36 rounded" });
|
|
7
|
+
if (i === null) return /* @__PURE__ */ t("span", {
|
|
8
|
+
className: "text-sm text-text-secondary",
|
|
9
|
+
children: "—"
|
|
10
|
+
});
|
|
11
|
+
let o = Math.floor(i * 100);
|
|
12
|
+
return /* @__PURE__ */ n("span", {
|
|
13
|
+
className: "inline-flex items-center gap-2",
|
|
14
|
+
"data-share-bar": "",
|
|
15
|
+
children: [/* @__PURE__ */ t("span", {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: "h-1.5 w-28 shrink-0 overflow-hidden rounded-full bg-bg-sunken",
|
|
18
|
+
children: /* @__PURE__ */ t("span", {
|
|
19
|
+
className: "block h-full rounded-full bg-action-primary-bg",
|
|
20
|
+
style: { width: `${o}%` }
|
|
21
|
+
})
|
|
22
|
+
}), /* @__PURE__ */ t("span", {
|
|
23
|
+
className: "text-sm tabular-nums text-text-primary",
|
|
24
|
+
children: e.format(o / 100)
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { i as ShareBar };
|
|
@@ -0,0 +1,14 @@
|
|
|
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";
|
|
4
|
+
// 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,
|
|
11
|
+
replace: !0
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { i as TabRedirect };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LanguagesTab } from './model';
|
|
2
|
+
export declare function languagesLinks(basePath: string): {
|
|
3
|
+
page: string;
|
|
4
|
+
tab: (tab: LanguagesTab) => string;
|
|
5
|
+
/** The review queue, showing one language. */
|
|
6
|
+
review: (languageCode: string) => string;
|
|
7
|
+
/** One language: today's language settings until C5b. */
|
|
8
|
+
language: (code: string) => string;
|
|
9
|
+
addLanguage: string;
|
|
10
|
+
importWords: string;
|
|
11
|
+
exportWords: string;
|
|
12
|
+
};
|
|
13
|
+
export type LanguagesLinks = ReturnType<typeof languagesLinks>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { joinPath as e } from "../utils/paths.js";
|
|
2
|
+
import { LANGUAGE_PARAM as t } from "./model.js";
|
|
3
|
+
// src/i18n/v2/links.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e(n, "languages");
|
|
6
|
+
return {
|
|
7
|
+
page: r,
|
|
8
|
+
tab: (e) => e === "languages" ? r : `${r}?tab=${e}`,
|
|
9
|
+
review: (e) => `${r}?tab=review&${t}=${encodeURIComponent(e)}`,
|
|
10
|
+
language: (t) => e(n, `languages/${encodeURIComponent(t)}`),
|
|
11
|
+
addLanguage: e(n, "languages/new"),
|
|
12
|
+
importWords: e(n, "import"),
|
|
13
|
+
exportWords: e(n, "export")
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { n as languagesLinks };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Languages page's numbers (BOFF-16785, C5; the mockup's `languages`): how
|
|
3
|
+
* much of each language is translated across every product, how much of each
|
|
4
|
+
* product is translated, and what waits for review. Pure, so it is tested
|
|
5
|
+
* without a page.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LANGUAGES_TABS: readonly ["languages", "products", "review"];
|
|
8
|
+
export type LanguagesTab = (typeof LANGUAGES_TABS)[number];
|
|
9
|
+
/** `?tab=`; anything else is the Languages tab. */
|
|
10
|
+
export declare function readLanguagesTab(value: string | null): LanguagesTab;
|
|
11
|
+
/** The review queue's language filter (`?language=`). */
|
|
12
|
+
export declare const LANGUAGE_PARAM = "language";
|
|
13
|
+
/** One language's line of `translationCoverage` for one product. */
|
|
14
|
+
export interface CoverageLine {
|
|
15
|
+
languageCode: string;
|
|
16
|
+
totalKeys: number;
|
|
17
|
+
translatedKeys: number;
|
|
18
|
+
missingCount: number;
|
|
19
|
+
pendingReviewKeys: number;
|
|
20
|
+
}
|
|
21
|
+
/** How far along something is: what's translated out of how much. */
|
|
22
|
+
export interface Progress {
|
|
23
|
+
translated: number;
|
|
24
|
+
total: number;
|
|
25
|
+
/** What waits for review. */
|
|
26
|
+
waiting: number;
|
|
27
|
+
/** What nobody has translated yet. */
|
|
28
|
+
missing: number;
|
|
29
|
+
/** `translated / total`, 0 to 1; null when there is nothing to translate. */
|
|
30
|
+
share: number | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Each language across every product: the products' lines for that language
|
|
34
|
+
* added up. A language with no line (not active, so not counted) is missing
|
|
35
|
+
* from the map.
|
|
36
|
+
*/
|
|
37
|
+
export declare function languageProgress(byProduct: ReadonlyMap<string, readonly CoverageLine[]>): Map<string, Progress>;
|
|
38
|
+
/** One product: how much text it has, and how much of it is translated. */
|
|
39
|
+
export interface ProductProgress extends Progress {
|
|
40
|
+
/** The product's texts (each is translated once per language). */
|
|
41
|
+
texts: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One product across the languages it is translated into. The source language
|
|
45
|
+
* (`sourceCode`) is left out: it is where the words come from, so counting it
|
|
46
|
+
* would make every product look further along. With only the source language,
|
|
47
|
+
* that one counts.
|
|
48
|
+
*/
|
|
49
|
+
export declare function productProgress(lines: readonly CoverageLine[], sourceCode: string | null): ProductProgress;
|
|
50
|
+
/** A translation's text: where it appears, and the product. */
|
|
51
|
+
export interface TranslationPlace {
|
|
52
|
+
product: {
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
namespace: {
|
|
56
|
+
displayName: string;
|
|
57
|
+
} | null;
|
|
58
|
+
}
|
|
59
|
+
/** Where a text appears, in words: its section, or the product when it has none. */
|
|
60
|
+
export declare function whereItAppears(key: TranslationPlace): string;
|
|
61
|
+
/** The languages, the source language first, then by name. */
|
|
62
|
+
export declare function sortLanguages<T extends {
|
|
63
|
+
isDefault: boolean;
|
|
64
|
+
name: string;
|
|
65
|
+
}>(languages: readonly T[]): T[];
|
|
66
|
+
/**
|
|
67
|
+
* `run` for every item, at most `limit` at a time, keeping the order. A failed
|
|
68
|
+
* item is reported in `failed` and doesn't stop the others.
|
|
69
|
+
*/
|
|
70
|
+
export declare function eachLimited<T, R>(items: readonly T[], limit: number, run: (item: T) => Promise<R>): Promise<{
|
|
71
|
+
done: Array<{
|
|
72
|
+
item: T;
|
|
73
|
+
result: R;
|
|
74
|
+
}>;
|
|
75
|
+
failed: T[];
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/i18n/v2/model.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"languages",
|
|
4
|
+
"products",
|
|
5
|
+
"review"
|
|
6
|
+
];
|
|
7
|
+
function t(t) {
|
|
8
|
+
return e.find((e) => e === t) ?? "languages";
|
|
9
|
+
}
|
|
10
|
+
var n = "language", r = {
|
|
11
|
+
translated: 0,
|
|
12
|
+
total: 0,
|
|
13
|
+
waiting: 0,
|
|
14
|
+
missing: 0,
|
|
15
|
+
share: null
|
|
16
|
+
};
|
|
17
|
+
function i(e) {
|
|
18
|
+
return {
|
|
19
|
+
...e,
|
|
20
|
+
share: e.total > 0 ? e.translated / e.total : null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function a(e) {
|
|
24
|
+
let t = /* @__PURE__ */ new Map();
|
|
25
|
+
for (let n of e.values()) for (let e of n) {
|
|
26
|
+
let n = t.get(e.languageCode) ?? { ...r };
|
|
27
|
+
t.set(e.languageCode, {
|
|
28
|
+
translated: n.translated + e.translatedKeys,
|
|
29
|
+
total: n.total + e.totalKeys,
|
|
30
|
+
waiting: n.waiting + e.pendingReviewKeys,
|
|
31
|
+
missing: n.missing + e.missingCount
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
let n = /* @__PURE__ */ new Map();
|
|
35
|
+
for (let [e, r] of t) n.set(e, i(r));
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
function o(e, t) {
|
|
39
|
+
let n = e.reduce((e, t) => Math.max(e, t.totalKeys), 0), a = e.filter((e) => e.languageCode !== t);
|
|
40
|
+
return {
|
|
41
|
+
...i((a.length > 0 ? a : e).reduce((e, t) => ({
|
|
42
|
+
translated: e.translated + t.translatedKeys,
|
|
43
|
+
total: e.total + t.totalKeys,
|
|
44
|
+
waiting: e.waiting + t.pendingReviewKeys,
|
|
45
|
+
missing: e.missing + t.missingCount
|
|
46
|
+
}), { ...r })),
|
|
47
|
+
texts: n
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function s(e) {
|
|
51
|
+
return e.namespace?.displayName || e.product.displayName;
|
|
52
|
+
}
|
|
53
|
+
function c(e) {
|
|
54
|
+
return [...e].sort((e, t) => e.isDefault === t.isDefault ? e.name.localeCompare(t.name) : e.isDefault ? -1 : 1);
|
|
55
|
+
}
|
|
56
|
+
async function l(e, t, n) {
|
|
57
|
+
let r = Array(e.length), i = 0;
|
|
58
|
+
await Promise.all(Array.from({ length: Math.max(1, Math.min(t, e.length)) }, async () => {
|
|
59
|
+
for (; i < e.length;) {
|
|
60
|
+
let t = i;
|
|
61
|
+
i += 1;
|
|
62
|
+
let a = e[t];
|
|
63
|
+
try {
|
|
64
|
+
r[t] = {
|
|
65
|
+
ok: !0,
|
|
66
|
+
item: a,
|
|
67
|
+
result: await n(a)
|
|
68
|
+
};
|
|
69
|
+
} catch {
|
|
70
|
+
r[t] = {
|
|
71
|
+
ok: !1,
|
|
72
|
+
item: a
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
let a = [], o = [];
|
|
78
|
+
for (let e of r) e && (e.ok ? a.push({
|
|
79
|
+
item: e.item,
|
|
80
|
+
result: e.result
|
|
81
|
+
}) : o.push(e.item));
|
|
82
|
+
return {
|
|
83
|
+
done: a,
|
|
84
|
+
failed: o
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export { e as LANGUAGES_TABS, n as LANGUAGE_PARAM, l as eachLimited, a as languageProgress, o as productProgress, t as readLanguagesTab, c as sortLanguages, s as whereItAppears };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NotifyOptions } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
import { ApproveOutcome } from './useReviewQueue';
|
|
3
|
+
export type Tr = (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
4
|
+
/** After one Approve. */
|
|
5
|
+
export declare function approvedMessage(tr: Tr, outcome: ApproveOutcome): NotifyOptions;
|
|
6
|
+
/** After Approve all shown: how many were approved, and what went wrong. */
|
|
7
|
+
export declare function approvedManyMessage(tr: Tr, outcomes: readonly ApproveOutcome[], failed: number): NotifyOptions;
|
|
8
|
+
/** After Put them live. */
|
|
9
|
+
export declare function liveMessage(tr: Tr, done: number, failed: number): NotifyOptions;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { COUNT as e } from "./formats.js";
|
|
2
|
+
// src/i18n/v2/reviewMessages.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return t === "live" ? {
|
|
5
|
+
title: e("i18n.v3.approved", "Approved. It’s live now."),
|
|
6
|
+
tone: "success"
|
|
7
|
+
} : {
|
|
8
|
+
title: e("i18n.v3.approvedNotLive", "Approved, but it isn’t live yet."),
|
|
9
|
+
description: e("i18n.v3.approvedNotLiveBody", "Put it live from the note above the queue."),
|
|
10
|
+
tone: "warning"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function n(t, n, r) {
|
|
14
|
+
let i = n.filter((e) => e !== "live").length;
|
|
15
|
+
return r === 0 && i === 0 ? {
|
|
16
|
+
title: t("i18n.v3.approvedCount", "Approved {{count}}. They’re live now.", { count: e.format(n.length) }),
|
|
17
|
+
tone: "success"
|
|
18
|
+
} : {
|
|
19
|
+
title: t("i18n.v3.approvedSome", "Approved {{done}} of {{count}}.", {
|
|
20
|
+
done: e.format(n.length),
|
|
21
|
+
count: e.format(n.length + r)
|
|
22
|
+
}),
|
|
23
|
+
description: r > 0 ? t("i18n.v3.approvedSomeFailed", "The rest couldn’t be approved. Try again.") : t("i18n.v3.approvedSomeNotLive", "Some aren’t live yet: put them live from the note above the queue."),
|
|
24
|
+
tone: "warning"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function r(t, n, r) {
|
|
28
|
+
return r === 0 ? {
|
|
29
|
+
title: t("i18n.v3.liveCount", "{{count}} translations are live now.", { count: e.format(n) }),
|
|
30
|
+
tone: "success"
|
|
31
|
+
} : {
|
|
32
|
+
title: t("i18n.v3.liveSome", "Put {{done}} of {{count}} live.", {
|
|
33
|
+
done: e.format(n),
|
|
34
|
+
count: e.format(n + r)
|
|
35
|
+
}),
|
|
36
|
+
description: t("i18n.v3.liveSomeFailed", "The rest couldn’t be put live. Try again."),
|
|
37
|
+
tone: "warning"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { n as approvedManyMessage, t as approvedMessage, r as liveMessage };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LanguageDirection, LanguageStatus } from '../../generated/global-types';
|
|
2
|
+
import { CoverageLine } from './model';
|
|
3
|
+
export interface LanguageRow {
|
|
4
|
+
id: string;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
nativeName: string;
|
|
8
|
+
direction: LanguageDirection;
|
|
9
|
+
status: LanguageStatus;
|
|
10
|
+
isDefault: boolean;
|
|
11
|
+
region: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ProductRow {
|
|
14
|
+
id: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
description: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function useLanguagesData(): {
|
|
19
|
+
languages: LanguageRow[];
|
|
20
|
+
products: ProductRow[];
|
|
21
|
+
sourceCode: string | null;
|
|
22
|
+
coverage: {
|
|
23
|
+
byProduct: Map<string, CoverageLine[]>;
|
|
24
|
+
failed: string[];
|
|
25
|
+
/** The first load only. */
|
|
26
|
+
loading: boolean;
|
|
27
|
+
reload: () => void;
|
|
28
|
+
};
|
|
29
|
+
languagesLoading: boolean;
|
|
30
|
+
productsLoading: boolean;
|
|
31
|
+
languagesError: import('@apollo/client').ErrorLike | undefined;
|
|
32
|
+
productsError: import('@apollo/client').ErrorLike | undefined;
|
|
33
|
+
retry: () => void;
|
|
34
|
+
};
|
|
35
|
+
export type LanguagesData = ReturnType<typeof useLanguagesData>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useApolloClient as e } from "../../node_modules/@apollo/client/react/hooks/useApolloClient.js";
|
|
2
|
+
import { GetI18nCoverageDocument as t, useGetI18nLanguagesQuery as n, useGetI18nProductsQuery as r } from "../../generated/global-operations.js";
|
|
3
|
+
import { I18nProductStatus as i } from "../../generated/global-types.js";
|
|
4
|
+
import { eachLimited as a } from "./model.js";
|
|
5
|
+
import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
6
|
+
// src/i18n/v2/useLanguagesData.ts
|
|
7
|
+
var u = 4, d = {
|
|
8
|
+
for: "",
|
|
9
|
+
byProduct: /* @__PURE__ */ new Map(),
|
|
10
|
+
failed: []
|
|
11
|
+
};
|
|
12
|
+
function f(n) {
|
|
13
|
+
let r = e(), i = n.join(","), [c, f] = l(0), [p, m] = l(d);
|
|
14
|
+
s(() => {
|
|
15
|
+
if (!i) return;
|
|
16
|
+
let e = !0;
|
|
17
|
+
return a(i.split(","), u, async (e) => (await r.query({
|
|
18
|
+
query: t,
|
|
19
|
+
variables: { productId: e },
|
|
20
|
+
fetchPolicy: c > 0 ? "network-only" : "cache-first"
|
|
21
|
+
})).data?.translationCoverage ?? []).then(({ done: t, failed: n }) => {
|
|
22
|
+
e && m({
|
|
23
|
+
for: `${i}#${c}`,
|
|
24
|
+
byProduct: new Map(t.map(({ item: e, result: t }) => [e, t])),
|
|
25
|
+
failed: n
|
|
26
|
+
});
|
|
27
|
+
}), () => {
|
|
28
|
+
e = !1;
|
|
29
|
+
};
|
|
30
|
+
}, [
|
|
31
|
+
r,
|
|
32
|
+
i,
|
|
33
|
+
c
|
|
34
|
+
]);
|
|
35
|
+
let h = o(() => f((e) => e + 1), []);
|
|
36
|
+
return {
|
|
37
|
+
byProduct: p.byProduct,
|
|
38
|
+
failed: p.failed,
|
|
39
|
+
loading: !!i && p.for === "",
|
|
40
|
+
reload: h
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function p() {
|
|
44
|
+
let e = n({ variables: { limit: 100 } }), t = r({ variables: {
|
|
45
|
+
filter: { status: i.Active },
|
|
46
|
+
limit: 100
|
|
47
|
+
} }), a = c(() => e.data?.languages.items ?? [], [e.data]), s = c(() => t.data?.i18nProducts.items ?? [], [t.data]), l = f(c(() => s.map((e) => e.id), [s])), u = a.find((e) => e.isDefault)?.code ?? null, { refetch: d } = e, { refetch: p } = t, m = o(() => {
|
|
48
|
+
d(), p();
|
|
49
|
+
}, [d, p]);
|
|
50
|
+
return {
|
|
51
|
+
languages: a,
|
|
52
|
+
products: s,
|
|
53
|
+
sourceCode: u,
|
|
54
|
+
coverage: l,
|
|
55
|
+
languagesLoading: e.loading && a.length === 0,
|
|
56
|
+
productsLoading: t.loading && s.length === 0,
|
|
57
|
+
languagesError: e.error,
|
|
58
|
+
productsError: t.error,
|
|
59
|
+
retry: m
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export { p as useLanguagesData };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReviewQueue, ReviewRow } from './useReviewQueue';
|
|
2
|
+
export declare function useReviewActions(queue: ReviewQueue, onReviewed: () => void): {
|
|
3
|
+
busy: ReadonlySet<string>;
|
|
4
|
+
bulk: boolean;
|
|
5
|
+
approveOne: (row: ReviewRow) => Promise<void>;
|
|
6
|
+
approveShown: () => Promise<void>;
|
|
7
|
+
putLive: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export type ReviewActions = ReturnType<typeof useReviewActions>;
|