@object-ui/i18n 17.3.0 → 17.5.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +1295 -1
  2. package/README.md +0 -13
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.js +11 -1
  5. package/dist/locales/ar.d.ts +466 -107
  6. package/dist/locales/ar.js +559 -153
  7. package/dist/locales/de.d.ts +466 -107
  8. package/dist/locales/de.js +574 -175
  9. package/dist/locales/en.d.ts +502 -143
  10. package/dist/locales/en.js +678 -145
  11. package/dist/locales/es.d.ts +466 -107
  12. package/dist/locales/es.js +553 -155
  13. package/dist/locales/fr.d.ts +466 -107
  14. package/dist/locales/fr.js +553 -152
  15. package/dist/locales/index.d.ts +4734 -1144
  16. package/dist/locales/ja.d.ts +466 -107
  17. package/dist/locales/ja.js +545 -146
  18. package/dist/locales/ko.d.ts +466 -107
  19. package/dist/locales/ko.js +551 -153
  20. package/dist/locales/pt.d.ts +466 -107
  21. package/dist/locales/pt.js +552 -154
  22. package/dist/locales/ru.d.ts +466 -107
  23. package/dist/locales/ru.js +563 -153
  24. package/dist/locales/zh.d.ts +501 -142
  25. package/dist/locales/zh.js +542 -142
  26. package/dist/pickLocalized.d.ts +21 -0
  27. package/dist/pickLocalized.js +40 -7
  28. package/dist/provider.d.ts +83 -1
  29. package/dist/provider.js +303 -29
  30. package/dist/useDisplayLocale.d.ts +49 -0
  31. package/dist/useDisplayLocale.js +55 -0
  32. package/dist/useObjectLabel.d.ts +8 -2
  33. package/dist/useObjectLabel.js +28 -8
  34. package/dist/useSafeTranslation.js +50 -2
  35. package/dist/utils/index.d.ts +1 -0
  36. package/dist/utils/index.js +1 -0
  37. package/dist/utils/number-display.d.ts +32 -0
  38. package/dist/utils/number-display.js +32 -0
  39. package/dist/utils/spec-formatters.d.ts +39 -13
  40. package/dist/utils/spec-formatters.js +3 -3
  41. package/package.json +4 -3
package/README.md CHANGED
@@ -21,7 +21,6 @@ npm install @object-ui/i18n
21
21
 
22
22
  **Peer Dependencies:**
23
23
  - `react` ^18.0.0 || ^19.0.0
24
- - `react-dom` ^18.0.0 || ^19.0.0
25
24
 
26
25
  ## Quick Start
27
26
 
@@ -136,20 +135,8 @@ isRTL('ar'); // true
136
135
  isRTL('en'); // false
137
136
  ```
138
137
 
139
- <!-- release-metadata:v3.3.0 -->
140
-
141
- ## Compatibility
142
-
143
- - **React:** 18.x or 19.x
144
- - **Node.js:** ≥ 18
145
- - **TypeScript:** ≥ 5.0 (strict mode)
146
- - **`@objectstack/spec`:** ^3.3.0
147
- - **`@objectstack/client`:** ^3.3.0
148
- - **Tailwind CSS:** ≥ 3.4 (for packages with UI)
149
-
150
138
  ## Links
151
139
 
152
- - 📚 [Documentation](https://www.objectui.org/docs/packages/i18n)
153
140
  - 📦 [npm package](https://www.npmjs.com/package/@object-ui/i18n)
154
141
  - 📝 [Changelog](./CHANGELOG.md)
155
142
  - 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@
31
31
  * @packageDocumentation
32
32
  */
33
33
  export { createI18n, getDirection, getAvailableLanguages, type I18nConfig, type TranslationKeys } from './i18n';
34
- export { I18nProvider, useObjectTranslation, useI18nContext, LOCALE_STORAGE_KEY, readStoredLanguage, type I18nProviderProps, } from './provider';
34
+ export { I18nProvider, useObjectTranslation, useI18nContext, LOCALE_STORAGE_KEY, readStoredLanguage, LOCALE_SEED_STORAGE_KEY, readCachedLanguageSeed, cacheLanguageSeed, type I18nProviderProps, } from './provider';
35
35
  export { createSafeTranslation, useSafeTranslate } from './useSafeTranslation';
36
36
  export { useObjectLabel, useSafeFieldLabel } from './useObjectLabel';
37
37
  export { builtInLocales, isRTL, RTL_LANGUAGES } from './locales/index';
@@ -51,3 +51,5 @@ export { isSpecTranslationData, transformSpecTranslations, type SpecTranslationD
51
51
  export { pickLocalized } from './pickLocalized';
52
52
  export { LocalizationProvider, useLocalization, type LocalizationValue } from './LocalizationContext';
53
53
  export { resolveFieldCurrency } from './currency';
54
+ export { useDisplayLocale } from './useDisplayLocale';
55
+ export { formatDisplayNumber, shouldGroupDisplayNumber, type DisplayNumberFormatOptions, } from './utils/index';
package/dist/index.js CHANGED
@@ -36,7 +36,12 @@ export { createI18n, getDirection, getAvailableLanguages } from './i18n';
36
36
  export { I18nProvider, useObjectTranslation, useI18nContext,
37
37
  // Language-preference persistence: the key the provider writes, and the
38
38
  // reader apps that bring their own i18next instance need to honour it.
39
- LOCALE_STORAGE_KEY, readStoredLanguage, } from './provider';
39
+ LOCALE_STORAGE_KEY, readStoredLanguage,
40
+ // Tenant locale seed (objectui#4035) — a SEPARATE slot from the explicit
41
+ // choice above, and never a substitute for it. An app that fetches its
42
+ // tenant's server-side locale caches it here; the provider applies it at
43
+ // bootstrap only when the user has chosen nothing themselves.
44
+ LOCALE_SEED_STORAGE_KEY, readCachedLanguageSeed, cacheLanguageSeed, } from './provider';
40
45
  // Safe translation hook factory
41
46
  export { createSafeTranslation, useSafeTranslate } from './useSafeTranslation';
42
47
  // Convention-based object/field label i18n
@@ -64,3 +69,8 @@ export { isSpecTranslationData, transformSpecTranslations, } from './utils/index
64
69
  export { pickLocalized } from './pickLocalized';
65
70
  export { LocalizationProvider, useLocalization } from './LocalizationContext';
66
71
  export { resolveFieldCurrency } from './currency';
72
+ // The one number-display formatter (objectui#4033) and the locale it formats
73
+ // in. Every field cell / widget / metric renderer goes through this pair —
74
+ // see `utils/number-display.ts` for the grouping policy and its interim status.
75
+ export { useDisplayLocale } from './useDisplayLocale';
76
+ export { formatDisplayNumber, shouldGroupDisplayNumber, } from './utils/index';