@betteroffice/xlsx-i18n 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,523 @@
1
+ // en.json
2
+ var en_default = {
3
+ _lang: "en",
4
+ toolbar: {
5
+ actionsLabel: "Spreadsheet actions",
6
+ fileActionsLabel: "File actions",
7
+ historyLabel: "History",
8
+ formulaBarLabel: "Formula bar",
9
+ nameBoxPlaceholder: "Name box",
10
+ formulaPlaceholder: "Enter a value or formula",
11
+ save: "Save",
12
+ exportPng: "Export PNG",
13
+ undo: "Undo",
14
+ redo: "Redo"
15
+ },
16
+ editor: {
17
+ appLabel: "Spreadsheet editor",
18
+ demoCellText: "OpenOOXML xlsx",
19
+ openError: "Couldn't open this workbook",
20
+ sheetTabsLabel: "Sheets"
21
+ },
22
+ proposals: {
23
+ panelLabel: "Agent proposals",
24
+ empty: "No pending proposals",
25
+ cellCount: "{count, plural, one {# cell} other {# cells}}",
26
+ changeArrow: "→",
27
+ accept: "Accept",
28
+ reject: "Reject",
29
+ forceApply: "Force apply",
30
+ staleWarning: "Cells changed since proposed: {cells}"
31
+ },
32
+ a11y: {
33
+ gridLabel: "Spreadsheet grid",
34
+ rowHeaderLabel: "Row {row}",
35
+ columnHeaderLabel: "Column {column}",
36
+ cellLabel: "{address}, {value}",
37
+ cellLabelSelected: "{address}, {value}, selected",
38
+ emptyCellLabel: "{address}, empty",
39
+ emptyCellLabelSelected: "{address}, empty, selected"
40
+ }
41
+ };
42
+
43
+ // de.json
44
+ var de_default = {
45
+ _lang: "de",
46
+ toolbar: {
47
+ actionsLabel: null,
48
+ fileActionsLabel: null,
49
+ historyLabel: null,
50
+ formulaBarLabel: null,
51
+ nameBoxPlaceholder: null,
52
+ formulaPlaceholder: null,
53
+ save: null,
54
+ exportPng: null,
55
+ undo: null,
56
+ redo: null
57
+ },
58
+ editor: {
59
+ appLabel: null,
60
+ demoCellText: null,
61
+ openError: null,
62
+ sheetTabsLabel: null
63
+ },
64
+ proposals: {
65
+ panelLabel: null,
66
+ empty: null,
67
+ cellCount: null,
68
+ changeArrow: null,
69
+ accept: null,
70
+ reject: null,
71
+ forceApply: null,
72
+ staleWarning: null
73
+ },
74
+ a11y: {
75
+ gridLabel: null,
76
+ rowHeaderLabel: null,
77
+ columnHeaderLabel: null,
78
+ cellLabel: null,
79
+ cellLabelSelected: null,
80
+ emptyCellLabel: null,
81
+ emptyCellLabelSelected: null
82
+ }
83
+ };
84
+
85
+ // fr.json
86
+ var fr_default = {
87
+ _lang: "fr",
88
+ toolbar: {
89
+ actionsLabel: null,
90
+ fileActionsLabel: null,
91
+ historyLabel: null,
92
+ formulaBarLabel: null,
93
+ nameBoxPlaceholder: null,
94
+ formulaPlaceholder: null,
95
+ save: null,
96
+ exportPng: null,
97
+ undo: null,
98
+ redo: null
99
+ },
100
+ editor: {
101
+ appLabel: null,
102
+ demoCellText: null,
103
+ openError: null,
104
+ sheetTabsLabel: null
105
+ },
106
+ proposals: {
107
+ panelLabel: null,
108
+ empty: null,
109
+ cellCount: null,
110
+ changeArrow: null,
111
+ accept: null,
112
+ reject: null,
113
+ forceApply: null,
114
+ staleWarning: null
115
+ },
116
+ a11y: {
117
+ gridLabel: null,
118
+ rowHeaderLabel: null,
119
+ columnHeaderLabel: null,
120
+ cellLabel: null,
121
+ cellLabelSelected: null,
122
+ emptyCellLabel: null,
123
+ emptyCellLabelSelected: null
124
+ }
125
+ };
126
+
127
+ // he.json
128
+ var he_default = {
129
+ _lang: "he",
130
+ toolbar: {
131
+ actionsLabel: null,
132
+ fileActionsLabel: null,
133
+ historyLabel: null,
134
+ formulaBarLabel: null,
135
+ nameBoxPlaceholder: null,
136
+ formulaPlaceholder: null,
137
+ save: null,
138
+ exportPng: null,
139
+ undo: null,
140
+ redo: null
141
+ },
142
+ editor: {
143
+ appLabel: null,
144
+ demoCellText: null,
145
+ openError: null,
146
+ sheetTabsLabel: null
147
+ },
148
+ proposals: {
149
+ panelLabel: null,
150
+ empty: null,
151
+ cellCount: null,
152
+ changeArrow: null,
153
+ accept: null,
154
+ reject: null,
155
+ forceApply: null,
156
+ staleWarning: null
157
+ },
158
+ a11y: {
159
+ gridLabel: null,
160
+ rowHeaderLabel: null,
161
+ columnHeaderLabel: null,
162
+ cellLabel: null,
163
+ cellLabelSelected: null,
164
+ emptyCellLabel: null,
165
+ emptyCellLabelSelected: null
166
+ }
167
+ };
168
+
169
+ // hi.json
170
+ var hi_default = {
171
+ _lang: "hi",
172
+ toolbar: {
173
+ actionsLabel: null,
174
+ fileActionsLabel: null,
175
+ historyLabel: null,
176
+ formulaBarLabel: null,
177
+ nameBoxPlaceholder: null,
178
+ formulaPlaceholder: null,
179
+ save: null,
180
+ exportPng: null,
181
+ undo: null,
182
+ redo: null
183
+ },
184
+ editor: {
185
+ appLabel: null,
186
+ demoCellText: null,
187
+ openError: null,
188
+ sheetTabsLabel: null
189
+ },
190
+ proposals: {
191
+ panelLabel: null,
192
+ empty: null,
193
+ cellCount: null,
194
+ changeArrow: null,
195
+ accept: null,
196
+ reject: null,
197
+ forceApply: null,
198
+ staleWarning: null
199
+ },
200
+ a11y: {
201
+ gridLabel: null,
202
+ rowHeaderLabel: null,
203
+ columnHeaderLabel: null,
204
+ cellLabel: null,
205
+ cellLabelSelected: null,
206
+ emptyCellLabel: null,
207
+ emptyCellLabelSelected: null
208
+ }
209
+ };
210
+
211
+ // id.json
212
+ var id_default = {
213
+ _lang: "id",
214
+ toolbar: {
215
+ actionsLabel: null,
216
+ fileActionsLabel: null,
217
+ historyLabel: null,
218
+ formulaBarLabel: null,
219
+ nameBoxPlaceholder: null,
220
+ formulaPlaceholder: null,
221
+ save: null,
222
+ exportPng: null,
223
+ undo: null,
224
+ redo: null
225
+ },
226
+ editor: {
227
+ appLabel: null,
228
+ demoCellText: null,
229
+ openError: null,
230
+ sheetTabsLabel: null
231
+ },
232
+ proposals: {
233
+ panelLabel: null,
234
+ empty: null,
235
+ cellCount: null,
236
+ changeArrow: null,
237
+ accept: null,
238
+ reject: null,
239
+ forceApply: null,
240
+ staleWarning: null
241
+ },
242
+ a11y: {
243
+ gridLabel: null,
244
+ rowHeaderLabel: null,
245
+ columnHeaderLabel: null,
246
+ cellLabel: null,
247
+ cellLabelSelected: null,
248
+ emptyCellLabel: null,
249
+ emptyCellLabelSelected: null
250
+ }
251
+ };
252
+
253
+ // pl.json
254
+ var pl_default = {
255
+ _lang: "pl",
256
+ toolbar: {
257
+ actionsLabel: null,
258
+ fileActionsLabel: null,
259
+ historyLabel: null,
260
+ formulaBarLabel: null,
261
+ nameBoxPlaceholder: null,
262
+ formulaPlaceholder: null,
263
+ save: null,
264
+ exportPng: null,
265
+ undo: null,
266
+ redo: null
267
+ },
268
+ editor: {
269
+ appLabel: null,
270
+ demoCellText: null,
271
+ openError: null,
272
+ sheetTabsLabel: null
273
+ },
274
+ proposals: {
275
+ panelLabel: null,
276
+ empty: null,
277
+ cellCount: null,
278
+ changeArrow: null,
279
+ accept: null,
280
+ reject: null,
281
+ forceApply: null,
282
+ staleWarning: null
283
+ },
284
+ a11y: {
285
+ gridLabel: null,
286
+ rowHeaderLabel: null,
287
+ columnHeaderLabel: null,
288
+ cellLabel: null,
289
+ cellLabelSelected: null,
290
+ emptyCellLabel: null,
291
+ emptyCellLabelSelected: null
292
+ }
293
+ };
294
+
295
+ // pt-BR.json
296
+ var pt_BR_default = {
297
+ _lang: "pt-BR",
298
+ toolbar: {
299
+ actionsLabel: null,
300
+ fileActionsLabel: null,
301
+ historyLabel: null,
302
+ formulaBarLabel: null,
303
+ nameBoxPlaceholder: null,
304
+ formulaPlaceholder: null,
305
+ save: null,
306
+ exportPng: null,
307
+ undo: null,
308
+ redo: null
309
+ },
310
+ editor: {
311
+ appLabel: null,
312
+ demoCellText: null,
313
+ openError: null,
314
+ sheetTabsLabel: null
315
+ },
316
+ proposals: {
317
+ panelLabel: null,
318
+ empty: null,
319
+ cellCount: null,
320
+ changeArrow: null,
321
+ accept: null,
322
+ reject: null,
323
+ forceApply: null,
324
+ staleWarning: null
325
+ },
326
+ a11y: {
327
+ gridLabel: null,
328
+ rowHeaderLabel: null,
329
+ columnHeaderLabel: null,
330
+ cellLabel: null,
331
+ cellLabelSelected: null,
332
+ emptyCellLabel: null,
333
+ emptyCellLabelSelected: null
334
+ }
335
+ };
336
+
337
+ // tr.json
338
+ var tr_default = {
339
+ _lang: "tr",
340
+ toolbar: {
341
+ actionsLabel: null,
342
+ fileActionsLabel: null,
343
+ historyLabel: null,
344
+ formulaBarLabel: null,
345
+ nameBoxPlaceholder: null,
346
+ formulaPlaceholder: null,
347
+ save: null,
348
+ exportPng: null,
349
+ undo: null,
350
+ redo: null
351
+ },
352
+ editor: {
353
+ appLabel: null,
354
+ demoCellText: null,
355
+ openError: null,
356
+ sheetTabsLabel: null
357
+ },
358
+ proposals: {
359
+ panelLabel: null,
360
+ empty: null,
361
+ cellCount: null,
362
+ changeArrow: null,
363
+ accept: null,
364
+ reject: null,
365
+ forceApply: null,
366
+ staleWarning: null
367
+ },
368
+ a11y: {
369
+ gridLabel: null,
370
+ rowHeaderLabel: null,
371
+ columnHeaderLabel: null,
372
+ cellLabel: null,
373
+ cellLabelSelected: null,
374
+ emptyCellLabel: null,
375
+ emptyCellLabelSelected: null
376
+ }
377
+ };
378
+
379
+ // zh-CN.json
380
+ var zh_CN_default = {
381
+ _lang: "zh-CN",
382
+ toolbar: {
383
+ actionsLabel: null,
384
+ fileActionsLabel: null,
385
+ historyLabel: null,
386
+ formulaBarLabel: null,
387
+ nameBoxPlaceholder: null,
388
+ formulaPlaceholder: null,
389
+ save: null,
390
+ exportPng: null,
391
+ undo: null,
392
+ redo: null
393
+ },
394
+ editor: {
395
+ appLabel: null,
396
+ demoCellText: null,
397
+ openError: null,
398
+ sheetTabsLabel: null
399
+ },
400
+ proposals: {
401
+ panelLabel: null,
402
+ empty: null,
403
+ cellCount: null,
404
+ changeArrow: null,
405
+ accept: null,
406
+ reject: null,
407
+ forceApply: null,
408
+ staleWarning: null
409
+ },
410
+ a11y: {
411
+ gridLabel: null,
412
+ rowHeaderLabel: null,
413
+ columnHeaderLabel: null,
414
+ cellLabel: null,
415
+ cellLabelSelected: null,
416
+ emptyCellLabel: null,
417
+ emptyCellLabelSelected: null
418
+ }
419
+ };
420
+
421
+ // src/index.ts
422
+ var en = en_default;
423
+ var de = de_default;
424
+ var fr = fr_default;
425
+ var he = he_default;
426
+ var hi = hi_default;
427
+ var id = id_default;
428
+ var pl = pl_default;
429
+ var ptBR = pt_BR_default;
430
+ var tr = tr_default;
431
+ var zhCN = zh_CN_default;
432
+ var locales = {
433
+ en,
434
+ de,
435
+ fr,
436
+ he,
437
+ hi,
438
+ id,
439
+ pl,
440
+ "pt-BR": ptBR,
441
+ tr,
442
+ "zh-CN": zhCN
443
+ };
444
+ function isRecord(v) {
445
+ return v !== null && typeof v === "object" && !Array.isArray(v);
446
+ }
447
+ function deepMerge(base, override) {
448
+ if (!override) return base;
449
+ const result = { ...base };
450
+ for (const key of Object.keys(override)) {
451
+ const overVal = override[key];
452
+ if (overVal === null) continue;
453
+ if (isRecord(base[key]) && isRecord(overVal)) {
454
+ result[key] = deepMerge(base[key], overVal);
455
+ } else if (overVal !== void 0) {
456
+ result[key] = overVal;
457
+ }
458
+ }
459
+ return result;
460
+ }
461
+ function lookupKey(obj, path) {
462
+ let current = obj;
463
+ for (const part of path.split(".")) {
464
+ if (!isRecord(current)) return void 0;
465
+ current = current[part];
466
+ }
467
+ return typeof current === "string" ? current : void 0;
468
+ }
469
+ function parseBranches(branchStr) {
470
+ const parsed = {};
471
+ const regex = /(=\d+|\w+)\s*\{([^}]*)\}/g;
472
+ let match;
473
+ while ((match = regex.exec(branchStr)) !== null) {
474
+ parsed[match[1]] = match[2];
475
+ }
476
+ return parsed;
477
+ }
478
+ function formatMessage(template, vars, lang) {
479
+ if (!vars) return template;
480
+ const result = template.replace(
481
+ /\{(\w+),\s*plural,((?:[^{}]|\{[^{}]*\})*)\}/g,
482
+ (full, varName, branchStr) => {
483
+ const count = Number(vars[varName]);
484
+ if (isNaN(count)) return full;
485
+ const parsed = parseBranches(branchStr);
486
+ const exact = parsed[`=${count}`];
487
+ if (exact !== void 0) return exact.replace(/#/g, String(count));
488
+ let category;
489
+ try {
490
+ category = new Intl.PluralRules(lang || "en").select(count);
491
+ } catch {
492
+ category = count === 1 ? "one" : "other";
493
+ }
494
+ const text = parsed[category] ?? parsed["other"] ?? "";
495
+ return text.replace(/#/g, String(count));
496
+ }
497
+ );
498
+ return result.replace(/\{(\w+)\}/g, (_, key) => {
499
+ const val = vars[key];
500
+ return val !== void 0 ? String(val) : `{${key}}`;
501
+ });
502
+ }
503
+ function createT(strings, lang = "en") {
504
+ return (key, vars) => {
505
+ const value = lookupKey(strings, key);
506
+ return formatMessage(value ?? key, vars, lang);
507
+ };
508
+ }
509
+ export {
510
+ createT,
511
+ de,
512
+ deepMerge,
513
+ en,
514
+ fr,
515
+ he,
516
+ hi,
517
+ id,
518
+ locales,
519
+ pl,
520
+ ptBR,
521
+ tr,
522
+ zhCN
523
+ };
package/dist/pl.d.mts ADDED
@@ -0,0 +1,5 @@
1
+ import { PartialLocaleStrings } from './index.mjs';
2
+
3
+ declare const pl: PartialLocaleStrings;
4
+
5
+ export { pl as default, pl };
package/dist/pl.mjs ADDED
@@ -0,0 +1,49 @@
1
+ // pl.json
2
+ var pl_default = {
3
+ _lang: "pl",
4
+ toolbar: {
5
+ actionsLabel: null,
6
+ fileActionsLabel: null,
7
+ historyLabel: null,
8
+ formulaBarLabel: null,
9
+ nameBoxPlaceholder: null,
10
+ formulaPlaceholder: null,
11
+ save: null,
12
+ exportPng: null,
13
+ undo: null,
14
+ redo: null
15
+ },
16
+ editor: {
17
+ appLabel: null,
18
+ demoCellText: null,
19
+ openError: null,
20
+ sheetTabsLabel: null
21
+ },
22
+ proposals: {
23
+ panelLabel: null,
24
+ empty: null,
25
+ cellCount: null,
26
+ changeArrow: null,
27
+ accept: null,
28
+ reject: null,
29
+ forceApply: null,
30
+ staleWarning: null
31
+ },
32
+ a11y: {
33
+ gridLabel: null,
34
+ rowHeaderLabel: null,
35
+ columnHeaderLabel: null,
36
+ cellLabel: null,
37
+ cellLabelSelected: null,
38
+ emptyCellLabel: null,
39
+ emptyCellLabelSelected: null
40
+ }
41
+ };
42
+
43
+ // src/pl.ts
44
+ var pl = pl_default;
45
+ var pl_default2 = pl;
46
+ export {
47
+ pl_default2 as default,
48
+ pl
49
+ };
@@ -0,0 +1,5 @@
1
+ import { PartialLocaleStrings } from './index.mjs';
2
+
3
+ declare const ptBR: PartialLocaleStrings;
4
+
5
+ export { ptBR as default, ptBR };
package/dist/pt-BR.mjs ADDED
@@ -0,0 +1,49 @@
1
+ // pt-BR.json
2
+ var pt_BR_default = {
3
+ _lang: "pt-BR",
4
+ toolbar: {
5
+ actionsLabel: null,
6
+ fileActionsLabel: null,
7
+ historyLabel: null,
8
+ formulaBarLabel: null,
9
+ nameBoxPlaceholder: null,
10
+ formulaPlaceholder: null,
11
+ save: null,
12
+ exportPng: null,
13
+ undo: null,
14
+ redo: null
15
+ },
16
+ editor: {
17
+ appLabel: null,
18
+ demoCellText: null,
19
+ openError: null,
20
+ sheetTabsLabel: null
21
+ },
22
+ proposals: {
23
+ panelLabel: null,
24
+ empty: null,
25
+ cellCount: null,
26
+ changeArrow: null,
27
+ accept: null,
28
+ reject: null,
29
+ forceApply: null,
30
+ staleWarning: null
31
+ },
32
+ a11y: {
33
+ gridLabel: null,
34
+ rowHeaderLabel: null,
35
+ columnHeaderLabel: null,
36
+ cellLabel: null,
37
+ cellLabelSelected: null,
38
+ emptyCellLabel: null,
39
+ emptyCellLabelSelected: null
40
+ }
41
+ };
42
+
43
+ // src/pt-BR.ts
44
+ var ptBR = pt_BR_default;
45
+ var pt_BR_default2 = ptBR;
46
+ export {
47
+ pt_BR_default2 as default,
48
+ ptBR
49
+ };
package/dist/tr.d.mts ADDED
@@ -0,0 +1,5 @@
1
+ import { PartialLocaleStrings } from './index.mjs';
2
+
3
+ declare const tr: PartialLocaleStrings;
4
+
5
+ export { tr as default, tr };
package/dist/tr.mjs ADDED
@@ -0,0 +1,49 @@
1
+ // tr.json
2
+ var tr_default = {
3
+ _lang: "tr",
4
+ toolbar: {
5
+ actionsLabel: null,
6
+ fileActionsLabel: null,
7
+ historyLabel: null,
8
+ formulaBarLabel: null,
9
+ nameBoxPlaceholder: null,
10
+ formulaPlaceholder: null,
11
+ save: null,
12
+ exportPng: null,
13
+ undo: null,
14
+ redo: null
15
+ },
16
+ editor: {
17
+ appLabel: null,
18
+ demoCellText: null,
19
+ openError: null,
20
+ sheetTabsLabel: null
21
+ },
22
+ proposals: {
23
+ panelLabel: null,
24
+ empty: null,
25
+ cellCount: null,
26
+ changeArrow: null,
27
+ accept: null,
28
+ reject: null,
29
+ forceApply: null,
30
+ staleWarning: null
31
+ },
32
+ a11y: {
33
+ gridLabel: null,
34
+ rowHeaderLabel: null,
35
+ columnHeaderLabel: null,
36
+ cellLabel: null,
37
+ cellLabelSelected: null,
38
+ emptyCellLabel: null,
39
+ emptyCellLabelSelected: null
40
+ }
41
+ };
42
+
43
+ // src/tr.ts
44
+ var tr = tr_default;
45
+ var tr_default2 = tr;
46
+ export {
47
+ tr_default2 as default,
48
+ tr
49
+ };
@@ -0,0 +1,5 @@
1
+ import { PartialLocaleStrings } from './index.mjs';
2
+
3
+ declare const zhCN: PartialLocaleStrings;
4
+
5
+ export { zhCN as default, zhCN };