@burdenoff/microfe-i18n 2026.1129.3 → 2026.1129.5
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 +45 -0
- package/dist/generated/global-operations.js +45 -33
- package/dist/generated/global-types.js +6 -4
- package/dist/i18n/I18nRoutes.d.ts +4 -3
- package/dist/i18n/I18nRoutes.js +54 -47
- package/dist/i18n/v2/ExportDialog.d.ts +9 -0
- package/dist/i18n/v2/ExportDialog.js +107 -0
- package/dist/i18n/v2/LanguagesDialogs.d.ts +7 -0
- package/dist/i18n/v2/LanguagesDialogs.js +43 -0
- package/dist/i18n/v2/LanguagesPage.js +58 -80
- package/dist/i18n/v2/LanguagesTab.js +1 -1
- package/dist/i18n/v2/TabRedirect.d.ts +6 -2
- package/dist/i18n/v2/TabRedirect.js +16 -17
- package/dist/i18n/v2/language/LanguagePage.js +84 -73
- package/dist/i18n/v2/languageModel.d.ts +5 -0
- package/dist/i18n/v2/languageModel.js +5 -1
- package/dist/i18n/v2/links.d.ts +6 -1
- package/dist/i18n/v2/links.js +11 -11
- package/dist/i18n/v2/model.d.ts +7 -0
- package/dist/i18n/v2/useExportTranslations.d.ts +8 -0
- package/dist/i18n/v2/useExportTranslations.js +26 -0
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ export type I18nProductFilterInput = {
|
|
|
34
34
|
status?: I18nProductStatus | null | undefined;
|
|
35
35
|
};
|
|
36
36
|
export type I18nProductStatus = 'ACTIVE' | 'ARCHIVED' | 'DEPRECATED';
|
|
37
|
+
export type ImportJobFormat = 'CSV' | 'JSON' | 'PO' | 'XLIFF' | 'XLSX';
|
|
37
38
|
export type LanguageDirection = 'LTR' | 'RTL';
|
|
38
39
|
export type LanguageFilterInput = {
|
|
39
40
|
direction?: LanguageDirection | null | undefined;
|
|
@@ -89,6 +90,18 @@ export type GetI18nCoverageQuery = {
|
|
|
89
90
|
pendingReviewKeys: number;
|
|
90
91
|
}>;
|
|
91
92
|
};
|
|
93
|
+
export type ExportI18nTranslationsQueryVariables = Exact<{
|
|
94
|
+
format: Types.ImportJobFormat;
|
|
95
|
+
productId: string;
|
|
96
|
+
languageCode?: string | null | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
export type ExportI18nTranslationsQuery = {
|
|
99
|
+
exportTranslations: {
|
|
100
|
+
content: string;
|
|
101
|
+
format: string;
|
|
102
|
+
version: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
92
105
|
export type GetI18nLanguageQueryVariables = Exact<{
|
|
93
106
|
code: string;
|
|
94
107
|
}>;
|
|
@@ -310,6 +323,38 @@ export type GetI18nCoverageQueryHookResult = ReturnType<typeof useGetI18nCoverag
|
|
|
310
323
|
export type GetI18nCoverageLazyQueryHookResult = ReturnType<typeof useGetI18nCoverageLazyQuery>;
|
|
311
324
|
export type GetI18nCoverageSuspenseQueryHookResult = ReturnType<typeof useGetI18nCoverageSuspenseQuery>;
|
|
312
325
|
export type GetI18nCoverageQueryResult = Apollo.QueryResult<Types.GetI18nCoverageQuery, Types.GetI18nCoverageQueryVariables>;
|
|
326
|
+
export declare const ExportI18nTranslationsDocument: Apollo.DocumentNode;
|
|
327
|
+
/**
|
|
328
|
+
* __useExportI18nTranslationsQuery__
|
|
329
|
+
*
|
|
330
|
+
* To run a query within a React component, call `useExportI18nTranslationsQuery` and pass it any options that fit your needs.
|
|
331
|
+
* When your component renders, `useExportI18nTranslationsQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
332
|
+
* you can use to render your UI.
|
|
333
|
+
*
|
|
334
|
+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* const { data, loading, error } = useExportI18nTranslationsQuery({
|
|
338
|
+
* variables: {
|
|
339
|
+
* format: // value for 'format'
|
|
340
|
+
* productId: // value for 'productId'
|
|
341
|
+
* languageCode: // value for 'languageCode'
|
|
342
|
+
* },
|
|
343
|
+
* });
|
|
344
|
+
*/
|
|
345
|
+
export declare function useExportI18nTranslationsQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables> & ({
|
|
346
|
+
variables: Types.ExportI18nTranslationsQueryVariables;
|
|
347
|
+
skip?: boolean;
|
|
348
|
+
} | {
|
|
349
|
+
skip: boolean;
|
|
350
|
+
})): ApolloReactHooks.useQuery.Result<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables, "empty" | "complete" | "streaming", Types.ExportI18nTranslationsQueryVariables, undefined>;
|
|
351
|
+
export declare function useExportI18nTranslationsLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables, "empty" | "complete" | "streaming", undefined>;
|
|
352
|
+
export declare function useExportI18nTranslationsSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables>;
|
|
353
|
+
export declare function useExportI18nTranslationsSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ExportI18nTranslationsQuery | undefined, Types.ExportI18nTranslationsQueryVariables>;
|
|
354
|
+
export type ExportI18nTranslationsQueryHookResult = ReturnType<typeof useExportI18nTranslationsQuery>;
|
|
355
|
+
export type ExportI18nTranslationsLazyQueryHookResult = ReturnType<typeof useExportI18nTranslationsLazyQuery>;
|
|
356
|
+
export type ExportI18nTranslationsSuspenseQueryHookResult = ReturnType<typeof useExportI18nTranslationsSuspenseQuery>;
|
|
357
|
+
export type ExportI18nTranslationsQueryResult = Apollo.QueryResult<Types.ExportI18nTranslationsQuery, Types.ExportI18nTranslationsQueryVariables>;
|
|
313
358
|
export declare const GetI18nLanguageDocument: Apollo.DocumentNode;
|
|
314
359
|
/**
|
|
315
360
|
* __useGetI18nLanguageQuery__
|
|
@@ -14,6 +14,18 @@ var r = {}, i = n`
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
`, a = n`
|
|
17
|
+
query ExportI18nTranslations($format: ImportJobFormat!, $productId: String!, $languageCode: String) {
|
|
18
|
+
exportTranslations(
|
|
19
|
+
format: $format
|
|
20
|
+
productId: $productId
|
|
21
|
+
languageCode: $languageCode
|
|
22
|
+
) {
|
|
23
|
+
content
|
|
24
|
+
format
|
|
25
|
+
version
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`, o = n`
|
|
17
29
|
query GetI18nLanguage($code: String!) {
|
|
18
30
|
languageByCode(code: $code) {
|
|
19
31
|
id
|
|
@@ -30,14 +42,14 @@ var r = {}, i = n`
|
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
`;
|
|
33
|
-
function
|
|
45
|
+
function s(e) {
|
|
34
46
|
let n = {
|
|
35
47
|
...r,
|
|
36
48
|
...e
|
|
37
49
|
};
|
|
38
|
-
return t(
|
|
50
|
+
return t(o, n);
|
|
39
51
|
}
|
|
40
|
-
var
|
|
52
|
+
var c = n`
|
|
41
53
|
mutation CreateI18nLanguage($input: CreateLanguageInput!) {
|
|
42
54
|
createLanguage(input: $input) {
|
|
43
55
|
id
|
|
@@ -49,14 +61,14 @@ var s = n`
|
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
`;
|
|
52
|
-
function
|
|
64
|
+
function l(t) {
|
|
53
65
|
let n = {
|
|
54
66
|
...r,
|
|
55
67
|
...t
|
|
56
68
|
};
|
|
57
|
-
return e(
|
|
69
|
+
return e(c, n);
|
|
58
70
|
}
|
|
59
|
-
var
|
|
71
|
+
var u = n`
|
|
60
72
|
mutation UpdateI18nLanguage($id: ID!, $input: UpdateLanguageInput!) {
|
|
61
73
|
updateLanguage(id: $id, input: $input) {
|
|
62
74
|
id
|
|
@@ -71,14 +83,14 @@ var l = n`
|
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
`;
|
|
74
|
-
function
|
|
86
|
+
function d(t) {
|
|
75
87
|
let n = {
|
|
76
88
|
...r,
|
|
77
89
|
...t
|
|
78
90
|
};
|
|
79
|
-
return e(
|
|
91
|
+
return e(u, n);
|
|
80
92
|
}
|
|
81
|
-
var
|
|
93
|
+
var f = n`
|
|
82
94
|
query GetI18nLanguages($filter: LanguageFilterInput, $limit: Int = 100, $offset: Int = 0) {
|
|
83
95
|
languages(filter: $filter, limit: $limit, offset: $offset) {
|
|
84
96
|
items {
|
|
@@ -100,14 +112,14 @@ var d = n`
|
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
`;
|
|
103
|
-
function
|
|
115
|
+
function p(e) {
|
|
104
116
|
let n = {
|
|
105
117
|
...r,
|
|
106
118
|
...e
|
|
107
119
|
};
|
|
108
|
-
return t(
|
|
120
|
+
return t(f, n);
|
|
109
121
|
}
|
|
110
|
-
var
|
|
122
|
+
var m = n`
|
|
111
123
|
query GetI18nProducts($filter: I18nProductFilterInput, $limit: Int = 100, $offset: Int = 0) {
|
|
112
124
|
i18nProducts(filter: $filter, limit: $limit, offset: $offset) {
|
|
113
125
|
items {
|
|
@@ -122,14 +134,14 @@ var p = n`
|
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
`;
|
|
125
|
-
function
|
|
137
|
+
function h(e) {
|
|
126
138
|
let n = {
|
|
127
139
|
...r,
|
|
128
140
|
...e
|
|
129
141
|
};
|
|
130
|
-
return t(
|
|
142
|
+
return t(m, n);
|
|
131
143
|
}
|
|
132
|
-
var
|
|
144
|
+
var g = n`
|
|
133
145
|
query GetI18nTranslationsByStatus($filter: TranslationFilterInput, $limit: Int = 50, $offset: Int = 0) {
|
|
134
146
|
translations(filter: $filter, limit: $limit, offset: $offset) {
|
|
135
147
|
items {
|
|
@@ -158,14 +170,14 @@ var h = n`
|
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
172
|
`;
|
|
161
|
-
function
|
|
173
|
+
function _(e) {
|
|
162
174
|
let n = {
|
|
163
175
|
...r,
|
|
164
176
|
...e
|
|
165
177
|
};
|
|
166
|
-
return t(
|
|
178
|
+
return t(g, n);
|
|
167
179
|
}
|
|
168
|
-
var
|
|
180
|
+
var v = n`
|
|
169
181
|
mutation ApproveI18nTranslation($id: ID!) {
|
|
170
182
|
approveTranslation(id: $id) {
|
|
171
183
|
id
|
|
@@ -174,14 +186,14 @@ var _ = n`
|
|
|
174
186
|
}
|
|
175
187
|
}
|
|
176
188
|
`;
|
|
177
|
-
function
|
|
189
|
+
function y(t) {
|
|
178
190
|
let n = {
|
|
179
191
|
...r,
|
|
180
192
|
...t
|
|
181
193
|
};
|
|
182
|
-
return e(
|
|
194
|
+
return e(v, n);
|
|
183
195
|
}
|
|
184
|
-
var
|
|
196
|
+
var b = n`
|
|
185
197
|
mutation PublishI18nTranslation($id: ID!) {
|
|
186
198
|
publishTranslation(id: $id) {
|
|
187
199
|
id
|
|
@@ -190,14 +202,14 @@ var y = n`
|
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
`;
|
|
193
|
-
function
|
|
205
|
+
function x(t) {
|
|
194
206
|
let n = {
|
|
195
207
|
...r,
|
|
196
208
|
...t
|
|
197
209
|
};
|
|
198
|
-
return e(
|
|
210
|
+
return e(b, n);
|
|
199
211
|
}
|
|
200
|
-
var
|
|
212
|
+
var S = n`
|
|
201
213
|
query GetI18nWords($filter: TranslationKeyFilterInput, $limit: Int = 50, $offset: Int = 0) {
|
|
202
214
|
translationKeys(filter: $filter, limit: $limit, offset: $offset) {
|
|
203
215
|
items {
|
|
@@ -221,14 +233,14 @@ var x = n`
|
|
|
221
233
|
}
|
|
222
234
|
}
|
|
223
235
|
`;
|
|
224
|
-
function
|
|
236
|
+
function C(e) {
|
|
225
237
|
let n = {
|
|
226
238
|
...r,
|
|
227
239
|
...e
|
|
228
240
|
};
|
|
229
|
-
return t(
|
|
241
|
+
return t(S, n);
|
|
230
242
|
}
|
|
231
|
-
var
|
|
243
|
+
var w = n`
|
|
232
244
|
mutation CreateI18nTranslations($translations: [BulkTranslationInput!]!) {
|
|
233
245
|
bulkCreateTranslations(translations: $translations) {
|
|
234
246
|
success
|
|
@@ -237,14 +249,14 @@ var C = n`
|
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
251
|
`;
|
|
240
|
-
function
|
|
252
|
+
function T(t) {
|
|
241
253
|
let n = {
|
|
242
254
|
...r,
|
|
243
255
|
...t
|
|
244
256
|
};
|
|
245
|
-
return e(
|
|
257
|
+
return e(w, n);
|
|
246
258
|
}
|
|
247
|
-
var
|
|
259
|
+
var E = n`
|
|
248
260
|
mutation UpdateI18nTranslation($id: ID!, $input: UpdateTranslationInput!) {
|
|
249
261
|
updateTranslation(id: $id, input: $input) {
|
|
250
262
|
id
|
|
@@ -253,11 +265,11 @@ var T = n`
|
|
|
253
265
|
}
|
|
254
266
|
}
|
|
255
267
|
`;
|
|
256
|
-
function
|
|
268
|
+
function D(t) {
|
|
257
269
|
let n = {
|
|
258
270
|
...r,
|
|
259
271
|
...t
|
|
260
272
|
};
|
|
261
|
-
return e(
|
|
273
|
+
return e(E, n);
|
|
262
274
|
}
|
|
263
|
-
export {
|
|
275
|
+
export { v as ApproveI18nTranslationDocument, c as CreateI18nLanguageDocument, w as CreateI18nTranslationsDocument, a as ExportI18nTranslationsDocument, i as GetI18nCoverageDocument, o as GetI18nLanguageDocument, f as GetI18nLanguagesDocument, m as GetI18nProductsDocument, g as GetI18nTranslationsByStatusDocument, S as GetI18nWordsDocument, b as PublishI18nTranslationDocument, u as UpdateI18nLanguageDocument, E as UpdateI18nTranslationDocument, y as useApproveI18nTranslationMutation, l as useCreateI18nLanguageMutation, T as useCreateI18nTranslationsMutation, s as useGetI18nLanguageQuery, p as useGetI18nLanguagesQuery, h as useGetI18nProductsQuery, _ as useGetI18nTranslationsByStatusQuery, C as useGetI18nWordsQuery, x as usePublishI18nTranslationMutation, d as useUpdateI18nLanguageMutation, D as useUpdateI18nTranslationMutation };
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
3
|
return e.Active = "ACTIVE", e.Archived = "ARCHIVED", e.Deprecated = "DEPRECATED", e;
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
|
-
return e.
|
|
5
|
+
return e.Csv = "CSV", e.Json = "JSON", e.Po = "PO", e.Xliff = "XLIFF", e.Xlsx = "XLSX", e;
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.
|
|
7
|
+
return e.Ltr = "LTR", e.Rtl = "RTL", e;
|
|
8
8
|
}({}), r = /* @__PURE__ */ function(e) {
|
|
9
|
-
return e.Active = "ACTIVE", e.
|
|
9
|
+
return e.Active = "ACTIVE", e.Deprecated = "DEPRECATED", e.Draft = "DRAFT", e;
|
|
10
10
|
}({}), i = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.Active = "ACTIVE", e.Deleted = "DELETED", e.Deprecated = "DEPRECATED", e;
|
|
12
|
+
}({}), a = /* @__PURE__ */ function(e) {
|
|
11
13
|
return e.Approved = "APPROVED", e.Draft = "DRAFT", e.PendingReview = "PENDING_REVIEW", e.Published = "PUBLISHED", e;
|
|
12
14
|
}({});
|
|
13
|
-
export { e as I18nProductStatus, t as
|
|
15
|
+
export { e as I18nProductStatus, t as ImportJobFormat, n as LanguageDirection, r as LanguageStatus, i as TranslationKeyStatus, a as TranslationStatus };
|
|
@@ -34,9 +34,10 @@ export declare function I18nRoutes({ basePath }: {
|
|
|
34
34
|
* Languages is one page with tabs: Products, Progress, the review queue and
|
|
35
35
|
* Locales open its tabs (the review queue opens Languages while the queue is
|
|
36
36
|
* hidden). A language's address (and `locales/<code>`) opens its own page,
|
|
37
|
-
* and `languages/new` opens Add language over Languages (C5b)
|
|
38
|
-
*
|
|
39
|
-
* today's
|
|
37
|
+
* and `languages/new` opens Add language over Languages (C5b); `export` opens
|
|
38
|
+
* Export over Languages (C5c). `import` opens Languages while Import is
|
|
39
|
+
* hidden; the editor stays today's page. With the opt-in off, today's table,
|
|
40
|
+
* element for element.
|
|
40
41
|
*/
|
|
41
42
|
export declare function I18nRouteTable({ basePath, v2, }: {
|
|
42
43
|
basePath: string;
|
package/dist/i18n/I18nRoutes.js
CHANGED
|
@@ -8,97 +8,104 @@ 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
10
|
import { LanguagePage as l } from "./v2/language/LanguagePage.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { DialogRedirect as u, LanguageRedirect as d, TabRedirect as f } from "./v2/TabRedirect.js";
|
|
12
|
+
import { ADD_LANGUAGE_DIALOG as p, EXPORT_DIALOG as m } from "./v2/links.js";
|
|
13
|
+
import { Navigate as h, Route as g, Routes as _ } from "react-router";
|
|
14
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
|
+
import { useAccountPagesV2 as b } from "@burdenoff/fe-libs/ui/account-pages-v2";
|
|
15
16
|
// src/i18n/I18nRoutes.tsx
|
|
16
|
-
function
|
|
17
|
-
let t =
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
function x({ basePath: e = "/" }) {
|
|
18
|
+
let t = b();
|
|
19
|
+
return /* @__PURE__ */ v(S, {
|
|
19
20
|
basePath: e,
|
|
20
21
|
v2: t
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
basePath:
|
|
24
|
+
function S({ basePath: b, v2: x }) {
|
|
25
|
+
let S = s(b, "languages"), C = s(b, "products"), w = (e) => /* @__PURE__ */ v(f, {
|
|
26
|
+
basePath: b,
|
|
26
27
|
tab: e
|
|
27
28
|
});
|
|
28
|
-
return /* @__PURE__ */ _
|
|
29
|
-
/* @__PURE__ */ g
|
|
29
|
+
return /* @__PURE__ */ y(_, { children: [
|
|
30
|
+
/* @__PURE__ */ v(g, {
|
|
30
31
|
index: !0,
|
|
31
|
-
element: /* @__PURE__ */
|
|
32
|
-
to:
|
|
32
|
+
element: /* @__PURE__ */ v(h, {
|
|
33
|
+
to: S,
|
|
33
34
|
replace: !0
|
|
34
35
|
})
|
|
35
36
|
}),
|
|
36
|
-
/* @__PURE__ */ g
|
|
37
|
+
/* @__PURE__ */ v(g, {
|
|
37
38
|
path: "languages",
|
|
38
|
-
element:
|
|
39
|
+
element: x ? /* @__PURE__ */ v(c, { basePath: b }) : /* @__PURE__ */ v(e, {})
|
|
39
40
|
}),
|
|
40
|
-
/* @__PURE__ */ g
|
|
41
|
+
/* @__PURE__ */ v(g, {
|
|
41
42
|
path: "languages/new",
|
|
42
|
-
element:
|
|
43
|
+
element: x ? /* @__PURE__ */ v(u, {
|
|
44
|
+
basePath: b,
|
|
45
|
+
dialog: p
|
|
46
|
+
}) : /* @__PURE__ */ v(o, {})
|
|
43
47
|
}),
|
|
44
|
-
/* @__PURE__ */ g
|
|
48
|
+
/* @__PURE__ */ v(g, {
|
|
45
49
|
path: "languages/:code",
|
|
46
|
-
element:
|
|
50
|
+
element: x ? /* @__PURE__ */ v(l, { basePath: b }) : /* @__PURE__ */ v(o, {})
|
|
47
51
|
}),
|
|
48
|
-
/* @__PURE__ */ g
|
|
52
|
+
/* @__PURE__ */ v(g, {
|
|
49
53
|
path: "products",
|
|
50
|
-
element:
|
|
54
|
+
element: x ? w("products") : /* @__PURE__ */ v(t, {})
|
|
51
55
|
}),
|
|
52
|
-
/* @__PURE__ */ g
|
|
56
|
+
/* @__PURE__ */ v(g, {
|
|
53
57
|
path: "products/*",
|
|
54
|
-
element:
|
|
55
|
-
to:
|
|
58
|
+
element: x ? w("products") : /* @__PURE__ */ v(h, {
|
|
59
|
+
to: C,
|
|
56
60
|
replace: !0
|
|
57
61
|
})
|
|
58
62
|
}),
|
|
59
|
-
/* @__PURE__ */ g
|
|
63
|
+
/* @__PURE__ */ v(g, {
|
|
60
64
|
path: "editor",
|
|
61
|
-
element: /* @__PURE__ */
|
|
65
|
+
element: /* @__PURE__ */ v(n, {})
|
|
62
66
|
}),
|
|
63
|
-
/* @__PURE__ */ g
|
|
67
|
+
/* @__PURE__ */ v(g, {
|
|
64
68
|
path: "editor/:keyId",
|
|
65
|
-
element: /* @__PURE__ */
|
|
69
|
+
element: /* @__PURE__ */ v(n, {})
|
|
66
70
|
}),
|
|
67
|
-
/* @__PURE__ */ g
|
|
71
|
+
/* @__PURE__ */ v(g, {
|
|
68
72
|
path: "editor/:keyId/:languageCode",
|
|
69
|
-
element: /* @__PURE__ */
|
|
73
|
+
element: /* @__PURE__ */ v(n, {})
|
|
70
74
|
}),
|
|
71
|
-
/* @__PURE__ */ g
|
|
75
|
+
/* @__PURE__ */ v(g, {
|
|
72
76
|
path: "progress",
|
|
73
|
-
element:
|
|
77
|
+
element: x ? w("languages") : /* @__PURE__ */ v(r, {})
|
|
74
78
|
}),
|
|
75
|
-
/* @__PURE__ */ g
|
|
79
|
+
/* @__PURE__ */ v(g, {
|
|
76
80
|
path: "review",
|
|
77
|
-
element:
|
|
81
|
+
element: x ? w("languages") : /* @__PURE__ */ v(i, {})
|
|
78
82
|
}),
|
|
79
|
-
/* @__PURE__ */ g
|
|
83
|
+
/* @__PURE__ */ v(g, {
|
|
80
84
|
path: "import",
|
|
81
|
-
element: /* @__PURE__ */
|
|
85
|
+
element: x ? w("languages") : /* @__PURE__ */ v(a, { mode: "import" })
|
|
82
86
|
}),
|
|
83
|
-
/* @__PURE__ */ g
|
|
87
|
+
/* @__PURE__ */ v(g, {
|
|
84
88
|
path: "export",
|
|
85
|
-
element: /* @__PURE__ */
|
|
89
|
+
element: x ? /* @__PURE__ */ v(u, {
|
|
90
|
+
basePath: b,
|
|
91
|
+
dialog: m
|
|
92
|
+
}) : /* @__PURE__ */ v(a, { mode: "export" })
|
|
86
93
|
}),
|
|
87
|
-
/* @__PURE__ */ g
|
|
94
|
+
/* @__PURE__ */ v(g, {
|
|
88
95
|
path: "locales",
|
|
89
|
-
element:
|
|
96
|
+
element: x ? w("languages") : /* @__PURE__ */ v(e, {})
|
|
90
97
|
}),
|
|
91
|
-
/* @__PURE__ */ g
|
|
98
|
+
/* @__PURE__ */ v(g, {
|
|
92
99
|
path: "locales/:code",
|
|
93
|
-
element:
|
|
100
|
+
element: x ? /* @__PURE__ */ v(d, { basePath: b }) : /* @__PURE__ */ v(o, {})
|
|
94
101
|
}),
|
|
95
|
-
/* @__PURE__ */ g
|
|
102
|
+
/* @__PURE__ */ v(g, {
|
|
96
103
|
path: "*",
|
|
97
|
-
element: /* @__PURE__ */
|
|
98
|
-
to:
|
|
104
|
+
element: /* @__PURE__ */ v(h, {
|
|
105
|
+
to: S,
|
|
99
106
|
replace: !0
|
|
100
107
|
})
|
|
101
108
|
})
|
|
102
109
|
] });
|
|
103
110
|
}
|
|
104
|
-
export {
|
|
111
|
+
export { S as I18nRouteTable, x as I18nRoutes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LanguageRow, ProductRow } from './useLanguagesData';
|
|
2
|
+
export declare function ExportDialog({ open, products, languages, startLanguage, onClose, }: {
|
|
3
|
+
open: boolean;
|
|
4
|
+
products: readonly ProductRow[];
|
|
5
|
+
languages: readonly LanguageRow[];
|
|
6
|
+
/** The language it starts on, or null for every language. */
|
|
7
|
+
startLanguage: string | null;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { exportFileName as t, pickProduct as n } from "./languageModel.js";
|
|
3
|
+
import { useExportTranslations as r } from "./useExportTranslations.js";
|
|
4
|
+
import { useId as i, useState as a } from "react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { Button as c, Label as l, ResponsiveDialog as u, ResponsiveDialogContent as d, ResponsiveDialogDescription as f, ResponsiveDialogFooter as p, ResponsiveDialogHeader as m, ResponsiveDialogTitle as h, Select as g, SelectContent as _, SelectItem as v, SelectTrigger as y, SelectValue as b, useNotify as x } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { useAppShell as S } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
8
|
+
// src/i18n/v2/ExportDialog.tsx
|
|
9
|
+
var C = "every";
|
|
10
|
+
function w({ id: e, label: t, value: n, onChange: r, testId: i, children: a }) {
|
|
11
|
+
return /* @__PURE__ */ s("div", {
|
|
12
|
+
className: "flex flex-col gap-1.5",
|
|
13
|
+
children: [/* @__PURE__ */ o(l, {
|
|
14
|
+
id: `${e}-label`,
|
|
15
|
+
children: t
|
|
16
|
+
}), /* @__PURE__ */ s(g, {
|
|
17
|
+
value: n,
|
|
18
|
+
onValueChange: r,
|
|
19
|
+
children: [/* @__PURE__ */ o(y, {
|
|
20
|
+
"aria-labelledby": `${e}-label`,
|
|
21
|
+
"data-testid": i,
|
|
22
|
+
children: /* @__PURE__ */ o(b, {})
|
|
23
|
+
}), /* @__PURE__ */ o(_, { children: a })]
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function T({ products: l, languages: u, startLanguage: g, onClose: _ }) {
|
|
28
|
+
let y = e(), b = i(), T = x(), { productName: E } = S(), D = r(), [O, k] = a(() => n(l, null, E)?.id ?? ""), [A, j] = a(g ?? C), [M, N] = a(!1), P = l.find((e) => e.id === O), F = u.find((e) => e.code === A), I = async () => {
|
|
29
|
+
if (P) {
|
|
30
|
+
N(!0);
|
|
31
|
+
try {
|
|
32
|
+
await D({
|
|
33
|
+
productId: P.id,
|
|
34
|
+
languageCode: F ? F.code : null,
|
|
35
|
+
fileName: t(P.displayName, F ? F.code : y("i18n.v3.export.everyFile", "all-languages"), "json")
|
|
36
|
+
}), T({
|
|
37
|
+
title: y("i18n.v3.export.done", "Downloaded {{product}}’s translations", { product: P.displayName }),
|
|
38
|
+
tone: "success"
|
|
39
|
+
}), _();
|
|
40
|
+
} catch {
|
|
41
|
+
T({
|
|
42
|
+
title: y("i18n.v3.export.failed", "Couldn’t export them. Try again."),
|
|
43
|
+
tone: "error"
|
|
44
|
+
});
|
|
45
|
+
} finally {
|
|
46
|
+
N(!1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ s(d, {
|
|
51
|
+
"data-testid": "export-dialog",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ s(m, { children: [/* @__PURE__ */ o(h, { children: y("i18n.v3.export.title", "Export translations") }), /* @__PURE__ */ o(f, { children: y("i18n.v3.export.body", "A JSON file (i18next, nested) with the words that are live.") })] }),
|
|
54
|
+
/* @__PURE__ */ s("div", {
|
|
55
|
+
className: "flex flex-col gap-4",
|
|
56
|
+
children: [/* @__PURE__ */ o(w, {
|
|
57
|
+
id: `${b}-product`,
|
|
58
|
+
label: y("i18n.v3.word.product", "Product"),
|
|
59
|
+
value: O,
|
|
60
|
+
onChange: k,
|
|
61
|
+
testId: "export-product",
|
|
62
|
+
children: l.map((e) => /* @__PURE__ */ o(v, {
|
|
63
|
+
value: e.id,
|
|
64
|
+
children: e.displayName
|
|
65
|
+
}, e.id))
|
|
66
|
+
}), /* @__PURE__ */ s(w, {
|
|
67
|
+
id: `${b}-language`,
|
|
68
|
+
label: y("i18n.v3.export.language", "Language"),
|
|
69
|
+
value: A,
|
|
70
|
+
onChange: j,
|
|
71
|
+
testId: "export-language",
|
|
72
|
+
children: [/* @__PURE__ */ o(v, {
|
|
73
|
+
value: C,
|
|
74
|
+
children: y("i18n.v3.export.every", "Every language")
|
|
75
|
+
}), u.map((e) => /* @__PURE__ */ o(v, {
|
|
76
|
+
value: e.code,
|
|
77
|
+
children: e.name
|
|
78
|
+
}, e.code))]
|
|
79
|
+
})]
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ s(p, { children: [/* @__PURE__ */ o(c, {
|
|
82
|
+
variant: "ghost",
|
|
83
|
+
onClick: _,
|
|
84
|
+
children: y("i18n.v3.cancel", "Cancel")
|
|
85
|
+
}), /* @__PURE__ */ o(c, {
|
|
86
|
+
busy: M,
|
|
87
|
+
disabled: !P,
|
|
88
|
+
onClick: () => void I(),
|
|
89
|
+
"data-testid": "export-download",
|
|
90
|
+
children: y("i18n.v3.export.download", "Download")
|
|
91
|
+
})] })
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function E({ open: e, products: t, languages: n, startLanguage: r, onClose: i }) {
|
|
96
|
+
return /* @__PURE__ */ o(u, {
|
|
97
|
+
open: e,
|
|
98
|
+
onOpenChange: (e) => e ? void 0 : i(),
|
|
99
|
+
children: e ? /* @__PURE__ */ o(T, {
|
|
100
|
+
products: t,
|
|
101
|
+
languages: n,
|
|
102
|
+
startLanguage: r,
|
|
103
|
+
onClose: i
|
|
104
|
+
}) : null
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export { E as ExportDialog };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LanguagesLinks } from './links';
|
|
2
|
+
import { LanguageRow, ProductRow } from './useLanguagesData';
|
|
3
|
+
export declare function LanguagesDialogs({ links, products, languages, }: {
|
|
4
|
+
links: LanguagesLinks;
|
|
5
|
+
products: readonly ProductRow[];
|
|
6
|
+
languages: readonly LanguageRow[];
|
|
7
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { ExportDialog as t } from "./ExportDialog.js";
|
|
3
|
+
import { LanguageDialog as n } from "./LanguageDialog.js";
|
|
4
|
+
import { ADD_LANGUAGE_DIALOG as r, EXPORT_DIALOG as i, EXPORT_LANGUAGE_PARAM as a } from "./links.js";
|
|
5
|
+
import { useAddLanguage as o } from "./useAddLanguage.js";
|
|
6
|
+
import { useRef as s } from "react";
|
|
7
|
+
import { useNavigate as c, useSearchParams as l } from "react-router";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import { useNotify as p } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
// src/i18n/v2/LanguagesDialogs.tsx
|
|
11
|
+
function m({ links: m, products: h, languages: g }) {
|
|
12
|
+
let _ = e(), v = c(), y = p(), [b, x] = l(), S = o(), C = b.get("dialog"), w = s(null), T = () => {
|
|
13
|
+
let e = w.current;
|
|
14
|
+
if (w.current = null, e) {
|
|
15
|
+
v(m.language(e), { replace: !0 });
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let t = new URLSearchParams(b);
|
|
19
|
+
t.delete("dialog"), t.delete(a), x(t, { replace: !0 });
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(n, {
|
|
22
|
+
open: C === r,
|
|
23
|
+
editing: null,
|
|
24
|
+
onClose: T,
|
|
25
|
+
onSave: async (e) => {
|
|
26
|
+
let t = await S(e);
|
|
27
|
+
return t.outcome === "saved" ? (y({
|
|
28
|
+
title: _("i18n.v3.add.added", "Added {{name}}", { name: e.name }),
|
|
29
|
+
tone: "success"
|
|
30
|
+
}), w.current = t.code, "saved") : (t.outcome === "failed" && y({
|
|
31
|
+
title: _("i18n.v3.add.failed", "Couldn’t add it. Try again."),
|
|
32
|
+
tone: "error"
|
|
33
|
+
}), t.outcome);
|
|
34
|
+
}
|
|
35
|
+
}), /* @__PURE__ */ d(t, {
|
|
36
|
+
open: C === i,
|
|
37
|
+
products: h,
|
|
38
|
+
languages: g,
|
|
39
|
+
startLanguage: b.get(a),
|
|
40
|
+
onClose: T
|
|
41
|
+
})] });
|
|
42
|
+
}
|
|
43
|
+
export { m as LanguagesDialogs };
|
|
@@ -1,111 +1,89 @@
|
|
|
1
1
|
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
|
-
import
|
|
4
|
-
import { useTr as
|
|
5
|
-
import {
|
|
6
|
-
import { ADD_LANGUAGE_DIALOG as a, languagesLinks as o } from "./links.js";
|
|
3
|
+
import "../../node_modules/lucide-react/dist/esm/icons/upload.js";
|
|
4
|
+
import { useTr as n } from "../hooks/useTr.js";
|
|
5
|
+
import { LanguagesDialogs as r } from "./LanguagesDialogs.js";
|
|
6
|
+
import { ADD_LANGUAGE_DIALOG as i, EXPORT_DIALOG as a, languagesLinks as o } from "./links.js";
|
|
7
7
|
import { LanguagesTab as s } from "./LanguagesTab.js";
|
|
8
8
|
import { languageProgress as c, readLanguagesTab as l, shownTabs as u, sortLanguages as d } from "./model.js";
|
|
9
9
|
import { ProductsTab as f } from "./ProductsTab.js";
|
|
10
10
|
import { ReviewTab as p } from "./ReviewTab.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { PageHeader as E } from "@burdenoff/fe-libs/chrome";
|
|
11
|
+
import { useLanguagesData as m } from "./useLanguagesData.js";
|
|
12
|
+
import { useWaitingCount as h } from "./useReviewQueue.js";
|
|
13
|
+
import { useMemo as g } from "react";
|
|
14
|
+
import { useNavigate as _, useSearchParams as v } from "react-router";
|
|
15
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
16
|
+
import { Button as x, PageTabs as S } from "@burdenoff/fe-libs/ui";
|
|
17
|
+
import { PageHeader as C } from "@burdenoff/fe-libs/chrome";
|
|
19
18
|
// src/i18n/v2/LanguagesPage.tsx
|
|
20
|
-
function
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
languages: F.languagesLoading ? void 0 : F.languages.length,
|
|
38
|
-
products: F.productsLoading ? void 0 : F.products.length,
|
|
39
|
-
review: B
|
|
19
|
+
function w({ basePath: w }) {
|
|
20
|
+
let T = n();
|
|
21
|
+
_();
|
|
22
|
+
let [E, D] = v(), O = l(E.get("tab")), k = o(w), A = m(), j = (e) => {
|
|
23
|
+
let t = new URLSearchParams(E);
|
|
24
|
+
t.set("dialog", e), D(t);
|
|
25
|
+
}, M = h(!1), N = g(() => c(A.coverage.byProduct), [A.coverage.byProduct]), P = g(() => d(A.languages), [A.languages]), F = {
|
|
26
|
+
...A,
|
|
27
|
+
languages: P
|
|
28
|
+
}, I = P.find((e) => e.isDefault)?.name ?? T("i18n.v3.sourceText", "Source text"), L = {
|
|
29
|
+
languages: T("i18n.v3.tab.languages", "Languages"),
|
|
30
|
+
products: T("i18n.v3.tab.products", "Products"),
|
|
31
|
+
review: T("i18n.v3.tab.review", "Review queue")
|
|
32
|
+
}, R = {
|
|
33
|
+
languages: A.languagesLoading ? void 0 : A.languages.length,
|
|
34
|
+
products: A.productsLoading ? void 0 : A.products.length,
|
|
35
|
+
review: M
|
|
40
36
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ b("div", {
|
|
42
38
|
"data-account-pages-v2": "languages",
|
|
43
39
|
className: "flex w-full min-w-0 flex-col",
|
|
44
40
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ y(C, {
|
|
46
42
|
variant: "compact",
|
|
47
|
-
title:
|
|
48
|
-
description:
|
|
49
|
-
primary: /* @__PURE__ */
|
|
50
|
-
onClick: () =>
|
|
51
|
-
let e = new URLSearchParams(j);
|
|
52
|
-
e.set("dialog", a), M(e);
|
|
53
|
-
},
|
|
43
|
+
title: T("i18n.v3.title", "Languages"),
|
|
44
|
+
description: T("i18n.v3.purpose", "Translations for every product, and what’s waiting for review."),
|
|
45
|
+
primary: /* @__PURE__ */ b(x, {
|
|
46
|
+
onClick: () => j(i),
|
|
54
47
|
"data-testid": "languages-add",
|
|
55
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ y(t, { "aria-hidden": "true" }), T("i18n.v3.addLanguage", "Add language")]
|
|
56
49
|
}),
|
|
57
50
|
more: [{
|
|
58
|
-
id: "import",
|
|
59
|
-
label: O("i18n.v3.importWords", "Import translations"),
|
|
60
|
-
icon: n,
|
|
61
|
-
onSelect: () => k(P.importWords)
|
|
62
|
-
}, {
|
|
63
51
|
id: "export",
|
|
64
|
-
label:
|
|
52
|
+
label: T("i18n.v3.exportWords", "Export translations"),
|
|
65
53
|
icon: e,
|
|
66
|
-
onSelect: () =>
|
|
54
|
+
onSelect: () => j(a)
|
|
67
55
|
}],
|
|
68
|
-
moreLabel:
|
|
56
|
+
moreLabel: T("i18n.v3.more", "More for languages")
|
|
69
57
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
ariaLabel:
|
|
72
|
-
activeId:
|
|
58
|
+
/* @__PURE__ */ y(S, {
|
|
59
|
+
ariaLabel: T("i18n.v3.title", "Languages"),
|
|
60
|
+
activeId: O,
|
|
73
61
|
tabs: u(!1).map((e) => ({
|
|
74
62
|
id: e,
|
|
75
|
-
label:
|
|
76
|
-
href:
|
|
77
|
-
badge:
|
|
63
|
+
label: L[e],
|
|
64
|
+
href: k.tab(e),
|
|
65
|
+
badge: R[e]
|
|
78
66
|
}))
|
|
79
67
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ y("div", {
|
|
81
69
|
className: "pt-4",
|
|
82
|
-
children:
|
|
83
|
-
languages:
|
|
84
|
-
sourceName:
|
|
85
|
-
onReviewed:
|
|
86
|
-
}) : /* @__PURE__ */
|
|
87
|
-
data:
|
|
88
|
-
progress:
|
|
89
|
-
links:
|
|
70
|
+
children: O === "products" ? /* @__PURE__ */ y(f, { data: F }) : O === "review" ? /* @__PURE__ */ y(p, {
|
|
71
|
+
languages: P,
|
|
72
|
+
sourceName: I,
|
|
73
|
+
onReviewed: A.coverage.reload
|
|
74
|
+
}) : /* @__PURE__ */ y(s, {
|
|
75
|
+
data: F,
|
|
76
|
+
progress: N,
|
|
77
|
+
links: k,
|
|
90
78
|
reviewQueue: !1
|
|
91
79
|
})
|
|
92
80
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
}
|
|
81
|
+
/* @__PURE__ */ y(r, {
|
|
82
|
+
links: k,
|
|
83
|
+
products: A.products,
|
|
84
|
+
languages: P
|
|
107
85
|
})
|
|
108
86
|
]
|
|
109
87
|
});
|
|
110
88
|
}
|
|
111
|
-
export {
|
|
89
|
+
export { w as LanguagesPage };
|
|
@@ -98,7 +98,7 @@ function y({ data: y, progress: b, links: x, reviewQueue: S }) {
|
|
|
98
98
|
id: "export",
|
|
99
99
|
label: C("i18n.v3.exportWords", "Export translations"),
|
|
100
100
|
icon: e,
|
|
101
|
-
onSelect: () => w(x.exportWords)
|
|
101
|
+
onSelect: () => w(x.exportWords(t.code))
|
|
102
102
|
}]
|
|
103
103
|
})
|
|
104
104
|
})]
|
|
@@ -2,9 +2,13 @@ export declare function TabRedirect({ basePath, tab, }: {
|
|
|
2
2
|
basePath: string;
|
|
3
3
|
tab: string;
|
|
4
4
|
}): import('react').JSX.Element;
|
|
5
|
-
/**
|
|
6
|
-
export
|
|
5
|
+
/**
|
|
6
|
+
* `languages/new` and `export`: Languages with that dialog open
|
|
7
|
+
* (`addlanguage`, `export`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function DialogRedirect({ basePath, dialog, }: {
|
|
7
10
|
basePath: string;
|
|
11
|
+
dialog: string;
|
|
8
12
|
}): import('react').JSX.Element;
|
|
9
13
|
/** `locales/<code>`: the language's own page. */
|
|
10
14
|
export declare function LanguageRedirect({ basePath }: {
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { joinPath as e } from "../utils/paths.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Navigate as t, useParams as n, useSearchParams as r } from "react-router";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
4
|
// src/i18n/v2/TabRedirect.tsx
|
|
6
|
-
function
|
|
5
|
+
function a(e, t) {
|
|
7
6
|
let n = t.toString();
|
|
8
7
|
return n ? `${e}?${n}` : e;
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
let [s] =
|
|
12
|
-
return
|
|
13
|
-
to:
|
|
9
|
+
function o({ basePath: n, tab: o }) {
|
|
10
|
+
let [s] = r(), c = new URLSearchParams(s);
|
|
11
|
+
return o === "languages" ? c.delete("tab") : c.set("tab", o), /* @__PURE__ */ i(t, {
|
|
12
|
+
to: a(e(n, "languages"), c),
|
|
14
13
|
replace: !0
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
let [s] =
|
|
19
|
-
return c.set("dialog",
|
|
20
|
-
to:
|
|
16
|
+
function s({ basePath: n, dialog: o }) {
|
|
17
|
+
let [s] = r(), c = new URLSearchParams(s);
|
|
18
|
+
return c.set("dialog", o), /* @__PURE__ */ i(t, {
|
|
19
|
+
to: a(e(n, "languages"), c),
|
|
21
20
|
replace: !0
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
function
|
|
25
|
-
let { code: s = "" } =
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
to:
|
|
23
|
+
function c({ basePath: o }) {
|
|
24
|
+
let { code: s = "" } = n(), [c] = r();
|
|
25
|
+
return /* @__PURE__ */ i(t, {
|
|
26
|
+
to: a(e(o, `languages/${encodeURIComponent(s)}`), new URLSearchParams(c)),
|
|
28
27
|
replace: !0
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
|
-
export {
|
|
30
|
+
export { s as DialogRedirect, c as LanguageRedirect, o as TabRedirect };
|
|
@@ -6,17 +6,18 @@ import i from "../../../node_modules/lucide-react/dist/esm/icons/pencil.js";
|
|
|
6
6
|
import { useTr as a } from "../../hooks/useTr.js";
|
|
7
7
|
import { LanguageDirection as o, LanguageStatus as s } from "../../../generated/global-types.js";
|
|
8
8
|
import { COUNT as c, SHARE as l } from "../formats.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
9
|
+
import { ExportDialog as u } from "../ExportDialog.js";
|
|
10
|
+
import { LanguageDialog as d } from "../LanguageDialog.js";
|
|
11
|
+
import { readLanguageTab as ee, shownLanguageTabs as f } from "../languageModel.js";
|
|
12
|
+
import { EXPORT_DIALOG as p, languagesLinks as m } from "../links.js";
|
|
13
|
+
import { languageProgress as h } from "../model.js";
|
|
14
|
+
import { ReviewTab as g } from "../ReviewTab.js";
|
|
15
|
+
import { useLanguagesData as _ } from "../useLanguagesData.js";
|
|
16
|
+
import { FormatsTab as v } from "./FormatsTab.js";
|
|
17
|
+
import { useLanguage as y } from "./useLanguage.js";
|
|
18
|
+
import { WordsTab as b } from "./WordsTab.js";
|
|
19
|
+
import { useMemo as x, useState as S } from "react";
|
|
20
|
+
import { Link as C, useParams as w, useSearchParams as T } from "react-router";
|
|
20
21
|
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
21
22
|
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
23
|
import { PageHeader as R } from "@burdenoff/fe-libs/chrome";
|
|
@@ -67,30 +68,33 @@ function B({ progress: e, loading: t }) {
|
|
|
67
68
|
]
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
function V({ basePath: c, language:
|
|
71
|
-
let w = a(), O =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
function V({ basePath: c, language: y, update: C }) {
|
|
72
|
+
let w = a(), O = L(), A = I(), [M, N] = T(), [P, F] = S(!1), V = M.get("dialog") === p, H = (e) => {
|
|
73
|
+
let t = new URLSearchParams(M);
|
|
74
|
+
e ? t.set("dialog", p) : t.delete("dialog"), N(t, { replace: !e });
|
|
75
|
+
}, U = m(c), W = _(), G = x(() => h(W.coverage.byProduct).get(y.code), [W.coverage.byProduct, y.code]), K = ee(M.get("tab"), !1), q = y.direction === o.Rtl, J = W.languages.find((e) => e.isDefault)?.name ?? w("i18n.v3.sourceText", "Source text"), Y = W.productsLoading || W.coverage.loading, X = y.status === s.Active, Z = [
|
|
76
|
+
y.nativeName === y.name ? "" : y.nativeName,
|
|
77
|
+
y.code,
|
|
78
|
+
G && G.share !== null ? w("i18n.v3.lang.shareLine", "{{share}} of every product is translated", { share: l.format(Math.floor(G.share * 100) / 100) }) : "",
|
|
79
|
+
q ? w("i18n.v3.lang.readsRtl", "reads right to left") : ""
|
|
80
|
+
].filter(Boolean), Q = async (e) => {
|
|
81
|
+
if (e || await A({
|
|
82
|
+
title: w("i18n.v3.lang.offTitle", "Turn off {{name}}?", { name: y.name }),
|
|
79
83
|
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
84
|
confirmLabel: w("i18n.v3.lang.off", "Turn off"),
|
|
81
85
|
tone: "danger"
|
|
82
86
|
})) try {
|
|
83
|
-
await
|
|
84
|
-
title: e ? w("i18n.v3.lang.onDone", "{{name}} is offered again", { name:
|
|
87
|
+
await C({ status: e ? s.Active : s.Deprecated }), O({
|
|
88
|
+
title: e ? w("i18n.v3.lang.onDone", "{{name}} is offered again", { name: y.name }) : w("i18n.v3.lang.offDone", "{{name}} is turned off", { name: y.name }),
|
|
85
89
|
tone: "success"
|
|
86
|
-
}),
|
|
90
|
+
}), W.retry();
|
|
87
91
|
} catch {
|
|
88
|
-
|
|
92
|
+
O({
|
|
89
93
|
title: w("i18n.v3.lang.saveFailed", "Couldn’t save it. Try again."),
|
|
90
94
|
tone: "error"
|
|
91
95
|
});
|
|
92
96
|
}
|
|
93
|
-
},
|
|
97
|
+
}, te = [
|
|
94
98
|
{
|
|
95
99
|
id: "names",
|
|
96
100
|
label: w("i18n.v3.lang.editNames", "Change the names…"),
|
|
@@ -101,108 +105,115 @@ function V({ basePath: c, language: v, update: S }) {
|
|
|
101
105
|
id: "export",
|
|
102
106
|
label: w("i18n.v3.exportWords", "Export translations"),
|
|
103
107
|
icon: e,
|
|
104
|
-
onSelect: () =>
|
|
108
|
+
onSelect: () => H(!0)
|
|
105
109
|
},
|
|
106
|
-
|
|
110
|
+
X ? {
|
|
107
111
|
id: "off",
|
|
108
112
|
label: w("i18n.v3.lang.offMenu", "Turn off…"),
|
|
109
113
|
icon: n,
|
|
110
114
|
danger: !0,
|
|
111
115
|
separatorBefore: !0,
|
|
112
|
-
onSelect: () => void
|
|
116
|
+
onSelect: () => void Q(!1)
|
|
113
117
|
} : {
|
|
114
118
|
id: "on",
|
|
115
119
|
label: w("i18n.v3.lang.on", "Turn on"),
|
|
116
120
|
icon: t,
|
|
117
121
|
separatorBefore: !0,
|
|
118
|
-
onSelect: () => void
|
|
122
|
+
onSelect: () => void Q(!0)
|
|
119
123
|
}
|
|
120
|
-
],
|
|
124
|
+
], ne = {
|
|
121
125
|
words: w("i18n.v3.lang.words", "Words"),
|
|
122
126
|
review: w("i18n.v3.col.waiting", "Waiting for review"),
|
|
123
127
|
formats: w("i18n.v3.lang.formats", "Dates and numbers")
|
|
124
|
-
},
|
|
125
|
-
let t = new URLSearchParams(
|
|
128
|
+
}, re = (e) => {
|
|
129
|
+
let t = new URLSearchParams(M);
|
|
126
130
|
e === "words" ? t.delete("tab") : t.set("tab", e);
|
|
127
131
|
let n = t.toString();
|
|
128
|
-
return n ? `${
|
|
132
|
+
return n ? `${U.language(y.code)}?${n}` : U.language(y.code);
|
|
129
133
|
}, $;
|
|
130
|
-
return $ =
|
|
131
|
-
language:
|
|
132
|
-
onUpdate:
|
|
133
|
-
}) :
|
|
134
|
-
languages:
|
|
135
|
-
sourceName:
|
|
136
|
-
onReviewed:
|
|
137
|
-
fixedLanguage:
|
|
138
|
-
}) : /* @__PURE__ */ E(
|
|
139
|
-
products:
|
|
140
|
-
productsLoading:
|
|
141
|
-
languageCode:
|
|
142
|
-
languageName:
|
|
143
|
-
sourceName:
|
|
144
|
-
rtl:
|
|
145
|
-
onSaved:
|
|
134
|
+
return $ = K === "formats" ? /* @__PURE__ */ E(v, {
|
|
135
|
+
language: y,
|
|
136
|
+
onUpdate: C
|
|
137
|
+
}) : K === "review" ? /* @__PURE__ */ E(g, {
|
|
138
|
+
languages: W.languages,
|
|
139
|
+
sourceName: J,
|
|
140
|
+
onReviewed: W.coverage.reload,
|
|
141
|
+
fixedLanguage: y.code
|
|
142
|
+
}) : /* @__PURE__ */ E(b, {
|
|
143
|
+
products: W.products,
|
|
144
|
+
productsLoading: W.productsLoading,
|
|
145
|
+
languageCode: y.code,
|
|
146
|
+
languageName: y.name,
|
|
147
|
+
sourceName: J,
|
|
148
|
+
rtl: q,
|
|
149
|
+
onSaved: W.coverage.reload
|
|
146
150
|
}), /* @__PURE__ */ D("div", {
|
|
147
151
|
"data-account-pages-v2": "language",
|
|
148
152
|
className: "flex w-full min-w-0 flex-col gap-4",
|
|
149
153
|
children: [
|
|
150
154
|
/* @__PURE__ */ E(R, {
|
|
151
155
|
variant: "compact",
|
|
152
|
-
title:
|
|
153
|
-
description:
|
|
156
|
+
title: y.name,
|
|
157
|
+
description: Z.join(" · "),
|
|
154
158
|
back: {
|
|
155
159
|
label: w("i18n.v3.title", "Languages"),
|
|
156
|
-
to:
|
|
160
|
+
to: U.page
|
|
157
161
|
},
|
|
158
162
|
icon: /* @__PURE__ */ E(k, {
|
|
159
163
|
size: "lg",
|
|
160
164
|
children: /* @__PURE__ */ E(r, { "aria-hidden": "true" })
|
|
161
165
|
}),
|
|
162
166
|
meta: /* @__PURE__ */ E(z, {
|
|
163
|
-
language:
|
|
164
|
-
progress:
|
|
167
|
+
language: y,
|
|
168
|
+
progress: G
|
|
165
169
|
}),
|
|
166
|
-
more:
|
|
167
|
-
moreLabel: w("i18n.v3.lang.moreFor", "More for {{name}}", { name:
|
|
170
|
+
more: te,
|
|
171
|
+
moreLabel: w("i18n.v3.lang.moreFor", "More for {{name}}", { name: y.name })
|
|
168
172
|
}),
|
|
169
173
|
/* @__PURE__ */ E(B, {
|
|
170
|
-
progress:
|
|
171
|
-
loading:
|
|
174
|
+
progress: G,
|
|
175
|
+
loading: Y
|
|
172
176
|
}),
|
|
173
177
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(j, {
|
|
174
|
-
ariaLabel:
|
|
175
|
-
activeId:
|
|
178
|
+
ariaLabel: y.name,
|
|
179
|
+
activeId: K,
|
|
176
180
|
tabs: f(!1).map((e) => ({
|
|
177
181
|
id: e,
|
|
178
|
-
label:
|
|
179
|
-
href:
|
|
180
|
-
badge: e === "review" ?
|
|
182
|
+
label: ne[e],
|
|
183
|
+
href: re(e),
|
|
184
|
+
badge: e === "review" ? G?.waiting : void 0
|
|
181
185
|
}))
|
|
182
186
|
}), /* @__PURE__ */ E("div", {
|
|
183
187
|
className: "pt-4",
|
|
184
188
|
children: $
|
|
185
189
|
})] }),
|
|
186
190
|
/* @__PURE__ */ E(u, {
|
|
191
|
+
open: V,
|
|
192
|
+
products: W.products,
|
|
193
|
+
languages: W.languages,
|
|
194
|
+
startLanguage: y.code,
|
|
195
|
+
onClose: () => H(!1)
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ E(d, {
|
|
187
198
|
open: P,
|
|
188
199
|
editing: {
|
|
189
|
-
code:
|
|
190
|
-
name:
|
|
191
|
-
nativeName:
|
|
192
|
-
direction:
|
|
200
|
+
code: y.code,
|
|
201
|
+
name: y.name,
|
|
202
|
+
nativeName: y.nativeName,
|
|
203
|
+
direction: y.direction
|
|
193
204
|
},
|
|
194
205
|
onClose: () => F(!1),
|
|
195
206
|
onSave: async (e) => {
|
|
196
207
|
try {
|
|
197
|
-
return await
|
|
208
|
+
return await C({
|
|
198
209
|
name: e.name,
|
|
199
210
|
nativeName: e.nativeName
|
|
200
|
-
}),
|
|
211
|
+
}), O({
|
|
201
212
|
title: w("i18n.v3.lang.saved", "Saved"),
|
|
202
213
|
tone: "success"
|
|
203
|
-
}),
|
|
214
|
+
}), W.retry(), "saved";
|
|
204
215
|
} catch {
|
|
205
|
-
return
|
|
216
|
+
return O({
|
|
206
217
|
title: w("i18n.v3.lang.saveFailed", "Couldn’t save it. Try again."),
|
|
207
218
|
tone: "error"
|
|
208
219
|
}), "failed";
|
|
@@ -213,7 +224,7 @@ function V({ basePath: c, language: v, update: S }) {
|
|
|
213
224
|
});
|
|
214
225
|
}
|
|
215
226
|
function H({ basePath: e }) {
|
|
216
|
-
let t = a(), { code: n = "" } = w(), i =
|
|
227
|
+
let t = a(), { code: n = "" } = w(), i = y(n), o = m(e);
|
|
217
228
|
return i.language ? /* @__PURE__ */ E(V, {
|
|
218
229
|
basePath: e,
|
|
219
230
|
language: i.language,
|
|
@@ -227,7 +238,7 @@ function H({ basePath: e }) {
|
|
|
227
238
|
icon: /* @__PURE__ */ E(r, { "aria-hidden": "true" }),
|
|
228
239
|
title: t("i18n.v3.lang.notFound", "We can’t find that language"),
|
|
229
240
|
description: t("i18n.v3.lang.notFoundBody", "It may have a different code. Every language is on Languages."),
|
|
230
|
-
action: /* @__PURE__ */ E(
|
|
241
|
+
action: /* @__PURE__ */ E(C, {
|
|
231
242
|
to: o.page,
|
|
232
243
|
className: "text-sm font-semibold text-action-primary-bg hover:underline",
|
|
233
244
|
children: t("i18n.v3.lang.toLanguages", "Go to Languages")
|
|
@@ -59,3 +59,8 @@ export declare function canSaveLanguage(fields: {
|
|
|
59
59
|
name: string;
|
|
60
60
|
nativeName: string;
|
|
61
61
|
}, facts: CodeFacts | null, adding: boolean): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The exported file's name: the product, then the language or every
|
|
64
|
+
* language, written for a file system ("fluidgrids-pt-BR.json").
|
|
65
|
+
*/
|
|
66
|
+
export declare function exportFileName(productName: string, languagePart: string, extension: string): string;
|
|
@@ -117,4 +117,8 @@ function b(e, t) {
|
|
|
117
117
|
function x(e, t, n) {
|
|
118
118
|
return e.name.trim() !== "" && e.nativeName.trim() !== "" && (!n || t !== null);
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
function S(e, t, n) {
|
|
121
|
+
let r = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^A-Za-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
122
|
+
return `${[r(e).toLowerCase(), r(t)].filter(Boolean).join("-") || "translations"}.${n}`;
|
|
123
|
+
}
|
|
124
|
+
export { e as DATE_FORMATS, _ as LANGUAGE_TABS, h as PRODUCT_PARAM, t as TIME_FORMATS, x as canSaveLanguage, b as codeProblem, S as exportFileName, p as factsForCode, o as formatExample, s as formatOptions, g as pickProduct, y as readLanguageTab, v as shownLanguageTabs, m as translationIn };
|
package/dist/i18n/v2/links.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { LanguagesTab } from './model';
|
|
2
2
|
/** `?dialog=` opening Add language over the Languages page. */
|
|
3
3
|
export declare const ADD_LANGUAGE_DIALOG = "addlanguage";
|
|
4
|
+
/** `?dialog=` opening Export over Languages or a language's page. */
|
|
5
|
+
export declare const EXPORT_DIALOG = "export";
|
|
6
|
+
/** `?lang=`: the language an export starts from. */
|
|
7
|
+
export declare const EXPORT_LANGUAGE_PARAM = "lang";
|
|
4
8
|
export declare function languagesLinks(basePath: string): {
|
|
5
9
|
page: string;
|
|
6
10
|
tab: (tab: LanguagesTab) => string;
|
|
@@ -11,6 +15,7 @@ export declare function languagesLinks(basePath: string): {
|
|
|
11
15
|
/** Languages with Add language open over it. */
|
|
12
16
|
addLanguage: string;
|
|
13
17
|
importWords: string;
|
|
14
|
-
|
|
18
|
+
/** Languages with Export open, starting from one language or every one. */
|
|
19
|
+
exportWords: (languageCode?: string) => string;
|
|
15
20
|
};
|
|
16
21
|
export type LanguagesLinks = ReturnType<typeof languagesLinks>;
|
package/dist/i18n/v2/links.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { joinPath as e } from "../utils/paths.js";
|
|
2
2
|
import { LANGUAGE_PARAM as t } from "./model.js";
|
|
3
3
|
// src/i18n/v2/links.ts
|
|
4
|
-
var n = "addlanguage";
|
|
5
|
-
function
|
|
6
|
-
let
|
|
4
|
+
var n = "addlanguage", r = "export", i = "lang";
|
|
5
|
+
function a(a) {
|
|
6
|
+
let o = e(a, "languages");
|
|
7
7
|
return {
|
|
8
|
-
page:
|
|
9
|
-
tab: (e) => e === "languages" ?
|
|
10
|
-
review: (e) => `${
|
|
11
|
-
language: (t) => e(
|
|
12
|
-
addLanguage: `${
|
|
13
|
-
importWords: e(
|
|
14
|
-
exportWords: e(r
|
|
8
|
+
page: o,
|
|
9
|
+
tab: (e) => e === "languages" ? o : `${o}?tab=${e}`,
|
|
10
|
+
review: (e) => `${o}?tab=review&${t}=${encodeURIComponent(e)}`,
|
|
11
|
+
language: (t) => e(a, `languages/${encodeURIComponent(t)}`),
|
|
12
|
+
addLanguage: `${o}?dialog=${n}`,
|
|
13
|
+
importWords: e(a, "import"),
|
|
14
|
+
exportWords: (e) => e ? `${o}?dialog=${r}&${i}=${encodeURIComponent(e)}` : `${o}?dialog=${r}`
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
export { n as ADD_LANGUAGE_DIALOG, r as languagesLinks };
|
|
17
|
+
export { n as ADD_LANGUAGE_DIALOG, r as EXPORT_DIALOG, i as EXPORT_LANGUAGE_PARAM, a as languagesLinks };
|
package/dist/i18n/v2/model.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export type LanguagesTab = (typeof LANGUAGES_TABS)[number];
|
|
|
14
14
|
* counts (from `translationCoverage`) still show, as plain text.
|
|
15
15
|
*/
|
|
16
16
|
export declare const REVIEW_QUEUE_LISTS = false;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the service runs import jobs. Today `createImportJob` only stores
|
|
19
|
+
* a pending row and nothing reads the file, so an import would stay pending
|
|
20
|
+
* for ever (BOFF-16785's backend list). Until it runs them, Import translations
|
|
21
|
+
* is hidden and `/import` opens Languages.
|
|
22
|
+
*/
|
|
23
|
+
export declare const IMPORT_RUNS = false;
|
|
17
24
|
/** The tabs shown: the review queue only once the service can list it. */
|
|
18
25
|
export declare function shownTabs(reviewQueue: boolean): LanguagesTab[];
|
|
19
26
|
/** `?tab=`; anything else, or a hidden tab, is the Languages tab. */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ExportRequest {
|
|
2
|
+
productId: string;
|
|
3
|
+
/** One language, or null for every language. */
|
|
4
|
+
languageCode: string | null;
|
|
5
|
+
/** The file's name, extension included. */
|
|
6
|
+
fileName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useExportTranslations(): (request: ExportRequest) => Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useApolloClient as e } from "../../node_modules/@apollo/client/react/hooks/useApolloClient.js";
|
|
2
|
+
import { ExportI18nTranslationsDocument as t } from "../../generated/global-operations.js";
|
|
3
|
+
import { ImportJobFormat as n } from "../../generated/global-types.js";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
// src/i18n/v2/useExportTranslations.ts
|
|
6
|
+
function i(e, t, n) {
|
|
7
|
+
let r = URL.createObjectURL(new Blob([e], { type: n })), i = document.createElement("a");
|
|
8
|
+
i.href = r, i.download = t, i.click(), URL.revokeObjectURL(r);
|
|
9
|
+
}
|
|
10
|
+
function a() {
|
|
11
|
+
let a = e();
|
|
12
|
+
return r(async (e) => {
|
|
13
|
+
let r = (await a.query({
|
|
14
|
+
query: t,
|
|
15
|
+
variables: {
|
|
16
|
+
format: n.Json,
|
|
17
|
+
productId: e.productId,
|
|
18
|
+
languageCode: e.languageCode
|
|
19
|
+
},
|
|
20
|
+
fetchPolicy: "network-only"
|
|
21
|
+
})).data?.exportTranslations.content;
|
|
22
|
+
if (r === void 0) throw Error("The export came back empty.");
|
|
23
|
+
i(r, e.fileName, "application/json;charset=utf-8");
|
|
24
|
+
}, [a]);
|
|
25
|
+
}
|
|
26
|
+
export { a as useExportTranslations };
|