@digitaldefiance/i18n-lib 4.3.1 → 4.4.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/README.md CHANGED
@@ -62,7 +62,7 @@ const text = engine.translateStringKey(MyBrandedKeys.Welcome, { name: 'Alice' })
62
62
  - **Type Safety**: Full TypeScript support with generic types
63
63
  - **Branded Enums**: Runtime-identifiable string keys with collision detection and component routing
64
64
  - **Error Handling**: Comprehensive error classes with translation support and ICU formatting
65
- - **93.22% Test Coverage**: 1,779 tests covering all features
65
+ - **93.22% Test Coverage**: 2,007 tests covering all features
66
66
  - **Security Hardened**: Comprehensive protection against prototype pollution, ReDoS, and XSS attacks
67
67
 
68
68
  ## Installation
@@ -1315,6 +1315,406 @@ function translateAnyValue<T extends string | number>(
1315
1315
  }
1316
1316
  ```
1317
1317
 
1318
+ ## Monorepo i18n-setup Guide
1319
+
1320
+ When building an application that consumes multiple Express Suite packages (e.g., `suite-core-lib`, `ecies-lib`), you need a single `i18n-setup.ts` file that initializes the engine, registers all components and their branded string key enums, sets up the global context, and exports translation helpers.
1321
+
1322
+ ### Recommended: Factory Approach (`createI18nSetup`)
1323
+
1324
+ The `createI18nSetup()` factory replaces ~200 lines of manual boilerplate with a single function call. It handles engine creation, core component registration, library component registration, branded enum registration, and context initialization automatically.
1325
+
1326
+ ```typescript
1327
+ // i18n-setup.ts — Application-level i18n initialization (factory approach)
1328
+
1329
+ import {
1330
+ createI18nSetup,
1331
+ createI18nStringKeys,
1332
+ LanguageCodes,
1333
+ } from '@digitaldefiance/i18n-lib';
1334
+ import { createSuiteCoreComponentPackage } from '@digitaldefiance/suite-core-lib';
1335
+ import { createEciesComponentPackage } from '@digitaldefiance/ecies-lib';
1336
+
1337
+ // 1. Define your application component
1338
+ export const AppComponentId = 'MyApp';
1339
+
1340
+ export const AppStringKey = createI18nStringKeys(AppComponentId, {
1341
+ SiteTitle: 'siteTitle',
1342
+ SiteDescription: 'siteDescription',
1343
+ WelcomeMessage: 'welcomeMessage',
1344
+ } as const);
1345
+
1346
+ const appStrings = {
1347
+ [LanguageCodes.EN_US]: {
1348
+ siteTitle: 'My Application',
1349
+ siteDescription: 'An Express Suite application',
1350
+ welcomeMessage: 'Welcome, {name}!',
1351
+ },
1352
+ [LanguageCodes.FR]: {
1353
+ siteTitle: 'Mon Application',
1354
+ siteDescription: 'Une application Express Suite',
1355
+ welcomeMessage: 'Bienvenue, {name} !',
1356
+ },
1357
+ };
1358
+
1359
+ // 2. Create the i18n setup — one call does everything
1360
+ const i18n = createI18nSetup({
1361
+ componentId: AppComponentId,
1362
+ stringKeyEnum: AppStringKey,
1363
+ strings: appStrings,
1364
+ aliases: ['AppStringKey'],
1365
+ libraryComponents: [
1366
+ createSuiteCoreComponentPackage(),
1367
+ createEciesComponentPackage(),
1368
+ ],
1369
+ });
1370
+
1371
+ // 3. Export the public API
1372
+ export const { engine: i18nEngine, translate, safeTranslate } = i18n;
1373
+ export const i18nContext = i18n.context;
1374
+ ```
1375
+
1376
+ The factory:
1377
+ - Creates or reuses an `I18nEngine` instance (idempotent via `instanceKey`, defaults to `'default'`)
1378
+ - Registers the Core i18n component automatically
1379
+ - Registers each library component's `ComponentConfig` and branded `stringKeyEnum` from the `I18nComponentPackage`
1380
+ - Registers your application component and its branded enum
1381
+ - Initializes `GlobalActiveContext` with the specified `defaultLanguage` (defaults to `'en-US'`)
1382
+ - Returns an `I18nSetupResult` with `engine`, `translate`, `safeTranslate`, `context`, `setLanguage`, `setAdminLanguage`, `setContext`, `getLanguage`, `getAdminLanguage`, and `reset`
1383
+
1384
+ Calling `createI18nSetup()` multiple times with the same `instanceKey` reuses the existing engine — safe for monorepos where a subset library and a superset API both call the factory.
1385
+
1386
+ ### I18nComponentPackage Interface
1387
+
1388
+ Library authors bundle a `ComponentConfig` with its branded string key enum in a single `I18nComponentPackage` object. This lets the factory auto-register both the component and its enum in one step.
1389
+
1390
+ ```typescript
1391
+ import type { AnyBrandedEnum } from '@digitaldefiance/branded-enum';
1392
+ import type { ComponentConfig } from '@digitaldefiance/i18n-lib';
1393
+
1394
+ interface I18nComponentPackage {
1395
+ readonly config: ComponentConfig;
1396
+ readonly stringKeyEnum?: AnyBrandedEnum;
1397
+ }
1398
+ ```
1399
+
1400
+ Each library exports a `createXxxComponentPackage()` function:
1401
+
1402
+ ```typescript
1403
+ // In suite-core-lib
1404
+ import { createSuiteCoreComponentPackage } from '@digitaldefiance/suite-core-lib';
1405
+ const pkg = createSuiteCoreComponentPackage();
1406
+ // pkg.config → SuiteCore ComponentConfig
1407
+ // pkg.stringKeyEnum → SuiteCoreStringKey branded enum
1408
+
1409
+ // In ecies-lib
1410
+ import { createEciesComponentPackage } from '@digitaldefiance/ecies-lib';
1411
+ const pkg = createEciesComponentPackage();
1412
+
1413
+ // In node-ecies-lib
1414
+ import { createNodeEciesComponentPackage } from '@digitaldefiance/node-ecies-lib';
1415
+ const pkg = createNodeEciesComponentPackage();
1416
+ ```
1417
+
1418
+ The existing `createSuiteCoreComponentConfig()` and `createEciesComponentConfig()` functions remain available for consumers that prefer the manual approach.
1419
+
1420
+ ### Browser-Safe Fallback
1421
+
1422
+ In browser environments, bundlers like Vite and webpack may create separate copies of `@digitaldefiance/branded-enum`, causing `isBrandedEnum()` to fail due to Symbol/WeakSet identity mismatch. This breaks `registerStringKeyEnum()` and `translateStringKey()`.
1423
+
1424
+ The engine now includes a transparent fallback: when the `StringKeyEnumRegistry` fails to resolve a component ID for a known string key value, the engine scans all registered components' string keys to find the matching component. The result is cached in a `ValueComponentLookupCache` for subsequent lookups, and the cache is invalidated whenever a new component is registered.
1425
+
1426
+ This means consumers do not need manual workarounds (like `safeRegisterStringKeyEnum` or `_componentLookup` maps) for bundler Symbol mismatch issues. Both `translateStringKey` and `safeTranslateStringKey` use the fallback automatically.
1427
+
1428
+ ### Advanced: Manual Setup
1429
+
1430
+ For advanced use cases where you need full control over engine creation, validation options, or custom registration order, you can use the manual approach:
1431
+
1432
+ <details>
1433
+ <summary>Click to expand manual i18n-setup.ts example</summary>
1434
+
1435
+ ```typescript
1436
+ // i18n-setup.ts — Manual approach (advanced)
1437
+
1438
+ import {
1439
+ I18nBuilder,
1440
+ I18nEngine,
1441
+ LanguageCodes,
1442
+ GlobalActiveContext,
1443
+ getCoreLanguageDefinitions,
1444
+ createCoreComponentRegistration,
1445
+ createI18nStringKeys,
1446
+ type CoreLanguageCode,
1447
+ type IActiveContext,
1448
+ type ComponentConfig,
1449
+ type LanguageContextSpace,
1450
+ } from '@digitaldefiance/i18n-lib';
1451
+ import type { BrandedEnumValue } from '@digitaldefiance/branded-enum';
1452
+ import {
1453
+ createSuiteCoreComponentConfig,
1454
+ SuiteCoreStringKey,
1455
+ } from '@digitaldefiance/suite-core-lib';
1456
+ import {
1457
+ createEciesComponentConfig,
1458
+ EciesStringKey,
1459
+ } from '@digitaldefiance/ecies-lib';
1460
+
1461
+ export const AppComponentId = 'MyApp';
1462
+
1463
+ export const AppStringKey = createI18nStringKeys(AppComponentId, {
1464
+ SiteTitle: 'siteTitle',
1465
+ SiteDescription: 'siteDescription',
1466
+ WelcomeMessage: 'welcomeMessage',
1467
+ } as const);
1468
+
1469
+ export type AppStringKeyValue = BrandedEnumValue<typeof AppStringKey>;
1470
+
1471
+ const appStrings: Record<string, Record<string, string>> = {
1472
+ [LanguageCodes.EN_US]: {
1473
+ siteTitle: 'My Application',
1474
+ siteDescription: 'An Express Suite application',
1475
+ welcomeMessage: 'Welcome, {name}!',
1476
+ },
1477
+ [LanguageCodes.FR]: {
1478
+ siteTitle: 'Mon Application',
1479
+ siteDescription: 'Une application Express Suite',
1480
+ welcomeMessage: 'Bienvenue, {name} !',
1481
+ },
1482
+ };
1483
+
1484
+ function createAppComponentConfig(): ComponentConfig {
1485
+ return { id: AppComponentId, strings: appStrings, aliases: ['AppStringKey'] };
1486
+ }
1487
+
1488
+ // Create or reuse engine
1489
+ let i18nEngine: I18nEngine;
1490
+ if (I18nEngine.hasInstance('default')) {
1491
+ i18nEngine = I18nEngine.getInstance('default');
1492
+ } else {
1493
+ i18nEngine = I18nBuilder.create()
1494
+ .withLanguages(getCoreLanguageDefinitions())
1495
+ .withDefaultLanguage(LanguageCodes.EN_US)
1496
+ .withFallbackLanguage(LanguageCodes.EN_US)
1497
+ .withInstanceKey('default')
1498
+ .build();
1499
+ }
1500
+
1501
+ // Register components
1502
+ const coreReg = createCoreComponentRegistration();
1503
+ i18nEngine.registerIfNotExists({
1504
+ id: coreReg.component.id,
1505
+ strings: coreReg.strings as Record<string, Record<string, string>>,
1506
+ });
1507
+ i18nEngine.registerIfNotExists(createSuiteCoreComponentConfig());
1508
+ i18nEngine.registerIfNotExists(createEciesComponentConfig());
1509
+ i18nEngine.registerIfNotExists(createAppComponentConfig());
1510
+
1511
+ // Register branded enums
1512
+ if (!i18nEngine.hasStringKeyEnum(SuiteCoreStringKey)) {
1513
+ i18nEngine.registerStringKeyEnum(SuiteCoreStringKey);
1514
+ }
1515
+ if (!i18nEngine.hasStringKeyEnum(EciesStringKey)) {
1516
+ i18nEngine.registerStringKeyEnum(EciesStringKey);
1517
+ }
1518
+ if (!i18nEngine.hasStringKeyEnum(AppStringKey)) {
1519
+ i18nEngine.registerStringKeyEnum(AppStringKey);
1520
+ }
1521
+
1522
+ // Initialize context
1523
+ const globalContext = GlobalActiveContext.getInstance<
1524
+ CoreLanguageCode,
1525
+ IActiveContext<CoreLanguageCode>
1526
+ >();
1527
+ globalContext.createContext(LanguageCodes.EN_US, LanguageCodes.EN_US, AppComponentId);
1528
+
1529
+ // Export helpers
1530
+ export { i18nEngine };
1531
+
1532
+ export const translate = (
1533
+ name: AppStringKeyValue,
1534
+ variables?: Record<string, string | number>,
1535
+ language?: CoreLanguageCode,
1536
+ context?: LanguageContextSpace,
1537
+ ): string => {
1538
+ const activeContext =
1539
+ context ?? globalContext.getContext(AppComponentId).currentContext;
1540
+ const lang =
1541
+ language ??
1542
+ (activeContext === 'admin'
1543
+ ? globalContext.getContext(AppComponentId).adminLanguage
1544
+ : globalContext.getContext(AppComponentId).language);
1545
+ return i18nEngine.translateStringKey(name, variables, lang);
1546
+ };
1547
+
1548
+ export const safeTranslate = (
1549
+ name: AppStringKeyValue,
1550
+ variables?: Record<string, string | number>,
1551
+ language?: CoreLanguageCode,
1552
+ context?: LanguageContextSpace,
1553
+ ): string => {
1554
+ const activeContext =
1555
+ context ?? globalContext.getContext(AppComponentId).currentContext;
1556
+ const lang =
1557
+ language ??
1558
+ (activeContext === 'admin'
1559
+ ? globalContext.getContext(AppComponentId).adminLanguage
1560
+ : globalContext.getContext(AppComponentId).language);
1561
+ return i18nEngine.safeTranslateStringKey(name, variables, lang);
1562
+ };
1563
+ ```
1564
+
1565
+ </details>
1566
+
1567
+ Key points for the manual approach:
1568
+
1569
+ - **Idempotent engine creation**: `I18nEngine.hasInstance('default')` checks for an existing engine before building a new one.
1570
+ - **Core component first**: Always register the Core component before other components — it provides error message translations used internally.
1571
+ - **`registerIfNotExists`**: All component registrations use the idempotent variant so multiple packages can safely register without conflicts.
1572
+ - **`hasStringKeyEnum` guard**: Prevents duplicate enum registration when multiple setup files run in the same process.
1573
+ - **Context-aware helpers**: The `translate` and `safeTranslate` functions resolve the active language from `GlobalActiveContext`, respecting user vs. admin context.
1574
+
1575
+ ### Migration Guide
1576
+
1577
+ Converting an existing manual `i18n-setup.ts` to the factory approach is straightforward. There are no breaking changes — the factory produces the same engine state as the manual approach.
1578
+
1579
+ #### Before (manual)
1580
+
1581
+ ```typescript
1582
+ import { I18nBuilder, I18nEngine, LanguageCodes, GlobalActiveContext, ... } from '@digitaldefiance/i18n-lib';
1583
+ import { createSuiteCoreComponentConfig, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
1584
+ import { createEciesComponentConfig, EciesStringKey } from '@digitaldefiance/ecies-lib';
1585
+
1586
+ // ~200 lines: engine creation, core registration, library registration,
1587
+ // enum registration, context initialization, translate helpers...
1588
+ ```
1589
+
1590
+ #### After (factory)
1591
+
1592
+ ```typescript
1593
+ import { createI18nSetup, createI18nStringKeys, LanguageCodes } from '@digitaldefiance/i18n-lib';
1594
+ import { createSuiteCoreComponentPackage } from '@digitaldefiance/suite-core-lib';
1595
+ import { createEciesComponentPackage } from '@digitaldefiance/ecies-lib';
1596
+
1597
+ const i18n = createI18nSetup({
1598
+ componentId: AppComponentId,
1599
+ stringKeyEnum: AppStringKey,
1600
+ strings: appStrings,
1601
+ libraryComponents: [
1602
+ createSuiteCoreComponentPackage(),
1603
+ createEciesComponentPackage(),
1604
+ ],
1605
+ });
1606
+
1607
+ export const { engine: i18nEngine, translate, safeTranslate } = i18n;
1608
+ ```
1609
+
1610
+ #### Migration steps
1611
+
1612
+ 1. Replace `createXxxComponentConfig` imports with `createXxxComponentPackage` imports
1613
+ 2. Replace manual engine creation (`I18nBuilder` / `I18nEngine.registerIfNotExists`) with `createI18nSetup()`
1614
+ 3. Move library component registrations into the `libraryComponents` array
1615
+ 4. Remove manual `registerStringKeyEnum` calls — the factory handles them
1616
+ 5. Remove manual `GlobalActiveContext` initialization — the factory handles it
1617
+ 6. Destructure the returned `I18nSetupResult` to get `engine`, `translate`, `safeTranslate`, etc.
1618
+
1619
+ #### Notes
1620
+
1621
+ - Existing `createXxxComponentConfig()` functions remain available for consumers that prefer the manual approach
1622
+ - The factory uses the same `registerIfNotExists` pattern internally, so it is safe to mix factory and manual consumers sharing the same engine instance
1623
+ - There are no breaking changes or behavioral differences between the manual and factory approaches
1624
+
1625
+ ### createI18nStringKeys vs createI18nStringKeysFromEnum
1626
+
1627
+ Both functions produce identical `BrandedStringKeys` output. Choose based on your starting point.
1628
+
1629
+ #### createI18nStringKeys — preferred for new code
1630
+
1631
+ Creates a branded enum directly from an `as const` object literal:
1632
+
1633
+ ```typescript
1634
+ import { createI18nStringKeys } from '@digitaldefiance/i18n-lib';
1635
+
1636
+ export const AppStringKey = createI18nStringKeys('my-app', {
1637
+ Welcome: 'welcome',
1638
+ Goodbye: 'goodbye',
1639
+ } as const);
1640
+ ```
1641
+
1642
+ Use this when writing a new component from scratch. The `as const` assertion preserves literal types so each key is fully type-safe.
1643
+
1644
+ #### createI18nStringKeysFromEnum — useful for migration
1645
+
1646
+ Wraps an existing TypeScript enum into a branded enum:
1647
+
1648
+ ```typescript
1649
+ import { createI18nStringKeysFromEnum } from '@digitaldefiance/i18n-lib';
1650
+
1651
+ // Existing traditional enum
1652
+ enum LegacyStringKeys {
1653
+ Welcome = 'welcome',
1654
+ Goodbye = 'goodbye',
1655
+ }
1656
+
1657
+ export const AppStringKey = createI18nStringKeysFromEnum(
1658
+ 'my-app',
1659
+ LegacyStringKeys,
1660
+ );
1661
+ ```
1662
+
1663
+ Use this when migrating code that already has a traditional `enum`. Internally, `createI18nStringKeysFromEnum` filters out TypeScript's reverse numeric mappings and then delegates to `createI18nStringKeys`.
1664
+
1665
+ #### Comparison
1666
+
1667
+ | Aspect | `createI18nStringKeys` | `createI18nStringKeysFromEnum` |
1668
+ |---|---|---|
1669
+ | Input | Object literal with `as const` | Existing TypeScript enum |
1670
+ | Use case | New code, fresh components | Migrating existing enum-based code |
1671
+ | Output | `BrandedStringKeys<T>` | `BrandedStringKeys<T>` |
1672
+ | Internal behavior | Calls `createBrandedEnum` directly | Filters reverse numeric mappings, then delegates to `createI18nStringKeys` |
1673
+
1674
+ ### Troubleshooting: Branded Enum Module Identity in Monorepos
1675
+
1676
+ #### Symptom
1677
+
1678
+ `registerStringKeyEnum()` throws or `hasStringKeyEnum()` returns `false` for a branded enum that was created with `createI18nStringKeys` or `createI18nStringKeysFromEnum`.
1679
+
1680
+ #### Root Cause
1681
+
1682
+ `isBrandedEnum()` returns `false` when the `@digitaldefiance/branded-enum` global registry holds a different module instance. This happens when multiple copies of the package are installed — each copy has its own `WeakSet` / `Symbol` registry, so enums created by one copy are not recognized by another.
1683
+
1684
+ #### Diagnosis
1685
+
1686
+ Check for duplicate installations:
1687
+
1688
+ ```bash
1689
+ # npm
1690
+ npm ls @digitaldefiance/branded-enum
1691
+
1692
+ # yarn
1693
+ yarn why @digitaldefiance/branded-enum
1694
+ ```
1695
+
1696
+ If you see more than one resolved version (or multiple paths), the registry is split.
1697
+
1698
+ #### Solutions
1699
+
1700
+ 1. **Single version via resolutions/overrides** — pin a single version in your root `package.json`:
1701
+
1702
+ ```jsonc
1703
+ // npm (package.json)
1704
+ "overrides": {
1705
+ "@digitaldefiance/branded-enum": "<version>"
1706
+ }
1707
+
1708
+ // yarn (package.json)
1709
+ "resolutions": {
1710
+ "@digitaldefiance/branded-enum": "<version>"
1711
+ }
1712
+ ```
1713
+
1714
+ 2. **Bundler deduplication** — if you use webpack, Rollup, or esbuild, ensure the `@digitaldefiance/branded-enum` module is resolved to a single path. For webpack, the `resolve.alias` or `resolve.dedupe` options can help.
1715
+
1716
+ 3. **Consistent package resolution** — in Nx or other monorepo tools, verify that all projects resolve the same physical copy. Running `nx graph` can help visualize dependency relationships.
1717
+
1318
1718
  ## Browser Support
1319
1719
 
1320
1720
  - Chrome/Edge: Latest 2 versions (minimum: Chrome 90, Edge 90)
@@ -1500,6 +1900,28 @@ Contributions welcome! Please:
1500
1900
 
1501
1901
  ## ChangeLog
1502
1902
 
1903
+ ### Version 4.4.0
1904
+
1905
+ **Factory-Based i18n Setup & Browser-Safe Fallback**
1906
+
1907
+ This release introduces `createI18nSetup()`, a factory function that replaces ~200 lines of boilerplate per consumer with a single function call. It also adds a browser-safe fallback for `translateStringKey` when bundler-duplicated packages break Symbol-based identity checks.
1908
+
1909
+ **New Features:**
1910
+
1911
+ - **`createI18nSetup()`**: Factory function that handles engine creation, core/library/app component registration, branded enum registration, and `GlobalActiveContext` initialization in one call
1912
+ - **`I18nComponentPackage`** interface: Bundles a `ComponentConfig` with its branded string key enum so the factory can auto-register both
1913
+ - **`I18nSetupConfig`** / **`I18nSetupResult`** interfaces: Typed config input and result output for the factory
1914
+ - **`createSuiteCoreComponentPackage()`**: New function in `suite-core-lib` returning an `I18nComponentPackage`
1915
+ - **`createEciesComponentPackage()`**: New function in `ecies-lib` returning an `I18nComponentPackage`
1916
+ - **`createNodeEciesComponentPackage()`**: New function in `node-ecies-lib` returning an `I18nComponentPackage`
1917
+ - **Browser-safe fallback**: `translateStringKey` and `safeTranslateStringKey` now fall back to scanning registered components when the `StringKeyEnumRegistry` fails (e.g., due to bundler Symbol mismatch), with a lazily-built `ValueComponentLookupCache` that invalidates on new component registration
1918
+ - **Updated starter template**: `express-suite-starter` scaffolding now uses `createI18nSetup()` for minimal boilerplate
1919
+
1920
+ **Backward Compatibility:**
1921
+
1922
+ - All existing APIs (`createSuiteCoreComponentConfig`, `createEciesComponentConfig`, `I18nBuilder`, manual registration) remain unchanged
1923
+ - The factory uses the same `registerIfNotExists` pattern internally, so factory and manual consumers can safely share the same engine instance
1924
+
1503
1925
  ### Version 4.3.0
1504
1926
 
1505
1927
  **String Key Enum Registration for Direct Translation**
@@ -2623,21 +3045,6 @@ const myEngine = PluginI18nEngine.createInstance<MyLanguageCodes>('custom', lang
2623
3045
 
2624
3046
  - Wed Sep 24 2025 15:20:07 GMT-0700 (Pacific Daylight Time)
2625
3047
  - Initial release of the TypeScript internationalization library with enum translation, template processing, context management, and currency formatting.
2626
- PluginI18nEngine.resetAll();
2627
- });
2628
-
2629
- afterEach(() => {
2630
- PluginI18nEngine.resetAll();
2631
- });
2632
-
2633
- it('should translate', () => {
2634
- const engine = PluginI18nEngine.createInstance('test', languages);
2635
- engine.registerComponent(registration);
2636
- expect(engine.translate('app', 'hello')).toBe('Hello');
2637
- });
2638
- });
2639
-
2640
- ```
2641
3048
 
2642
3049
  ## TypeScript Support
2643
3050
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/i18n-lib",
3
- "version": "4.3.1",
3
+ "version": "4.4.0",
4
4
  "description": "i18n library with enum translation support",
5
5
  "homepage": "https://github.com/Digital-Defiance/i18n-lib",
6
6
  "repository": {
@@ -19,6 +19,7 @@ export declare class I18nEngine implements II18nEngine {
19
19
  private readonly config;
20
20
  private readonly aliasToComponent;
21
21
  private readonly componentKeyLookup;
22
+ private valueComponentLookupCache;
22
23
  /**
23
24
  * Constructs an I18nEngine instance, registering languages, setting defaults,
24
25
  * and optionally registering and setting this instance as default.
@@ -53,6 +54,25 @@ export declare class I18nEngine implements II18nEngine {
53
54
  * @param config - Component configuration object.
54
55
  */
55
56
  private registerComponentMetadata;
57
+ /**
58
+ * Invalidates the value-to-component lookup cache.
59
+ * Called after component registration so new keys are discoverable.
60
+ */
61
+ private invalidateValueComponentLookupCache;
62
+ /**
63
+ * Builds a cache mapping string key values to component IDs
64
+ * by scanning all registered components.
65
+ */
66
+ private buildValueComponentLookupCache;
67
+ /**
68
+ * Resolves a string key value to its component ID, falling back to
69
+ * scanning registered components when the branded enum registry fails
70
+ * (e.g., due to bundler Symbol mismatch in browser environments).
71
+ * @param stringKeyValue - The string key value to resolve.
72
+ * @returns The component ID that owns this string key.
73
+ * @throws {I18nError} If the key is not found in any registered component.
74
+ */
75
+ private resolveComponentIdWithFallback;
56
76
  /**
57
77
  * Internal: Normalizes legacy keys into snake_case lowercased.
58
78
  * @param rawKey - The raw key string to normalize.
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-engine.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/i18n-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAkBvB;;;GAGG;AACH,qBAAa,UAAW,YAAW,WAAW;IAC5C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiC;IACzD,OAAO,CAAC,MAAM,CAAC,UAAU,CAAuB;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAa;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,c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OAAO,CAAC,EACnC,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM;IAeT;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAAgB,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO;IAIxD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,iBAAiB,IAAI,SAAS;QAC5B,OAAO,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;KACrB,EAAE;IAIH;;;OAGG;IACH,QAAQ,IAAI,gBAAgB;IAiB5B;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,MAAM,CAAC,EAAE,YAAY,GACpB,UAAU;IAQb;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,kBAAkB,EAAE,EACxC,MAAM,CAAC,EAAE,YAAY,GACpB,UAAU;IAOb;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU;IAS5C;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAKzC;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAS5C;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,IAAI;CAUxB"}
1
+ {"version":3,"file":"i18n-engine.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/i18n-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAkBvB;;;GAGG;AACH,qBAAa,U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AEG;IACH,MAAM,CAAC,QAAQ,IAAI,IAAI;CAUxB"}
@@ -31,6 +31,7 @@ class I18nEngine {
31
31
  config;
32
32
  aliasToComponent = new Map();
33
33
  componentKeyLookup = new Map();
34
+ valueComponentLookupCache = null;
34
35
  /**
35
36
  * Constructs an I18nEngine instance, registering languages, setting defaults,
36
37
  * and optionally registering and setting this instance as default.
@@ -87,7 +88,9 @@ class I18nEngine {
87
88
  register(config) {
88
89
  (0, validation_1.validateComponentId)(config.id);
89
90
  this.registerComponentMetadata(config);
90
- return this.componentStore.register(config);
91
+ const result = this.componentStore.register(config);
92
+ this.invalidateValueComponentLookupCache();
93
+ return result;
91
94
  }
92
95
  /**
93
96
  * Registers a component if not already registered.
@@ -155,6 +158,55 @@ class I18nEngine {
155
158
  });
156
159
  }
157
160
  }
161
+ /**
162
+ * Invalidates the value-to-component lookup cache.
163
+ * Called after component registration so new keys are discoverable.
164
+ */
165
+ invalidateValueComponentLookupCache() {
166
+ this.valueComponentLookupCache = null;
167
+ }
168
+ /**
169
+ * Builds a cache mapping string key values to component IDs
170
+ * by scanning all registered components.
171
+ */
172
+ buildValueComponentLookupCache() {
173
+ const cache = new Map();
174
+ for (const component of this.componentStore.getAll()) {
175
+ const firstLang = Object.keys(component.strings)[0];
176
+ if (firstLang) {
177
+ for (const key of Object.keys(component.strings[firstLang])) {
178
+ if (!cache.has(key)) {
179
+ cache.set(key, component.id);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ return cache;
185
+ }
186
+ /**
187
+ * Resolves a string key value to its component ID, falling back to
188
+ * scanning registered components when the branded enum registry fails
189
+ * (e.g., due to bundler Symbol mismatch in browser environments).
190
+ * @param stringKeyValue - The string key value to resolve.
191
+ * @returns The component ID that owns this string key.
192
+ * @throws {I18nError} If the key is not found in any registered component.
193
+ */
194
+ resolveComponentIdWithFallback(stringKeyValue) {
195
+ // Try registry first
196
+ const registryResult = this.stringKeyEnumRegistry.safeResolveComponentId(stringKeyValue);
197
+ if (registryResult !== null) {
198
+ return registryResult;
199
+ }
200
+ // Fallback: scan components via cache
201
+ if (!this.valueComponentLookupCache) {
202
+ this.valueComponentLookupCache = this.buildValueComponentLookupCache();
203
+ }
204
+ const fallbackResult = this.valueComponentLookupCache.get(stringKeyValue);
205
+ if (fallbackResult) {
206
+ return fallbackResult;
207
+ }
208
+ throw i18n_error_1.I18nError.stringKeyNotRegistered(stringKeyValue);
209
+ }
158
210
  /**
159
211
  * Internal: Normalizes legacy keys into snake_case lowercased.
160
212
  * @param rawKey - The raw key string to normalize.
@@ -688,7 +740,7 @@ class I18nEngine {
688
740
  * @see {@link safeTranslateStringKey} - Safe version that returns placeholder on failure
689
741
  */
690
742
  translateStringKey(stringKeyValue, variables, language) {
691
- const componentId = this.stringKeyEnumRegistry.resolveComponentId(stringKeyValue);
743
+ const componentId = this.resolveComponentIdWithFallback(stringKeyValue);
692
744
  return this.translate(componentId, stringKeyValue, variables, language);
693
745
  }
694
746
  /**
@@ -718,11 +770,13 @@ class I18nEngine {
718
770
  * @see {@link registerStringKeyEnum} - Register enums for translation
719
771
  */
720
772
  safeTranslateStringKey(stringKeyValue, variables, language) {
721
- const componentId = this.stringKeyEnumRegistry.safeResolveComponentId(stringKeyValue);
722
- if (!componentId) {
773
+ try {
774
+ const componentId = this.resolveComponentIdWithFallback(stringKeyValue);
775
+ return this.safeTranslate(componentId, stringKeyValue, variables, language);
776
+ }
777
+ catch {
723
778
  return `[unknown.${String(stringKeyValue)}]`;
724
779
  }
725
- return this.safeTranslate(componentId, stringKeyValue, variables, language);
726
780
  }
727
781
  /**
728
782
  * Checks if a branded string key enum is registered.
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-engine.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/i18n-engine.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AASH,4DAA2D;AAC3D,qDAAiD;AAQjD,gDAAiD;AACjD,sDAI8B;AAC9B,gDAA6C;AAC7C,oDAG6B;AAC7B,uDAA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a complete i18n setup from a config object.
3
+ * Replaces ~200 lines of boilerplate per consumer.
4
+ */
5
+ import type { AnyBrandedEnum } from '@digitaldefiance/branded-enum';
6
+ import type { I18nSetupConfig } from './interfaces/i18n-setup-config.interface';
7
+ import type { I18nSetupResult } from './interfaces/i18n-setup-result.interface';
8
+ export declare function createI18nSetup<TStringKeyEnum extends AnyBrandedEnum>(config: I18nSetupConfig & {
9
+ readonly stringKeyEnum: TStringKeyEnum;
10
+ }): I18nSetupResult<TStringKeyEnum>;
11
+ //# sourceMappingURL=create-i18n-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-i18n-setup.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/create-i18n-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,cAAc,EAEf,MAAM,+BAA+B,CAAC;AAQvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAIhF,wBAAgB,eAAe,CAAC,cAAc,SAAS,cAAc,EACnE,MAAM,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAA;CAAE,GACnE,eAAe,CAAC,cAAc,CAAC,CA+GjC"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * Factory function that creates a complete i18n setup from a config object.
4
+ * Replaces ~200 lines of boilerplate per consumer.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createI18nSetup = createI18nSetup;
8
+ const i18n_engine_1 = require("./core/i18n-engine");
9
+ const core_i18n_1 = require("./core-i18n");
10
+ const global_active_context_1 = require("./global-active-context");
11
+ const language_codes_1 = require("./language-codes");
12
+ function createI18nSetup(config) {
13
+ const instanceKey = config.instanceKey ?? 'default';
14
+ const defaultLanguage = config.defaultLanguage ?? language_codes_1.LanguageCodes.EN_US;
15
+ // 1. Create or reuse engine
16
+ const engine = i18n_engine_1.I18nEngine.registerIfNotExists(instanceKey, (0, core_i18n_1.createDefaultLanguages)(), {
17
+ defaultLanguage,
18
+ ...(config.constants ? { constants: config.constants } : {}),
19
+ });
20
+ // 2. Register core component
21
+ const coreReg = (0, core_i18n_1.createCoreComponentRegistration)();
22
+ engine.registerIfNotExists({
23
+ id: coreReg.component.id,
24
+ strings: coreReg.strings,
25
+ });
26
+ // 3. Register library components
27
+ if (config.libraryComponents) {
28
+ for (const pkg of config.libraryComponents) {
29
+ engine.registerIfNotExists(pkg.config);
30
+ if (pkg.stringKeyEnum && !engine.hasStringKeyEnum(pkg.stringKeyEnum)) {
31
+ engine.registerStringKeyEnum(pkg.stringKeyEnum);
32
+ }
33
+ }
34
+ }
35
+ // 4. Register app component
36
+ engine.registerIfNotExists({
37
+ id: config.componentId,
38
+ strings: config.strings,
39
+ aliases: config.aliases ? [...config.aliases] : undefined,
40
+ });
41
+ if (!engine.hasStringKeyEnum(config.stringKeyEnum)) {
42
+ engine.registerStringKeyEnum(config.stringKeyEnum);
43
+ }
44
+ // 5. Initialize GlobalActiveContext
45
+ const globalContext = global_active_context_1.GlobalActiveContext.getInstance();
46
+ try {
47
+ globalContext.getContext(config.componentId);
48
+ }
49
+ catch {
50
+ globalContext.createContext(defaultLanguage, defaultLanguage, config.componentId);
51
+ }
52
+ // 6. Build and return result
53
+ const getActiveContext = () => globalContext.getContext(config.componentId);
54
+ const translate = (key, variables, language, context) => {
55
+ const activeCtx = getActiveContext();
56
+ const activeContext = context ?? activeCtx.currentContext;
57
+ const lang = language ??
58
+ (activeContext === 'admin'
59
+ ? activeCtx.adminLanguage
60
+ : activeCtx.language);
61
+ return engine.translateStringKey(key, variables, lang);
62
+ };
63
+ const safeTranslate = (key, variables, language, context) => {
64
+ const activeCtx = getActiveContext();
65
+ const activeContext = context ?? activeCtx.currentContext;
66
+ const lang = language ??
67
+ (activeContext === 'admin'
68
+ ? activeCtx.adminLanguage
69
+ : activeCtx.language);
70
+ return engine.safeTranslateStringKey(key, variables, lang);
71
+ };
72
+ return {
73
+ engine,
74
+ translate,
75
+ safeTranslate,
76
+ get context() {
77
+ return getActiveContext();
78
+ },
79
+ setLanguage: (language) => globalContext.setUserLanguage(language, config.componentId),
80
+ setAdminLanguage: (language) => globalContext.setAdminLanguage(language, config.componentId),
81
+ setContext: (ctx) => globalContext.setLanguageContextSpace(ctx, config.componentId),
82
+ getLanguage: () => getActiveContext().language,
83
+ getAdminLanguage: () => getActiveContext().adminLanguage,
84
+ reset: () => {
85
+ i18n_engine_1.I18nEngine.removeInstance(instanceKey);
86
+ },
87
+ };
88
+ }
89
+ //# sourceMappingURL=create-i18n-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-i18n-setup.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/create-i18n-setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkBH,0CAiHC;AA7HD,oDAAgD;AAChD,2CAGqB;AACrB,mEAA8D;AAI9D,qDAAiD;AAGjD,SAAgB,eAAe,CAC7B,MAAoE;IAEpE,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,SAAS,CAAC;IACpD,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,8BAAa,CAAC,KAAK,CAAC;IAEtE,4BAA4B;IAC5B,MAAM,MAAM,GAAG,wBAAU,CAAC,mBAAmB,CAC3C,WAAW,EACX,IAAA,kCAAsB,GAAE,EACxB;QACE,eAAe;QACf,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7D,CACF,CAAC;IAEF,6BAA6B;IAC7B,MAAM,OAAO,GAAG,IAAA,2CAA+B,GAAE,CAAC;IAClD,MAAM,CAAC,mBAAmB,CAAC;QACzB,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE;QACx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EAAE,CAAC,GAAyB,EAAE,EAAE,CACxC,aAAa,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,CAAC;QAChE,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,QAAQ;QAC9C,gBAAgB,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,aAAa;QACxD,KAAK,EAAE,GAAG,EAAE;YACV,wBAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;KACF,CAAC;AACJ,CAAC"}
package/src/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export { I18nEngine as I18n } from './core/i18n-engine';
16
16
  export declare function resetAll(): void;
17
17
  export * from './branded-string-key';
18
18
  export * from './branded-enum-utils';
19
+ export { createI18nSetup } from './create-i18n-setup';
19
20
  export type { BrandedEnum, BrandedEnumValue, AnyBrandedEnum, } from '@digitaldefiance/branded-enum';
20
21
  export * from './active-context';
21
22
  export * from './component-definition';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,cAAc,CAAC;AAI7B,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACjE,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,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EACL,0BAA0B,IAAI,cAAc,EAC5C,0BAA0B,IAAI,oBAAoB,EAClD,wBAAwB,IAAI,kBAAkB,EAC9C,yBAAyB,IAAI,mBAAmB,GACjD,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGtE,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginI18n = exports.safeCoreTranslation = exports.getCoreTranslation = exports.createCoreI18nEngine = exports.createCoreI18n = exports.I18n = exports.Builder = exports.Timezone = exports.isValidTimezone = exports.getCurrencyFormat = exports.CurrencyCode = exports.createPluralString = exports.createGenderedString = void 0;
3
+ exports.PluginI18n = exports.safeCoreTranslation = exports.getCoreTranslation = exports.createCoreI18nEngine = exports.createCoreI18n = exports.createI18nSetup = exports.I18n = exports.Builder = exports.Timezone = exports.isValidTimezone = exports.getCurrencyFormat = exports.CurrencyCode = exports.createPluralString = exports.createGenderedString = void 0;
4
4
  exports.resetAll = resetAll;
5
5
  exports.resetAllI18nEngines = resetAllI18nEngines;
6
6
  const tslib_1 = require("tslib");
@@ -45,6 +45,9 @@ function resetAll() {
45
45
  tslib_1.__exportStar(require("./branded-string-key"), exports);
46
46
  // Branded enum utilities for detection and extraction
47
47
  tslib_1.__exportStar(require("./branded-enum-utils"), exports);
48
+ // Factory function for simplified i18n setup
49
+ var create_i18n_setup_1 = require("./create-i18n-setup");
50
+ Object.defineProperty(exports, "createI18nSetup", { enumerable: true, get: function () { return create_i18n_setup_1.createI18nSetup; } });
48
51
  // Legacy exports (deprecated - for backwards compatibility)
49
52
  tslib_1.__exportStar(require("./active-context"), exports);
50
53
  tslib_1.__exportStar(require("./component-definition"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/index.ts"],"names":[],"mappings":";;;AA0BA,4BAEC;AAkDD,kDAEC;;AAhFD,kCAAkC;AAClC,uBAAuB;AACvB,qDAA2B;AAC3B,iDAAuB;AACvB,mDAAyB;AACzB,mDAAyB;AACzB,uDAA6B;AAC7B,0DAAgC;AAChC,kDAAwB;AACxB,+DAAqC,CAAC,sBAAsB;AAC5D,kDAAwB;AACxB,yDAGgC,CAAC,6EAA6E;AAF5G,sHAAA,oBAAoB,OAAA;AACpB,oHAAA,kBAAkB,OAAA;AAEpB,6CAA6C;AAC7C,6CAAmE;AAA1D,wGAAA,YAAY,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AACxC,6CAA6D;AAApD,2GAAA,eAAe,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAClC,uDAA6B;AAC7B,2DAA2D;AAC3D,+DAA+D;AAC/D,sBAAsB;AACtB,wDAAiE;AAAxD,uGAAA,WAAW,OAAW;AAC/B,kDAAwD;AAA/C,mGAAA,UAAU,OAAQ;AAC3B,gBAAgB;AAChB,oDAAgD;AAChD,SAAgB,QAAQ;IACtB,wBAAU,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AACD,gFAAgF;AAChF,uCAAuC;AACvC,gFAAgF;AAChF,kEAAkE;AAClE,+DAAqC;AACrC,sDAAsD;AACtD,+DAAqC;AAOrC,4DAA4D;AAC5D,2DAAiC;AACjC,iEAAuC;AACvC,kEAAwC;AACxC,6FAA6F;AAC7F,mEAAyC;AACzC,+DAAqC;AACrC,+DAAqC;AACrC,sDAA4B;AAC5B,4DAAkC;AAClC,uEAA6C;AAC7C,0DAAgC;AAChC,kEAAwC;AACxC,gFAAsD;AACtD,2DAAiC;AACjC,+DAAqC;AACrC,4DAAkC;AAClC,2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;AACvC,gFAAgF;AAChF,kEAAkE;AAClE,+DAAqC;AACrC,sDAAsD;AACtD,+DAAqC;AACrC,6CAA6C;AAC7C,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AAOxB,4DAA4D;AAC5D,2DAAiC;AACjC,iEAAuC;AACvC,kEAAwC;AACxC,6FAA6F;AAC7F,mEAAyC;AACzC,+DAAqC;AACrC,+DAAqC;AACrC,sDAA4B;AAC5B,4DAAkC;AAClC,uEAA6C;AAC7C,0DAAgC;AAChC,kEAAwC;AACxC,gFAAsD;AACtD,2DAAiC;AACjC,+DAAqC;AACrC,4DAAkC;AAClC,2DAAiC;AACjC,gEAAsC;AACtC,qDAA2B;AAC3B,+DAAqC;AACrC,gEAAsC;AACtC,iEAAuC;AACvC,8DAAoC;AACpC,6BAA6B;AAC7B,6DAK+B;AAJ7B,qHAAA,0BAA0B,OAAkB;AAC5C,2HAAA,0BAA0B,OAAwB;AAClD,yHAAA,wBAAwB,OAAsB;AAC9C,0HAAA,yBAAyB,OAAuB;AAElD,uCAAuC;AACvC,gEAAsC;AACtC,2DAAsE;AAA7D,gHAAA,gBAAgB,OAAc;AACvC,2BAA2B;AAC3B,6DAAwD;AACxD,SAAgB,mBAAmB;IACjC,qCAAgB,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { AnyBrandedEnum } from '@digitaldefiance/branded-enum';
2
+ import type { ComponentConfig } from './component-config.interface';
3
+ /**
4
+ * Bundles a ComponentConfig with its optional branded string key enum.
5
+ * Library authors export functions returning this type so the factory
6
+ * can auto-register both the component and its enum in one step.
7
+ */
8
+ export interface I18nComponentPackage {
9
+ /** The component configuration for registration */
10
+ readonly config: ComponentConfig;
11
+ /** Optional branded string key enum for direct translateStringKey support */
12
+ readonly stringKeyEnum?: AnyBrandedEnum;
13
+ }
14
+ //# sourceMappingURL=i18n-component-package.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-component-package.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-component-package.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;CACzC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=i18n-component-package.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-component-package.interface.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-component-package.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import type { AnyBrandedEnum } from '@digitaldefiance/branded-enum';
2
+ import type { PluralString } from '../types/plural-types';
3
+ import type { I18nComponentPackage } from './i18n-component-package.interface';
4
+ /**
5
+ * Configuration for the createI18nSetup factory function.
6
+ */
7
+ export interface I18nSetupConfig {
8
+ /** Unique component ID for the application */
9
+ readonly componentId: string;
10
+ /** Branded string key enum for the application component */
11
+ readonly stringKeyEnum: AnyBrandedEnum;
12
+ /** Translation strings organized by language code, then by key */
13
+ readonly strings: Record<string, Record<string, string | PluralString>>;
14
+ /** Optional aliases for the application component */
15
+ readonly aliases?: readonly string[];
16
+ /** Optional constants to merge into the engine */
17
+ readonly constants?: Record<string, unknown>;
18
+ /** Library component packages to register before the app component */
19
+ readonly libraryComponents?: readonly I18nComponentPackage[];
20
+ /** Default language code (defaults to 'en-US') */
21
+ readonly defaultLanguage?: string;
22
+ /** Engine instance key (defaults to 'default') */
23
+ readonly instanceKey?: string;
24
+ }
25
+ //# sourceMappingURL=i18n-setup-config.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-setup-config.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-setup-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC;IACxE,qDAAqD;IACrD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,kDAAkD;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,sEAAsE;IACtE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC7D,kDAAkD;IAClD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,kDAAkD;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=i18n-setup-config.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-setup-config.interface.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-setup-config.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import type { AnyBrandedEnum, BrandedEnumValue } from '@digitaldefiance/branded-enum';
2
+ import type { LanguageContextSpace } from '../types';
3
+ import type { IActiveContext } from './active-context.interface';
4
+ import type { II18nEngine } from './i18n-engine.interface';
5
+ /**
6
+ * Return type of createI18nSetup. Contains everything a consumer needs
7
+ * for i18n: the engine, translate helpers, context, and language management.
8
+ */
9
+ export interface I18nSetupResult<TStringKeyEnum extends AnyBrandedEnum = AnyBrandedEnum> {
10
+ /** The I18nEngine instance */
11
+ readonly engine: II18nEngine;
12
+ /** Translate a branded string key value. Throws on missing translation. */
13
+ readonly translate: (key: BrandedEnumValue<TStringKeyEnum>, variables?: Record<string, string | number>, language?: string, context?: LanguageContextSpace) => string;
14
+ /** Safe translate — returns placeholder on failure, never throws. */
15
+ readonly safeTranslate: (key: BrandedEnumValue<TStringKeyEnum>, variables?: Record<string, string | number>, language?: string, context?: LanguageContextSpace) => string;
16
+ /** The active context for this setup */
17
+ readonly context: IActiveContext<string>;
18
+ /** Set the user-facing language */
19
+ readonly setLanguage: (language: string) => void;
20
+ /** Set the admin language */
21
+ readonly setAdminLanguage: (language: string) => void;
22
+ /** Set the language context space (user vs admin) */
23
+ readonly setContext: (context: LanguageContextSpace) => void;
24
+ /** Get the current user-facing language */
25
+ readonly getLanguage: () => string;
26
+ /** Get the current admin language */
27
+ readonly getAdminLanguage: () => string;
28
+ /** Reset the engine instance and context (useful for testing) */
29
+ readonly reset: () => void;
30
+ }
31
+ //# sourceMappingURL=i18n-setup-result.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-setup-result.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-setup-result.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EA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M,MAAM,CAAC;IACxC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=i18n-setup-result.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-setup-result.interface.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/i18n-setup-result.interface.ts"],"names":[],"mappings":""}
@@ -10,4 +10,7 @@ export type * from './i18n-engine.interface';
10
10
  export type * from './language-definition.interface';
11
11
  export type * from './translation-options.interface';
12
12
  export type * from './validation-result.interface';
13
+ export type * from './i18n-component-package.interface';
14
+ export type * from './i18n-setup-config.interface';
15
+ export type * from './i18n-setup-result.interface';
13
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,+BAA+B,CAAC;AACnD,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,+BAA+B,CAAC;AACnD,mBAAmB,+BAA+B,CAAC"}