@betteroffice/xlsx-i18n 0.3.0 → 0.5.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/LICENSE +1 -1
- package/README.md +30 -19
- package/dist/en.mjs +14 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +14 -0
- package/package.json +4 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026 The OpenOOXML
|
|
189
|
+
Copyright 2026 Elia Hilse, The OpenOOXML Project
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @betteroffice/xlsx-i18n
|
|
2
2
|
|
|
3
|
-
UI
|
|
4
|
-
[`@betteroffice/xlsx-react`](https://www.npmjs.com/package/@betteroffice/xlsx-react)
|
|
5
|
-
|
|
3
|
+
UI strings, locale types and translation helpers for the
|
|
4
|
+
[`@betteroffice/xlsx-react`](https://www.npmjs.com/package/@betteroffice/xlsx-react) editor. `en` defines
|
|
5
|
+
the strings; the other locales override them.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
bun add @betteroffice/xlsx-i18n
|
|
@@ -10,39 +12,48 @@ bun add @betteroffice/xlsx-i18n
|
|
|
10
12
|
|
|
11
13
|
## Usage
|
|
12
14
|
|
|
13
|
-
Pass a
|
|
15
|
+
Pass a locale to the editor's `i18n` prop:
|
|
14
16
|
|
|
15
17
|
```tsx
|
|
16
18
|
import { de } from '@betteroffice/xlsx-i18n';
|
|
17
19
|
import { XlsxEditor } from '@betteroffice/xlsx-react';
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
export function Editor({ file }: { file: Uint8Array }) {
|
|
22
|
+
return <XlsxEditor file={file} i18n={de} />;
|
|
23
|
+
}
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
Keys
|
|
26
|
+
Override individual strings by spreading a locale. Keys that are missing or `null` fall back to
|
|
27
|
+
English.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const custom = { ...de, toolbar: { ...de.toolbar, save: 'Sichern' } };
|
|
31
|
+
```
|
|
23
32
|
|
|
24
33
|
## Locales
|
|
25
34
|
|
|
26
|
-
`en` (source), `de`, `fr`, `he`, `hi`, `id`, `pl`, `pt-BR`, `tr
|
|
27
|
-
|
|
35
|
+
`en` (source), `de`, `fr`, `he`, `hi`, `id`, `pl`, `pt-BR`, `tr` and `zh-CN`. The
|
|
36
|
+
exports for `pt-BR` and `zh-CN` are `ptBR` and `zhCN`.
|
|
28
37
|
|
|
29
|
-
Each locale also
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
every locale into the bundle).
|
|
38
|
+
Each locale is also its own subpath, for example `@betteroffice/xlsx-i18n/pl`, so an app that picks
|
|
39
|
+
the locale at runtime can load only the one it needs. `locales` maps every tag to its strings and
|
|
40
|
+
bundles all of them.
|
|
33
41
|
|
|
34
|
-
##
|
|
42
|
+
## Helpers
|
|
35
43
|
|
|
36
|
-
The package exports `LocaleStrings`, `PartialLocaleStrings`, `Translations`,
|
|
37
|
-
`TranslationKey`, `LocaleCode
|
|
38
|
-
|
|
44
|
+
The package exports the types `LocaleStrings`, `PartialLocaleStrings`, `Translations`,
|
|
45
|
+
`TranslationKey`, `LocaleCode` and `TFunction`, and the functions `createT` and `deepMerge`.
|
|
46
|
+
Outside React, build a typed `t()` directly:
|
|
39
47
|
|
|
40
48
|
```ts
|
|
41
49
|
import { createT, deepMerge, en, de, type LocaleStrings } from '@betteroffice/xlsx-i18n';
|
|
42
50
|
|
|
43
51
|
const t = createT(deepMerge(en, de) as LocaleStrings, 'de');
|
|
44
|
-
t('toolbar.save');
|
|
52
|
+
t('toolbar.save'); // 'Save'
|
|
45
53
|
```
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
- [JavaScript guide](https://docs.betteroffice.dev/docs/javascript)
|
|
58
|
+
- [`@betteroffice/xlsx-react`](https://www.npmjs.com/package/@betteroffice/xlsx-react)
|
|
59
|
+
- [Changelog](https://github.com/openooxml/betteroffice/blob/main/packages/xlsx-i18n/CHANGELOG.md)
|
package/dist/en.mjs
CHANGED
|
@@ -35,6 +35,7 @@ var en_default = {
|
|
|
35
35
|
groups: {
|
|
36
36
|
search: "Search",
|
|
37
37
|
history: "History",
|
|
38
|
+
file: "File",
|
|
38
39
|
print: "Print",
|
|
39
40
|
paintFormat: "Paint format",
|
|
40
41
|
zoom: "Zoom",
|
|
@@ -153,8 +154,21 @@ var en_default = {
|
|
|
153
154
|
appLabel: "Spreadsheet editor",
|
|
154
155
|
demoCellText: "OpenOOXML xlsx",
|
|
155
156
|
openError: "Couldn't open this workbook",
|
|
157
|
+
openErrorDescription: "The file may be damaged, or it uses something this editor can't read yet.",
|
|
158
|
+
stoppedError: "The editor ran into a problem",
|
|
159
|
+
stoppedErrorDescription: "Reopen the workbook to keep editing.",
|
|
160
|
+
loadError: "The editor couldn't load",
|
|
161
|
+
loadErrorDescription: "Check your connection, then reload the page.",
|
|
162
|
+
reloadPage: "Reload page",
|
|
163
|
+
showDetails: "Show details",
|
|
164
|
+
openPrompt: "Open an XLSX file",
|
|
156
165
|
sheetTabsLabel: "Sheets"
|
|
157
166
|
},
|
|
167
|
+
presence: {
|
|
168
|
+
label: "Collaborators",
|
|
169
|
+
unavailableSheet: "Unavailable sheet",
|
|
170
|
+
peerOnSheet: "{name} ({sheet})"
|
|
171
|
+
},
|
|
158
172
|
proposals: {
|
|
159
173
|
panelLabel: "Agent proposals",
|
|
160
174
|
empty: "No pending proposals",
|
package/dist/index.d.mts
CHANGED
|
@@ -42,6 +42,7 @@ declare const en: {
|
|
|
42
42
|
groups: {
|
|
43
43
|
search: string;
|
|
44
44
|
history: string;
|
|
45
|
+
file: string;
|
|
45
46
|
print: string;
|
|
46
47
|
paintFormat: string;
|
|
47
48
|
zoom: string;
|
|
@@ -160,8 +161,21 @@ declare const en: {
|
|
|
160
161
|
appLabel: string;
|
|
161
162
|
demoCellText: string;
|
|
162
163
|
openError: string;
|
|
164
|
+
openErrorDescription: string;
|
|
165
|
+
stoppedError: string;
|
|
166
|
+
stoppedErrorDescription: string;
|
|
167
|
+
loadError: string;
|
|
168
|
+
loadErrorDescription: string;
|
|
169
|
+
reloadPage: string;
|
|
170
|
+
showDetails: string;
|
|
171
|
+
openPrompt: string;
|
|
163
172
|
sheetTabsLabel: string;
|
|
164
173
|
};
|
|
174
|
+
presence: {
|
|
175
|
+
label: string;
|
|
176
|
+
unavailableSheet: string;
|
|
177
|
+
peerOnSheet: string;
|
|
178
|
+
};
|
|
165
179
|
proposals: {
|
|
166
180
|
panelLabel: string;
|
|
167
181
|
empty: string;
|
package/dist/index.mjs
CHANGED
|
@@ -35,6 +35,7 @@ var en_default = {
|
|
|
35
35
|
groups: {
|
|
36
36
|
search: "Search",
|
|
37
37
|
history: "History",
|
|
38
|
+
file: "File",
|
|
38
39
|
print: "Print",
|
|
39
40
|
paintFormat: "Paint format",
|
|
40
41
|
zoom: "Zoom",
|
|
@@ -153,8 +154,21 @@ var en_default = {
|
|
|
153
154
|
appLabel: "Spreadsheet editor",
|
|
154
155
|
demoCellText: "OpenOOXML xlsx",
|
|
155
156
|
openError: "Couldn't open this workbook",
|
|
157
|
+
openErrorDescription: "The file may be damaged, or it uses something this editor can't read yet.",
|
|
158
|
+
stoppedError: "The editor ran into a problem",
|
|
159
|
+
stoppedErrorDescription: "Reopen the workbook to keep editing.",
|
|
160
|
+
loadError: "The editor couldn't load",
|
|
161
|
+
loadErrorDescription: "Check your connection, then reload the page.",
|
|
162
|
+
reloadPage: "Reload page",
|
|
163
|
+
showDetails: "Show details",
|
|
164
|
+
openPrompt: "Open an XLSX file",
|
|
156
165
|
sheetTabsLabel: "Sheets"
|
|
157
166
|
},
|
|
167
|
+
presence: {
|
|
168
|
+
label: "Collaborators",
|
|
169
|
+
unavailableSheet: "Unavailable sheet",
|
|
170
|
+
peerOnSheet: "{name} ({sheet})"
|
|
171
|
+
},
|
|
158
172
|
proposals: {
|
|
159
173
|
panelLabel: "Agent proposals",
|
|
160
174
|
empty: "No pending proposals",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betteroffice/xlsx-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Shared UI locale strings and types for the @betteroffice/xlsx React editor.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -80,6 +80,9 @@
|
|
|
80
80
|
"url": "https://github.com/openooxml/betteroffice.git",
|
|
81
81
|
"directory": "packages/xlsx-i18n"
|
|
82
82
|
},
|
|
83
|
+
"bugs": {
|
|
84
|
+
"url": "https://github.com/openooxml/betteroffice/issues"
|
|
85
|
+
},
|
|
83
86
|
"publishConfig": {
|
|
84
87
|
"access": "public"
|
|
85
88
|
}
|