@docx-editor.dev/i18n 2.21.1 → 2.23.0
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/README.md +11 -20
- package/dist/de.js +378 -255
- package/dist/de.mjs +378 -255
- package/dist/en.js +124 -1
- package/dist/en.mjs +124 -1
- package/dist/es.d.mts +33 -0
- package/dist/es.d.ts +33 -0
- package/dist/es.js +1079 -0
- package/dist/es.mjs +1052 -0
- package/dist/fr.js +389 -266
- package/dist/fr.mjs +389 -266
- package/dist/he.js +422 -299
- package/dist/he.mjs +422 -299
- package/dist/hi.js +377 -254
- package/dist/hi.mjs +377 -254
- package/dist/id.js +400 -277
- package/dist/id.mjs +400 -277
- package/dist/index.d.mts +143 -4
- package/dist/index.d.ts +143 -4
- package/dist/index.js +4682 -2401
- package/dist/index.mjs +4680 -2401
- package/dist/pl.js +383 -260
- package/dist/pl.mjs +383 -260
- package/dist/pt-BR.js +385 -262
- package/dist/pt-BR.mjs +385 -262
- package/dist/tr.js +392 -269
- package/dist/tr.mjs +392 -269
- package/dist/zh-CN.js +381 -258
- package/dist/zh-CN.mjs +381 -258
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
# @docx-editor.dev/i18n
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Translate [docx-editor.dev](https://docx-editor.dev) controls with locale strings, types, and runtime helpers. The package provides eleven languages and falls back to English for missing translations.
|
|
18
18
|
|
|
19
19
|
## Quick start
|
|
20
20
|
|
|
@@ -28,12 +28,14 @@ Pass a locale to the editor. This example requires the React adapter and its eng
|
|
|
28
28
|
|
|
29
29
|
```tsx
|
|
30
30
|
import { DocxEditor } from '@docx-editor.dev/react';
|
|
31
|
-
import {
|
|
31
|
+
import { es } from '@docx-editor.dev/i18n';
|
|
32
32
|
|
|
33
|
-
<DocxEditor document={bytes} i18n={
|
|
33
|
+
<DocxEditor document={bytes} i18n={es} locale="es-ES" />;
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
The `i18n` prop translates controls. Set `locale` separately for regional date input and generated document labels. It defaults to `en-US`.
|
|
37
|
+
|
|
38
|
+
To share a locale across editors and custom controls, use `LocaleProvider`:
|
|
37
39
|
|
|
38
40
|
```tsx
|
|
39
41
|
import { DocxEditor, LocaleProvider } from '@docx-editor.dev/react';
|
|
@@ -44,7 +46,7 @@ import { de } from '@docx-editor.dev/i18n';
|
|
|
44
46
|
</LocaleProvider>;
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
Custom controls read the same catalog through `useTranslation()`.
|
|
48
50
|
|
|
49
51
|
Mix a community locale with custom overrides:
|
|
50
52
|
|
|
@@ -57,19 +59,7 @@ const myLocale = {
|
|
|
57
59
|
};
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Packages
|
|
63
|
-
|
|
64
|
-
| Package | Description |
|
|
65
|
-
| --- | --- |
|
|
66
|
-
| [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react) | React adapter. `<DocxEditor>`, provider primitives, hooks, and compound chrome. |
|
|
67
|
-
| [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) | Framework-agnostic engine: OOXML read/write, canonical document tree, layout, paint. |
|
|
68
|
-
| [`@docx-editor.dev/i18n`](https://www.npmjs.com/package/@docx-editor.dev/i18n) | Shared locale strings and types. |
|
|
69
|
-
| [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) | Tracked changes, comments, and custom nodes. |
|
|
70
|
-
| [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) | A supported subset of the Word Office.js API for server and browser editing. |
|
|
71
|
-
|
|
72
|
-
If you fork an adapter, keep `@docx-editor.dev/core` as a peer dependency to receive engine fixes.
|
|
62
|
+
Missing or `null` keys keep the inherited catalog value. Without an outer `LocaleProvider`, they fall back to English.
|
|
73
63
|
|
|
74
64
|
## Available locales
|
|
75
65
|
|
|
@@ -77,6 +67,7 @@ If you fork an adapter, keep `@docx-editor.dev/core` as a peer dependency to rec
|
|
|
77
67
|
| ------- | ------ | ------------------- |
|
|
78
68
|
| `en` | `en` | English (source) |
|
|
79
69
|
| `de` | `de` | German |
|
|
70
|
+
| `es` | `es` | Spanish |
|
|
80
71
|
| `fr` | `fr` | French |
|
|
81
72
|
| `he` | `he` | Hebrew |
|
|
82
73
|
| `hi` | `hi` | Hindi |
|
|
@@ -96,7 +87,7 @@ import { locales } from '@docx-editor.dev/i18n';
|
|
|
96
87
|
</LocaleProvider>;
|
|
97
88
|
```
|
|
98
89
|
|
|
99
|
-
|
|
90
|
+
Importing `locales` includes every locale in your bundle. Import individual locales to reduce the bundle size.
|
|
100
91
|
|
|
101
92
|
## Per-locale subpaths
|
|
102
93
|
|
|
@@ -113,7 +104,7 @@ For on-demand loading, use a dynamic import instead:
|
|
|
113
104
|
const pl = (await import('@docx-editor.dev/i18n/pl')).default;
|
|
114
105
|
```
|
|
115
106
|
|
|
116
|
-
Subpaths ship for every locale: `/en`, `/de`, `/fr`, `/he`, `/hi`, `/id`, `/pl`, `/pt-BR`, `/tr`, `/zh-CN`. Each also exports its locale as a named binding (`import { pl } from '@docx-editor.dev/i18n/pl'`) for callers that prefer non-default imports.
|
|
107
|
+
Subpaths ship for every locale: `/en`, `/de`, `/es`, `/fr`, `/he`, `/hi`, `/id`, `/pl`, `/pt-BR`, `/tr`, `/zh-CN`. Each also exports its locale as a named binding (`import { pl } from '@docx-editor.dev/i18n/pl'`) for callers that prefer non-default imports.
|
|
117
108
|
|
|
118
109
|
## Types
|
|
119
110
|
|