@object-ui/i18n 17.6.0 → 18.0.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/CHANGELOG.md +5408 -0
- package/README.md +255 -13
- package/dist/LocalizationContext.d.ts +32 -9
- package/dist/LocalizationContext.js +32 -10
- package/dist/builtinAggregateLabels.d.ts +40 -0
- package/dist/builtinAggregateLabels.js +23 -0
- package/dist/currency.d.ts +27 -3
- package/dist/currency.js +28 -4
- package/dist/fallbackInterpolation.d.ts +79 -0
- package/dist/fallbackInterpolation.js +124 -0
- package/dist/i18n.d.ts +27 -1
- package/dist/i18n.js +99 -16
- package/dist/index.d.ts +8 -13
- package/dist/index.js +45 -17
- package/dist/locales/ar.d.ts +1504 -188
- package/dist/locales/ar.js +1711 -281
- package/dist/locales/de.d.ts +1080 -188
- package/dist/locales/de.js +1248 -261
- package/dist/locales/en.d.ts +1141 -249
- package/dist/locales/en.js +1714 -295
- package/dist/locales/es.d.ts +1186 -188
- package/dist/locales/es.js +1350 -255
- package/dist/locales/fr.d.ts +1186 -188
- package/dist/locales/fr.js +1351 -258
- package/dist/locales/index.d.ts +11940 -2033
- package/dist/locales/index.js +48 -9
- package/dist/locales/ja.d.ts +1080 -188
- package/dist/locales/ja.js +1240 -254
- package/dist/locales/ko.d.ts +1080 -188
- package/dist/locales/ko.js +1244 -258
- package/dist/locales/pt.d.ts +1186 -188
- package/dist/locales/pt.js +1350 -255
- package/dist/locales/registry.d.ts +102 -0
- package/dist/locales/registry.js +220 -0
- package/dist/locales/rtl.d.ts +24 -0
- package/dist/locales/rtl.js +26 -0
- package/dist/locales/ru.d.ts +1292 -188
- package/dist/locales/ru.js +1479 -272
- package/dist/locales/zh.d.ts +1144 -252
- package/dist/locales/zh.js +1245 -259
- package/dist/pickLocalized.d.ts +30 -0
- package/dist/pickLocalized.js +39 -0
- package/dist/provider.d.ts +101 -12
- package/dist/provider.js +335 -50
- package/dist/translateFn.d.ts +29 -0
- package/dist/translateFn.js +8 -0
- package/dist/useDisplayLocale.d.ts +11 -0
- package/dist/useDisplayLocale.js +11 -0
- package/dist/useObjectLabel.d.ts +143 -100
- package/dist/useObjectLabel.js +129 -82
- package/dist/useSafeTranslation.js +40 -42
- package/dist/utils/first-day-of-week.d.ts +71 -0
- package/dist/utils/first-day-of-week.js +61 -0
- package/dist/utils/formatting.d.ts +23 -1
- package/dist/utils/formatting.js +34 -5
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/spec-formatters.d.ts +13 -23
- package/dist/utils/spec-formatters.js +41 -2
- package/dist/utils/spec-translations.d.ts +16 -3
- package/dist/utils/spec-translations.js +52 -13
- package/package.json +12 -6
package/dist/locales/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @object-ui/i18n - Locale index
|
|
3
|
-
*
|
|
2
|
+
* @object-ui/i18n - Locale index — the explicit ALL TEN door.
|
|
3
|
+
*
|
|
4
|
+
* ⛔ This module is NOT reachable from the package entry any more
|
|
5
|
+
* (objectui#7479). Importing it pulls every catalogue this package ships —
|
|
6
|
+
* ~1.8 MB raw / ~450 KB gzipped — which is exactly the eager payload that card
|
|
7
|
+
* removed from the console. The entry exposes `en` plus
|
|
8
|
+
* `loadBuiltInLocale()` instead; see `./registry.js`.
|
|
9
|
+
*
|
|
10
|
+
* What it is still for, and the only two things it is for:
|
|
11
|
+
*
|
|
12
|
+
* - the parity / drift suites, which must compare all ten packs at once and
|
|
13
|
+
* run in Node, where a megabyte of translations costs nobody anything;
|
|
14
|
+
* - an app that deliberately wants every catalogue resident, which reaches it
|
|
15
|
+
* through the published `@object-ui/i18n/locales` subpath — a specifier
|
|
16
|
+
* that says what it costs.
|
|
17
|
+
*
|
|
18
|
+
* ⚠️ Anything on a page-load path belongs on `./registry.js`, not here.
|
|
4
19
|
*/
|
|
5
20
|
export { default as en } from './en.js';
|
|
6
21
|
export { default as zh } from './zh.js';
|
|
@@ -26,13 +41,37 @@ import pt from './pt.js';
|
|
|
26
41
|
import ru from './ru.js';
|
|
27
42
|
import ar from './ar.js';
|
|
28
43
|
export const builtInLocales = { en, zh, ja, ko, de, fr, es, pt, ru, ar };
|
|
44
|
+
// Direction and the lazy registry live in payload-free modules so the runtime
|
|
45
|
+
// can reach them without reaching the ten packs above. Re-exported here so the
|
|
46
|
+
// historical import path keeps answering.
|
|
47
|
+
export { RTL_LANGUAGES, isRTL } from './rtl.js';
|
|
48
|
+
export { BUILT_IN_LANGUAGE_CODES, DEFAULT_BUILT_IN_LANGUAGE, getLoadedBuiltInLocales, isBuiltInLanguage, isBuiltInLocaleLoaded, loadBuiltInLocale, } from './registry.js';
|
|
49
|
+
import { registerBuiltInLocale } from './registry.js';
|
|
29
50
|
/**
|
|
30
|
-
*
|
|
51
|
+
* Make every catalogue this module holds RESIDENT — synchronously, and without
|
|
52
|
+
* a single `import()`.
|
|
53
|
+
*
|
|
54
|
+
* ⛔ Deliberately a CALL and not an import-time side effect: this package
|
|
55
|
+
* declares `"sideEffects": false`, and a module that registered on import would
|
|
56
|
+
* make that declaration false for every consumer's bundler. A caller that wants
|
|
57
|
+
* all ten resident says so.
|
|
58
|
+
*
|
|
59
|
+
* Who calls it:
|
|
60
|
+
*
|
|
61
|
+
* - a test that renders in a non-`en` locale and asserts SYNCHRONOUSLY. One
|
|
62
|
+
* line at module scope, next to the import that already paid for these ten
|
|
63
|
+
* modules, is the shape AGENTS.md prescribes for a cost that belongs in the
|
|
64
|
+
* import phase — ⛔ never a `beforeAll`, which is bounded by `hookTimeout`
|
|
65
|
+
* and only moves the race;
|
|
66
|
+
* - an app that deliberately ships every language resident and wants no
|
|
67
|
+
* fetch at switch time.
|
|
68
|
+
*
|
|
69
|
+
* ⚠️ It is NOT how a normal app boots. Calling it costs the whole ~1.8 MB of
|
|
70
|
+
* catalogues on the page-load path, which is the payload objectui#7479 removed.
|
|
71
|
+
* `preloadBootstrapLocale()` — one catalogue, the active one — is that path.
|
|
31
72
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export function isRTL(lang) {
|
|
37
|
-
return RTL_LANGUAGES.includes(lang);
|
|
73
|
+
export function registerBuiltInLocales() {
|
|
74
|
+
for (const [code, catalogue] of Object.entries(builtInLocales)) {
|
|
75
|
+
registerBuiltInLocale(code, catalogue);
|
|
76
|
+
}
|
|
38
77
|
}
|