@srimandir/common 2.9.0 → 2.10.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.
@@ -11,8 +11,18 @@ export interface I18nProviderProps<Locale extends string = string> {
11
11
  * Builds a locale-scoped `I18nProvider`/`useI18n` pair for a product package's
12
12
  * own translation dictionary. Each call produces an isolated context, so
13
13
  * packages don't share state — only the plumbing is shared.
14
+ *
15
+ * `defaultLocale` — when given, a key missing (or blank) in the active
16
+ * locale falls back to that locale's own value, since a translation
17
+ * dictionary is rarely complete for every locale from day one (a key just
18
+ * added for English, say, ahead of its Hindi copy) and showing the
19
+ * base-language copy reads far better than showing the raw key or a blank
20
+ * string. If the key is missing or blank there too, `t` returns `''` rather
21
+ * than the key itself — a raw i18n key is never valid copy to show a user,
22
+ * and some slots (see e.g. `landingOnlinePujaBodyPrefix`) are legitimately
23
+ * blank in every locale by design.
14
24
  */
15
- export declare function createI18n<Locale extends string>(translations: Record<Locale, Record<string, string>>): {
25
+ export declare function createI18n<Locale extends string>(translations: Record<Locale, Record<string, string>>, defaultLocale?: Locale): {
16
26
  I18nProvider: React.FC<I18nProviderProps<Locale>>;
17
27
  useI18n: () => I18nContextValue<Locale> | null;
18
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srimandir/common",
3
- "version": "2.9.0",
3
+ "version": "2.10.1",
4
4
  "description": "Generic, product-agnostic UI primitives (bottom sheet, buttons, modals) shared across the Srimandir packages",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -54,5 +54,5 @@
54
54
  "react"
55
55
  ],
56
56
  "license": "MIT",
57
- "gitHead": "db15adae6b21768f028df7e5797d6e44b19c743c"
57
+ "gitHead": "81c4c747666ecd12d042bde2bacd8b14d2b322c4"
58
58
  }