@burdenoff/microfe-i18n 2026.1129.3 → 2026.1129.4

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.
@@ -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 o(e) {
45
+ function s(e) {
34
46
  let n = {
35
47
  ...r,
36
48
  ...e
37
49
  };
38
- return t(a, n);
50
+ return t(o, n);
39
51
  }
40
- var s = n`
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 c(t) {
64
+ function l(t) {
53
65
  let n = {
54
66
  ...r,
55
67
  ...t
56
68
  };
57
- return e(s, n);
69
+ return e(c, n);
58
70
  }
59
- var l = n`
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 u(t) {
86
+ function d(t) {
75
87
  let n = {
76
88
  ...r,
77
89
  ...t
78
90
  };
79
- return e(l, n);
91
+ return e(u, n);
80
92
  }
81
- var d = n`
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 f(e) {
115
+ function p(e) {
104
116
  let n = {
105
117
  ...r,
106
118
  ...e
107
119
  };
108
- return t(d, n);
120
+ return t(f, n);
109
121
  }
110
- var p = n`
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 m(e) {
137
+ function h(e) {
126
138
  let n = {
127
139
  ...r,
128
140
  ...e
129
141
  };
130
- return t(p, n);
142
+ return t(m, n);
131
143
  }
132
- var h = n`
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 g(e) {
173
+ function _(e) {
162
174
  let n = {
163
175
  ...r,
164
176
  ...e
165
177
  };
166
- return t(h, n);
178
+ return t(g, n);
167
179
  }
168
- var _ = n`
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 v(t) {
189
+ function y(t) {
178
190
  let n = {
179
191
  ...r,
180
192
  ...t
181
193
  };
182
- return e(_, n);
194
+ return e(v, n);
183
195
  }
184
- var y = n`
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 b(t) {
205
+ function x(t) {
194
206
  let n = {
195
207
  ...r,
196
208
  ...t
197
209
  };
198
- return e(y, n);
210
+ return e(b, n);
199
211
  }
200
- var x = n`
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 S(e) {
236
+ function C(e) {
225
237
  let n = {
226
238
  ...r,
227
239
  ...e
228
240
  };
229
- return t(x, n);
241
+ return t(S, n);
230
242
  }
231
- var C = n`
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 w(t) {
252
+ function T(t) {
241
253
  let n = {
242
254
  ...r,
243
255
  ...t
244
256
  };
245
- return e(C, n);
257
+ return e(w, n);
246
258
  }
247
- var T = n`
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 E(t) {
268
+ function D(t) {
257
269
  let n = {
258
270
  ...r,
259
271
  ...t
260
272
  };
261
- return e(T, n);
273
+ return e(E, n);
262
274
  }
263
- export { _ as ApproveI18nTranslationDocument, s as CreateI18nLanguageDocument, C as CreateI18nTranslationsDocument, i as GetI18nCoverageDocument, a as GetI18nLanguageDocument, d as GetI18nLanguagesDocument, p as GetI18nProductsDocument, h as GetI18nTranslationsByStatusDocument, x as GetI18nWordsDocument, y as PublishI18nTranslationDocument, l as UpdateI18nLanguageDocument, T as UpdateI18nTranslationDocument, v as useApproveI18nTranslationMutation, c as useCreateI18nLanguageMutation, w as useCreateI18nTranslationsMutation, o as useGetI18nLanguageQuery, f as useGetI18nLanguagesQuery, m as useGetI18nProductsQuery, g as useGetI18nTranslationsByStatusQuery, S as useGetI18nWordsQuery, b as usePublishI18nTranslationMutation, u as useUpdateI18nLanguageMutation, E as useUpdateI18nTranslationMutation };
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.Ltr = "LTR", e.Rtl = "RTL", 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.Active = "ACTIVE", e.Deprecated = "DEPRECATED", e.Draft = "DRAFT", e;
7
+ return e.Ltr = "LTR", e.Rtl = "RTL", e;
8
8
  }({}), r = /* @__PURE__ */ function(e) {
9
- return e.Active = "ACTIVE", e.Deleted = "DELETED", e.Deprecated = "DEPRECATED", 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 LanguageDirection, n as LanguageStatus, r as TranslationKeyStatus, i as TranslationStatus };
15
+ export { e as I18nProductStatus, t as ImportJobFormat, n as LanguageDirection, r as LanguageStatus, i as TranslationKeyStatus, a as TranslationStatus };
@@ -34,9 +34,9 @@ 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). The editor,
38
- * Import and Export stay today's pages until C5c. With the opt-in off,
39
- * today's table, element for element.
37
+ * and `languages/new` opens Add language over Languages (C5b); `export` opens
38
+ * Export over Languages (C5c). The editor and Import stay today's pages. With
39
+ * the opt-in off, today's table, element for element.
40
40
  */
41
41
  export declare function I18nRouteTable({ basePath, v2, }: {
42
42
  basePath: string;
@@ -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 { 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";
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 y({ basePath: e = "/" }) {
17
- let t = v();
18
- return /* @__PURE__ */ g(b, {
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 b({ basePath: v, v2: y }) {
24
- let b = s(v, "languages"), x = s(v, "products"), S = (e) => /* @__PURE__ */ g(f, {
25
- basePath: v,
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__ */ _(h, { children: [
29
- /* @__PURE__ */ g(m, {
29
+ return /* @__PURE__ */ y(_, { children: [
30
+ /* @__PURE__ */ v(g, {
30
31
  index: !0,
31
- element: /* @__PURE__ */ g(p, {
32
- to: b,
32
+ element: /* @__PURE__ */ v(h, {
33
+ to: S,
33
34
  replace: !0
34
35
  })
35
36
  }),
36
- /* @__PURE__ */ g(m, {
37
+ /* @__PURE__ */ v(g, {
37
38
  path: "languages",
38
- element: y ? /* @__PURE__ */ g(c, { basePath: v }) : /* @__PURE__ */ g(e, {})
39
+ element: x ? /* @__PURE__ */ v(c, { basePath: b }) : /* @__PURE__ */ v(e, {})
39
40
  }),
40
- /* @__PURE__ */ g(m, {
41
+ /* @__PURE__ */ v(g, {
41
42
  path: "languages/new",
42
- element: y ? /* @__PURE__ */ g(u, { basePath: v }) : /* @__PURE__ */ g(o, {})
43
+ element: x ? /* @__PURE__ */ v(u, {
44
+ basePath: b,
45
+ dialog: p
46
+ }) : /* @__PURE__ */ v(o, {})
43
47
  }),
44
- /* @__PURE__ */ g(m, {
48
+ /* @__PURE__ */ v(g, {
45
49
  path: "languages/:code",
46
- element: y ? /* @__PURE__ */ g(l, { basePath: v }) : /* @__PURE__ */ g(o, {})
50
+ element: x ? /* @__PURE__ */ v(l, { basePath: b }) : /* @__PURE__ */ v(o, {})
47
51
  }),
48
- /* @__PURE__ */ g(m, {
52
+ /* @__PURE__ */ v(g, {
49
53
  path: "products",
50
- element: y ? S("products") : /* @__PURE__ */ g(t, {})
54
+ element: x ? w("products") : /* @__PURE__ */ v(t, {})
51
55
  }),
52
- /* @__PURE__ */ g(m, {
56
+ /* @__PURE__ */ v(g, {
53
57
  path: "products/*",
54
- element: y ? S("products") : /* @__PURE__ */ g(p, {
55
- to: x,
58
+ element: x ? w("products") : /* @__PURE__ */ v(h, {
59
+ to: C,
56
60
  replace: !0
57
61
  })
58
62
  }),
59
- /* @__PURE__ */ g(m, {
63
+ /* @__PURE__ */ v(g, {
60
64
  path: "editor",
61
- element: /* @__PURE__ */ g(n, {})
65
+ element: /* @__PURE__ */ v(n, {})
62
66
  }),
63
- /* @__PURE__ */ g(m, {
67
+ /* @__PURE__ */ v(g, {
64
68
  path: "editor/:keyId",
65
- element: /* @__PURE__ */ g(n, {})
69
+ element: /* @__PURE__ */ v(n, {})
66
70
  }),
67
- /* @__PURE__ */ g(m, {
71
+ /* @__PURE__ */ v(g, {
68
72
  path: "editor/:keyId/:languageCode",
69
- element: /* @__PURE__ */ g(n, {})
73
+ element: /* @__PURE__ */ v(n, {})
70
74
  }),
71
- /* @__PURE__ */ g(m, {
75
+ /* @__PURE__ */ v(g, {
72
76
  path: "progress",
73
- element: y ? S("languages") : /* @__PURE__ */ g(r, {})
77
+ element: x ? w("languages") : /* @__PURE__ */ v(r, {})
74
78
  }),
75
- /* @__PURE__ */ g(m, {
79
+ /* @__PURE__ */ v(g, {
76
80
  path: "review",
77
- element: y ? S("languages") : /* @__PURE__ */ g(i, {})
81
+ element: x ? w("languages") : /* @__PURE__ */ v(i, {})
78
82
  }),
79
- /* @__PURE__ */ g(m, {
83
+ /* @__PURE__ */ v(g, {
80
84
  path: "import",
81
- element: /* @__PURE__ */ g(a, { mode: "import" })
85
+ element: /* @__PURE__ */ v(a, { mode: "import" })
82
86
  }),
83
- /* @__PURE__ */ g(m, {
87
+ /* @__PURE__ */ v(g, {
84
88
  path: "export",
85
- element: /* @__PURE__ */ g(a, { mode: "export" })
89
+ element: x ? /* @__PURE__ */ v(u, {
90
+ basePath: b,
91
+ dialog: m
92
+ }) : /* @__PURE__ */ v(a, { mode: "export" })
86
93
  }),
87
- /* @__PURE__ */ g(m, {
94
+ /* @__PURE__ */ v(g, {
88
95
  path: "locales",
89
- element: y ? S("languages") : /* @__PURE__ */ g(e, {})
96
+ element: x ? w("languages") : /* @__PURE__ */ v(e, {})
90
97
  }),
91
- /* @__PURE__ */ g(m, {
98
+ /* @__PURE__ */ v(g, {
92
99
  path: "locales/:code",
93
- element: y ? /* @__PURE__ */ g(d, { basePath: v }) : /* @__PURE__ */ g(o, {})
100
+ element: x ? /* @__PURE__ */ v(d, { basePath: b }) : /* @__PURE__ */ v(o, {})
94
101
  }),
95
- /* @__PURE__ */ g(m, {
102
+ /* @__PURE__ */ v(g, {
96
103
  path: "*",
97
- element: /* @__PURE__ */ g(p, {
98
- to: b,
104
+ element: /* @__PURE__ */ v(h, {
105
+ to: S,
99
106
  replace: !0
100
107
  })
101
108
  })
102
109
  ] });
103
110
  }
104
- export { b as I18nRouteTable, y as I18nRoutes };
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 };
@@ -2,110 +2,91 @@ 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 { 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";
5
+ import { LanguagesDialogs as i } from "./LanguagesDialogs.js";
6
+ import { ADD_LANGUAGE_DIALOG as a, EXPORT_DIALOG as o, languagesLinks as s } from "./links.js";
7
+ import { LanguagesTab as c } from "./LanguagesTab.js";
8
+ import { languageProgress as l, readLanguagesTab as u, shownTabs as d, sortLanguages as f } from "./model.js";
9
+ import { ProductsTab as p } from "./ProductsTab.js";
10
+ import { ReviewTab as m } from "./ReviewTab.js";
12
11
  import { useLanguagesData as h } from "./useLanguagesData.js";
13
12
  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";
13
+ import { useMemo as _ } from "react";
14
+ import { useNavigate as v, useSearchParams as y } from "react-router";
15
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
16
+ import { Button as S, PageTabs as C } from "@burdenoff/fe-libs/ui";
17
+ import { PageHeader as w } from "@burdenoff/fe-libs/chrome";
19
18
  // src/i18n/v2/LanguagesPage.tsx
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
19
+ function T({ basePath: T }) {
20
+ let E = r(), D = v(), [O, k] = y(), A = u(O.get("tab")), j = s(T), M = h(), N = (e) => {
21
+ let t = new URLSearchParams(O);
22
+ t.set("dialog", e), k(t);
23
+ }, P = g(!1), F = _(() => l(M.coverage.byProduct), [M.coverage.byProduct]), I = _(() => f(M.languages), [M.languages]), L = {
24
+ ...M,
25
+ languages: I
26
+ }, R = I.find((e) => e.isDefault)?.name ?? E("i18n.v3.sourceText", "Source text"), z = {
27
+ languages: E("i18n.v3.tab.languages", "Languages"),
28
+ products: E("i18n.v3.tab.products", "Products"),
29
+ review: E("i18n.v3.tab.review", "Review queue")
30
+ }, B = {
31
+ languages: M.languagesLoading ? void 0 : M.languages.length,
32
+ products: M.productsLoading ? void 0 : M.products.length,
33
+ review: P
40
34
  };
41
- return /* @__PURE__ */ S("div", {
35
+ return /* @__PURE__ */ x("div", {
42
36
  "data-account-pages-v2": "languages",
43
37
  className: "flex w-full min-w-0 flex-col",
44
38
  children: [
45
- /* @__PURE__ */ x(E, {
39
+ /* @__PURE__ */ b(w, {
46
40
  variant: "compact",
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
+ title: E("i18n.v3.title", "Languages"),
42
+ description: E("i18n.v3.purpose", "Translations for every product, and what’s waiting for review."),
43
+ primary: /* @__PURE__ */ x(S, {
44
+ onClick: () => N(a),
54
45
  "data-testid": "languages-add",
55
- children: [/* @__PURE__ */ x(t, { "aria-hidden": "true" }), O("i18n.v3.addLanguage", "Add language")]
46
+ children: [/* @__PURE__ */ b(t, { "aria-hidden": "true" }), E("i18n.v3.addLanguage", "Add language")]
56
47
  }),
57
48
  more: [{
58
49
  id: "import",
59
- label: O("i18n.v3.importWords", "Import translations"),
50
+ label: E("i18n.v3.importWords", "Import translations"),
60
51
  icon: n,
61
- onSelect: () => k(P.importWords)
52
+ onSelect: () => D(j.importWords)
62
53
  }, {
63
54
  id: "export",
64
- label: O("i18n.v3.exportWords", "Export translations"),
55
+ label: E("i18n.v3.exportWords", "Export translations"),
65
56
  icon: e,
66
- onSelect: () => k(P.exportWords)
57
+ onSelect: () => N(o)
67
58
  }],
68
- moreLabel: O("i18n.v3.more", "More for languages")
59
+ moreLabel: E("i18n.v3.more", "More for languages")
69
60
  }),
70
- /* @__PURE__ */ x(w, {
71
- ariaLabel: O("i18n.v3.title", "Languages"),
72
- activeId: N,
73
- tabs: u(!1).map((e) => ({
61
+ /* @__PURE__ */ b(C, {
62
+ ariaLabel: E("i18n.v3.title", "Languages"),
63
+ activeId: A,
64
+ tabs: d(!1).map((e) => ({
74
65
  id: e,
75
- label: G[e],
76
- href: P.tab(e),
77
- badge: K[e]
66
+ label: z[e],
67
+ href: j.tab(e),
68
+ badge: B[e]
78
69
  }))
79
70
  }),
80
- /* @__PURE__ */ x("div", {
71
+ /* @__PURE__ */ b("div", {
81
72
  className: "pt-4",
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,
73
+ children: A === "products" ? /* @__PURE__ */ b(p, { data: L }) : A === "review" ? /* @__PURE__ */ b(m, {
74
+ languages: I,
75
+ sourceName: R,
76
+ onReviewed: M.coverage.reload
77
+ }) : /* @__PURE__ */ b(c, {
78
+ data: L,
79
+ progress: F,
80
+ links: j,
90
81
  reviewQueue: !1
91
82
  })
92
83
  }),
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
- }
84
+ /* @__PURE__ */ b(i, {
85
+ links: j,
86
+ products: M.products,
87
+ languages: I
107
88
  })
108
89
  ]
109
90
  });
110
91
  }
111
- export { D as LanguagesPage };
92
+ export { T 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
- /** `languages/new`: Languages with Add language open. */
6
- export declare function AddLanguageRedirect({ basePath }: {
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 { ADD_LANGUAGE_DIALOG as t } from "./links.js";
3
- import { Navigate as n, useParams as r, useSearchParams as i } from "react-router";
4
- import { jsx as a } from "react/jsx-runtime";
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 o(e, t) {
5
+ function a(e, t) {
7
6
  let n = t.toString();
8
7
  return n ? `${e}?${n}` : e;
9
8
  }
10
- function s({ basePath: t, tab: r }) {
11
- let [s] = i(), c = new URLSearchParams(s);
12
- return r === "languages" ? c.delete("tab") : c.set("tab", r), /* @__PURE__ */ a(n, {
13
- to: o(e(t, "languages"), c),
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 c({ basePath: r }) {
18
- let [s] = i(), c = new URLSearchParams(s);
19
- return c.set("dialog", t), /* @__PURE__ */ a(n, {
20
- to: o(e(r, "languages"), c),
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 l({ basePath: t }) {
25
- let { code: s = "" } = r(), [c] = i();
26
- return /* @__PURE__ */ a(n, {
27
- to: o(e(t, `languages/${encodeURIComponent(s)}`), new URLSearchParams(c)),
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 { c as AddLanguageRedirect, l as LanguageRedirect, s as TabRedirect };
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 { LanguageDialog as u } from "../LanguageDialog.js";
10
- import { readLanguageTab as d, shownLanguageTabs as f } from "../languageModel.js";
11
- import { languagesLinks as p } from "../links.js";
12
- import { languageProgress as m } from "../model.js";
13
- import { ReviewTab as h } from "../ReviewTab.js";
14
- import { useLanguagesData as g } from "../useLanguagesData.js";
15
- import { FormatsTab as _ } from "./FormatsTab.js";
16
- import { useLanguage as v } from "./useLanguage.js";
17
- import { WordsTab as y } from "./WordsTab.js";
18
- import { useMemo as b, useState as x } from "react";
19
- import { Link as S, useNavigate as C, useParams as w, useSearchParams as T } from "react-router";
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: v, update: S }) {
71
- let w = a(), O = C(), A = L(), M = I(), [N] = T(), [P, F] = x(!1), V = p(c), H = g(), U = b(() => m(H.coverage.byProduct).get(v.code), [H.coverage.byProduct, v.code]), W = d(N.get("tab"), !1), G = v.direction === o.Rtl, K = H.languages.find((e) => e.isDefault)?.name ?? w("i18n.v3.sourceText", "Source text"), q = H.productsLoading || H.coverage.loading, J = v.status === s.Active, Y = [
72
- v.nativeName === v.name ? "" : v.nativeName,
73
- v.code,
74
- U && U.share !== null ? w("i18n.v3.lang.shareLine", "{{share}} of every product is translated", { share: l.format(Math.floor(U.share * 100) / 100) }) : "",
75
- G ? w("i18n.v3.lang.readsRtl", "reads right to left") : ""
76
- ].filter(Boolean), X = async (e) => {
77
- if (e || await M({
78
- title: w("i18n.v3.lang.offTitle", "Turn off {{name}}?", { name: v.name }),
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 S({ status: e ? s.Active : s.Deprecated }), A({
84
- title: e ? w("i18n.v3.lang.onDone", "{{name}} is offered again", { name: v.name }) : w("i18n.v3.lang.offDone", "{{name}} is turned off", { name: v.name }),
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
- }), H.retry();
90
+ }), W.retry();
87
91
  } catch {
88
- A({
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
- }, Z = [
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: () => O(V.exportWords)
108
+ onSelect: () => H(!0)
105
109
  },
106
- J ? {
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 X(!1)
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 X(!0)
122
+ onSelect: () => void Q(!0)
119
123
  }
120
- ], Q = {
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
- }, ee = (e) => {
125
- let t = new URLSearchParams(N);
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 ? `${V.language(v.code)}?${n}` : V.language(v.code);
132
+ return n ? `${U.language(y.code)}?${n}` : U.language(y.code);
129
133
  }, $;
130
- return $ = W === "formats" ? /* @__PURE__ */ E(_, {
131
- language: v,
132
- onUpdate: S
133
- }) : W === "review" ? /* @__PURE__ */ E(h, {
134
- languages: H.languages,
135
- sourceName: K,
136
- onReviewed: H.coverage.reload,
137
- fixedLanguage: v.code
138
- }) : /* @__PURE__ */ E(y, {
139
- products: H.products,
140
- productsLoading: H.productsLoading,
141
- languageCode: v.code,
142
- languageName: v.name,
143
- sourceName: K,
144
- rtl: G,
145
- onSaved: H.coverage.reload
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: v.name,
153
- description: Y.join(" · "),
156
+ title: y.name,
157
+ description: Z.join(" · "),
154
158
  back: {
155
159
  label: w("i18n.v3.title", "Languages"),
156
- to: V.page
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: v,
164
- progress: U
167
+ language: y,
168
+ progress: G
165
169
  }),
166
- more: Z,
167
- moreLabel: w("i18n.v3.lang.moreFor", "More for {{name}}", { name: v.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: U,
171
- loading: q
174
+ progress: G,
175
+ loading: Y
172
176
  }),
173
177
  /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(j, {
174
- ariaLabel: v.name,
175
- activeId: W,
178
+ ariaLabel: y.name,
179
+ activeId: K,
176
180
  tabs: f(!1).map((e) => ({
177
181
  id: e,
178
- label: Q[e],
179
- href: ee(e),
180
- badge: e === "review" ? U?.waiting : void 0
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: v.code,
190
- name: v.name,
191
- nativeName: v.nativeName,
192
- direction: v.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 S({
208
+ return await C({
198
209
  name: e.name,
199
210
  nativeName: e.nativeName
200
- }), A({
211
+ }), O({
201
212
  title: w("i18n.v3.lang.saved", "Saved"),
202
213
  tone: "success"
203
- }), H.retry(), "saved";
214
+ }), W.retry(), "saved";
204
215
  } catch {
205
- return A({
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 = v(n), o = p(e);
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(S, {
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
- export { e as DATE_FORMATS, _ as LANGUAGE_TABS, h as PRODUCT_PARAM, t as TIME_FORMATS, x as canSaveLanguage, b as codeProblem, p as factsForCode, o as formatExample, s as formatOptions, g as pickProduct, y as readLanguageTab, v as shownLanguageTabs, m as translationIn };
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 };
@@ -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
- exportWords: string;
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>;
@@ -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 r(r) {
6
- let i = e(r, "languages");
4
+ var n = "addlanguage", r = "export", i = "lang";
5
+ function a(a) {
6
+ let o = e(a, "languages");
7
7
  return {
8
- page: i,
9
- tab: (e) => e === "languages" ? i : `${i}?tab=${e}`,
10
- review: (e) => `${i}?tab=review&${t}=${encodeURIComponent(e)}`,
11
- language: (t) => e(r, `languages/${encodeURIComponent(t)}`),
12
- addLanguage: `${i}?dialog=${n}`,
13
- importWords: e(r, "import"),
14
- exportWords: e(r, "export")
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 };
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-i18n",
3
- "version": "2026.1129.3",
3
+ "version": "2026.1129.4",
4
4
  "description": "Internationalization (i18n) micro-frontend module",
5
5
  "repository": {
6
6
  "type": "git",