@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 CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  # @docx-editor.dev/i18n
16
16
 
17
- Locale strings, types, and runtime helpers for the [docx-editor.dev](https://docx-editor.dev) editor chrome. Ten languages, with per-key fallback to English.
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 { de } from '@docx-editor.dev/i18n';
31
+ import { es } from '@docx-editor.dev/i18n';
32
32
 
33
- <DocxEditor document={bytes} i18n={de} />;
33
+ <DocxEditor document={bytes} i18n={es} locale="es-ES" />;
34
34
  ```
35
35
 
36
- For several editors, or for chrome parts you compose yourself, put it in context once with `LocaleProvider` instead:
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
- Chrome you write yourself reads the same catalog through `useTranslation()`.
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
- Keys set to `null` in any locale fall back to English.
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
- > Importing `locales` pulls every locale into your bundle. For a smaller bundle, import only the ones you need by name; `sideEffects: false` lets the rest tree-shake.
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