@ayinza_dev/i18n-config 1.3.0 → 1.4.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.
package/dist/config.js CHANGED
@@ -32,6 +32,11 @@ const defaultConfig = {
32
32
  },
33
33
  react: {
34
34
  useSuspense: true,
35
+ // Remote catalogs are overlaid lazily (addResourceBundle) after the
36
+ // languageChanged re-render. Bind re-renders to store additions so a
37
+ // freshly-loaded locale paints on the first switch instead of requiring a
38
+ // second toggle.
39
+ bindI18nStore: "added",
35
40
  },
36
41
  };
37
42
  const mergeFormatters = (base, override) => {
@@ -90,6 +90,10 @@ export const handleNewTranslationKeys = async (options) => {
90
90
  const payload = {
91
91
  data: {
92
92
  translations,
93
+ // Tag every pushed key with the producer's category when configured so
94
+ // consumers can fetch a scoped catalog. Omitted entirely when unset to
95
+ // preserve the un-categorised (shared) default.
96
+ ...(pushConfig.category ? { category: pushConfig.category } : {}),
93
97
  },
94
98
  };
95
99
  if (dryRun) {
package/dist/types.d.ts CHANGED
@@ -101,6 +101,14 @@ export interface ParserPushConfig {
101
101
  portalName: string;
102
102
  /** Optional URL to send detected keys to. When omitted the helper only logs the payload. */
103
103
  pushUrl?: string;
104
+ /**
105
+ * Optional project/app id stored on every pushed key so a consumer can later
106
+ * fetch just its own catalog via `GET /translations/{locale}?category=<id>`.
107
+ * Each Ayinza portal passes its own id (e.g. `sseris-taxpayer-portal`) to keep
108
+ * catalogs isolated in the shared localization-service. Omit for an
109
+ * un-categorised (shared) catalog.
110
+ */
111
+ category?: string;
104
112
  /** Skips remote push and only logs keys. Useful for CI dry-runs. */
105
113
  dryRun?: boolean;
106
114
  /** Optional bearer token appended as an Authorization header. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayinza_dev/i18n-config",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",