@burdenoff/microfe-planmagnet 2026.829.1 → 2026.830.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTr.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useTr.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,KAAK,IAAI,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,
|
|
1
|
+
{"version":3,"file":"useTr.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useTr.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,KAAK,IAAI,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAUV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/shared/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from
|
|
1
|
+
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/shared/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { interpolate } from '../utils/i18n';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n return interpolate(raw, params);\n },\n [t]\n );\n}\n"],"mappings":";;;;AAcA,SAAgB,IAIJ;CACV,IAAM,EAAE,SAAM,GAAS;AACvB,QAAO,GACJ,GAAa,GAAkB,MAAqD;EACnF,IAAM,IAAa,EAAE,EAAI;AAEzB,SAAO,EADK,MAAe,IAAM,IAAW,GACpB,EAAO;IAEjC,CAAC,EAAE,CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/i18n.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/i18n.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAM9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":[],"sources":["../../../src/shared/utils/i18n.ts"],"sourcesContent":["/**\n * Interpolate placeholders of the form {{key}} in a translation string.\n */\nexport function interpolate(
|
|
1
|
+
{"version":3,"file":"i18n.js","names":[],"sources":["../../../src/shared/utils/i18n.ts"],"sourcesContent":["/**\n * Interpolate placeholders of the form {{key}} in a translation string.\n */\nexport function interpolate(template: string, params?: Record<string, string | number>): string {\n if (!params) return template;\n return Object.entries(params).reduce(\n (str, [key, value]) => str.replace(new RegExp(`\\\\{\\\\{${key}\\\\}\\\\}`, 'g'), String(value)),\n template\n );\n}\n"],"mappings":";AAGA,SAAgB,EAAY,GAAkB,GAAkD;AAE9F,QADK,IACE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAK,CAAC,GAAK,OAAW,EAAI,QAAY,OAAO,SAAS,EAAI,SAAS,IAAI,EAAE,OAAO,EAAM,CAAC,EACxF,EACD,GAJmB"}
|