@digitaldefiance/i18n-lib 3.0.0 → 3.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 (62) hide show
  1. package/README.md +125 -0
  2. package/package.json +1 -1
  3. package/src/icu/ast.d.ts +48 -0
  4. package/src/icu/ast.d.ts.map +1 -0
  5. package/src/icu/ast.js +16 -0
  6. package/src/icu/ast.js.map +1 -0
  7. package/src/icu/compiler.d.ts +16 -0
  8. package/src/icu/compiler.d.ts.map +1 -0
  9. package/src/icu/compiler.js +81 -0
  10. package/src/icu/compiler.js.map +1 -0
  11. package/src/icu/formatter-registry.d.ts +10 -0
  12. package/src/icu/formatter-registry.d.ts.map +1 -0
  13. package/src/icu/formatter-registry.js +34 -0
  14. package/src/icu/formatter-registry.js.map +1 -0
  15. package/src/icu/formatters/base-formatter.d.ts +8 -0
  16. package/src/icu/formatters/base-formatter.d.ts.map +1 -0
  17. package/src/icu/formatters/base-formatter.js +3 -0
  18. package/src/icu/formatters/base-formatter.js.map +1 -0
  19. package/src/icu/formatters/date-formatter.d.ts +5 -0
  20. package/src/icu/formatters/date-formatter.d.ts.map +1 -0
  21. package/src/icu/formatters/date-formatter.js +31 -0
  22. package/src/icu/formatters/date-formatter.js.map +1 -0
  23. package/src/icu/formatters/number-formatter.d.ts +5 -0
  24. package/src/icu/formatters/number-formatter.d.ts.map +1 -0
  25. package/src/icu/formatters/number-formatter.js +30 -0
  26. package/src/icu/formatters/number-formatter.js.map +1 -0
  27. package/src/icu/formatters/plural-formatter.d.ts +5 -0
  28. package/src/icu/formatters/plural-formatter.d.ts.map +1 -0
  29. package/src/icu/formatters/plural-formatter.js +15 -0
  30. package/src/icu/formatters/plural-formatter.js.map +1 -0
  31. package/src/icu/formatters/select-formatter.d.ts +5 -0
  32. package/src/icu/formatters/select-formatter.d.ts.map +1 -0
  33. package/src/icu/formatters/select-formatter.js +10 -0
  34. package/src/icu/formatters/select-formatter.js.map +1 -0
  35. package/src/icu/formatters/selectordinal-formatter.d.ts +5 -0
  36. package/src/icu/formatters/selectordinal-formatter.d.ts.map +1 -0
  37. package/src/icu/formatters/selectordinal-formatter.js +22 -0
  38. package/src/icu/formatters/selectordinal-formatter.js.map +1 -0
  39. package/src/icu/formatters/time-formatter.d.ts +5 -0
  40. package/src/icu/formatters/time-formatter.d.ts.map +1 -0
  41. package/src/icu/formatters/time-formatter.js +31 -0
  42. package/src/icu/formatters/time-formatter.js.map +1 -0
  43. package/src/icu/helpers.d.ts +9 -0
  44. package/src/icu/helpers.d.ts.map +1 -0
  45. package/src/icu/helpers.js +31 -0
  46. package/src/icu/helpers.js.map +1 -0
  47. package/src/icu/parser.d.ts +29 -0
  48. package/src/icu/parser.d.ts.map +1 -0
  49. package/src/icu/parser.js +194 -0
  50. package/src/icu/parser.js.map +1 -0
  51. package/src/icu/runtime.d.ts +10 -0
  52. package/src/icu/runtime.d.ts.map +1 -0
  53. package/src/icu/runtime.js +28 -0
  54. package/src/icu/runtime.js.map +1 -0
  55. package/src/icu/tokenizer.d.ts +37 -0
  56. package/src/icu/tokenizer.d.ts.map +1 -0
  57. package/src/icu/tokenizer.js +187 -0
  58. package/src/icu/tokenizer.js.map +1 -0
  59. package/src/icu/validator.d.ts +11 -0
  60. package/src/icu/validator.d.ts.map +1 -0
  61. package/src/icu/validator.js +140 -0
  62. package/src/icu/validator.js.map +1 -0
package/README.md CHANGED
@@ -6,6 +6,7 @@ Part of [Express Suite](https://github.com/Digital-Defiance/express-suite)
6
6
 
7
7
  ## Features
8
8
 
9
+ - **ICU MessageFormat**: Industry-standard message formatting with plural, select, date/time/number formatting
9
10
  - **Component-Based Architecture**: Register translation components with full type safety
10
11
  - **37 Supported Languages**: CLDR-compliant plural rules for world's most complex languages
11
12
  - **Pluralization Support**: Automatic plural form selection based on count (one/few/many/other)
@@ -92,6 +93,69 @@ console.log(engine.translate('cart', 'items', { count: 5 }));
92
93
  // Output: "5 items"
93
94
  ```
94
95
 
96
+ ## ICU MessageFormat
97
+
98
+ Industry-standard message formatting with powerful features. See [@docs/ICU_MESSAGEFORMAT.md](../../docs/ICU_MESSAGEFORMAT.md) for complete guide.
99
+
100
+ ### Quick Example
101
+
102
+ ```typescript
103
+ import { formatICUMessage } from '@digitaldefiance/i18n-lib';
104
+
105
+ // Simple variable
106
+ formatICUMessage('Hello {name}', { name: 'Alice' });
107
+ // → "Hello Alice"
108
+
109
+ // Plural
110
+ formatICUMessage('{count, plural, one {# item} other {# items}}', { count: 1 });
111
+ // → "1 item"
112
+
113
+ // Select
114
+ formatICUMessage('{gender, select, male {He} female {She} other {They}}', { gender: 'male' });
115
+ // → "He"
116
+
117
+ // Number formatting
118
+ formatICUMessage('{price, number, currency}', { price: 99.99 }, 'en-US');
119
+ // → "$99.99"
120
+
121
+ // Complex nested
122
+ formatICUMessage(
123
+ '{gender, select, male {He has} female {She has}} {count, plural, one {# item} other {# items}}',
124
+ { gender: 'female', count: 2 }
125
+ );
126
+ // → "She has 2 items"
127
+ ```
128
+
129
+ ### Features
130
+
131
+ - ✅ **Full ICU Syntax**: Variables, plural, select, selectordinal
132
+ - ✅ **Formatters**: Number (integer, currency, percent), Date, Time
133
+ - ✅ **37 Languages**: CLDR plural rules for all supported languages
134
+ - ✅ **Nested Messages**: Up to 4 levels deep
135
+ - ✅ **Performance**: <1ms per format, message caching
136
+ - ✅ **Specification Compliant**: Unicode ICU, CLDR, FormatJS compatible
137
+
138
+ ### Documentation
139
+
140
+ - **[@docs/ICU_MESSAGEFORMAT.md](../../docs/ICU_MESSAGEFORMAT.md)** - Complete guide with syntax reference and examples
141
+ - **[@docs/ICU_COMPREHENSIVE_VALIDATION.md](../../docs/ICU_COMPREHENSIVE_VALIDATION.md)** - Validation report with test coverage
142
+ - **[@docs/ICU_PROJECT_COMPLETE.md](../../docs/ICU_PROJECT_COMPLETE.md)** - Implementation summary
143
+
144
+ ### API
145
+
146
+ ```typescript
147
+ import {
148
+ formatICUMessage, // One-line formatting
149
+ isICUMessage, // Detect ICU format
150
+ parseICUMessage, // Parse to AST
151
+ compileICUMessage, // Compile to function
152
+ validateICUMessage, // Validate syntax
153
+ Runtime // Advanced usage
154
+ } from '@digitaldefiance/i18n-lib';
155
+ ```
156
+
157
+ ---
158
+
95
159
  ## Pluralization & Gender
96
160
 
97
161
  ### Pluralization
@@ -694,6 +758,67 @@ Contributions welcome! Please:
694
758
 
695
759
  ## ChangeLog
696
760
 
761
+ ### Version 3.5.0
762
+
763
+ **Major Feature Release** - ICU MessageFormat Support
764
+
765
+ **New Features:**
766
+
767
+ - **ICU MessageFormat**: Full industry-standard message formatting
768
+ - Parser with 6 AST node types (MESSAGE, LITERAL, ARGUMENT, PLURAL, SELECT, SELECTORDINAL)
769
+ - Tokenizer with sophisticated depth tracking
770
+ - Semantic validator with configurable options
771
+ - Message compiler (AST → executable function)
772
+ - Runtime with message caching
773
+ - 304 tests passing (100%)
774
+
775
+ - **Formatters**: 6 built-in formatters
776
+ - NumberFormatter (integer, currency, percent)
777
+ - DateFormatter (short, medium, long, full)
778
+ - TimeFormatter (short, medium, long, full)
779
+ - PluralFormatter (37 languages via CLDR)
780
+ - SelectFormatter
781
+ - SelectOrdinalFormatter
782
+ - FormatterRegistry (pluggable system)
783
+
784
+ - **Helper Functions**: Easy-to-use utilities
785
+ - `formatICUMessage()` - One-line formatting
786
+ - `isICUMessage()` - Detect ICU format
787
+ - `parseICUMessage()` - Parse to AST
788
+ - `compileICUMessage()` - Compile to function
789
+ - `validateICUMessage()` - Validate syntax
790
+
791
+ - **Advanced Features**:
792
+ - Nested messages (4 levels tested)
793
+ - Missing value handling
794
+ - Performance optimization (<1ms/format)
795
+ - Memory-efficient caching
796
+ - Multilingual validation (12 languages, 6 writing systems)
797
+
798
+ **Documentation:**
799
+
800
+ - [ICU_MESSAGEFORMAT.md](docs/ICU_MESSAGEFORMAT.md) - Complete guide
801
+ - [ICU_COMPREHENSIVE_VALIDATION.md](docs/ICU_COMPREHENSIVE_VALIDATION.md) - Validation report
802
+ - [ICU_PROJECT_COMPLETE.md](docs/ICU_PROJECT_COMPLETE.md) - Implementation summary
803
+
804
+ **Testing:**
805
+
806
+ - 304 ICU tests passing (100%)
807
+ - Specification compliance (Unicode ICU, CLDR)
808
+ - Industry compatibility (React Intl, Vue I18n, Angular)
809
+ - Edge case coverage (nesting, Unicode, RTL, special chars)
810
+ - Performance validation (<1ms, 1000 formats in <100ms)
811
+
812
+ **Migration:**
813
+
814
+ ```typescript
815
+ // Use ICU MessageFormat
816
+ import { formatICUMessage } from '@digitaldefiance/i18n-lib';
817
+
818
+ formatICUMessage('Hello {name}', { name: 'Alice' });
819
+ formatICUMessage('{count, plural, one {# item} other {# items}}', { count: 1 });
820
+ ```
821
+
697
822
  ### Version 3.0.0
698
823
 
699
824
  **Major Feature Release** - Pluralization & Gender Support
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/i18n-lib",
3
- "version": "3.0.0",
3
+ "version": "3.5.0",
4
4
  "description": "i18n library with enum translation support",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ICU MessageFormat Abstract Syntax Tree (AST) types
3
+ */
4
+ export declare enum NodeType {
5
+ MESSAGE = "MESSAGE",
6
+ LITERAL = "LITERAL",
7
+ ARGUMENT = "ARGUMENT",
8
+ PLURAL = "PLURAL",
9
+ SELECT = "SELECT",
10
+ SELECTORDINAL = "SELECTORDINAL"
11
+ }
12
+ export interface BaseNode {
13
+ type: NodeType;
14
+ }
15
+ export interface MessageNode extends BaseNode {
16
+ type: NodeType.MESSAGE;
17
+ elements: Array<LiteralNode | ArgumentNode | PluralNode | SelectNode | SelectOrdinalNode>;
18
+ }
19
+ export interface LiteralNode extends BaseNode {
20
+ type: NodeType.LITERAL;
21
+ value: string;
22
+ }
23
+ export interface ArgumentNode extends BaseNode {
24
+ type: NodeType.ARGUMENT;
25
+ name: string;
26
+ format?: string;
27
+ style?: string;
28
+ }
29
+ export interface PluralNode extends BaseNode {
30
+ type: NodeType.PLURAL;
31
+ name: string;
32
+ offset?: number;
33
+ cases: Record<string, MessageNode>;
34
+ }
35
+ export interface SelectNode extends BaseNode {
36
+ type: NodeType.SELECT;
37
+ name: string;
38
+ cases: Record<string, MessageNode>;
39
+ }
40
+ export interface SelectOrdinalNode extends BaseNode {
41
+ type: NodeType.SELECTORDINAL;
42
+ name: string;
43
+ offset?: number;
44
+ cases: Record<string, MessageNode>;
45
+ }
46
+ export type ASTNode = LiteralNode | ArgumentNode | PluralNode | SelectNode | SelectOrdinalNode;
47
+ export type ASTNodeOrMessage = MessageNode | ASTNode;
48
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/ast.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,IAAI,EAAE,QAAQ,CAAC,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAC/F,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,OAAO,CAAC"}
package/src/icu/ast.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * ICU MessageFormat Abstract Syntax Tree (AST) types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NodeType = void 0;
7
+ var NodeType;
8
+ (function (NodeType) {
9
+ NodeType["MESSAGE"] = "MESSAGE";
10
+ NodeType["LITERAL"] = "LITERAL";
11
+ NodeType["ARGUMENT"] = "ARGUMENT";
12
+ NodeType["PLURAL"] = "PLURAL";
13
+ NodeType["SELECT"] = "SELECT";
14
+ NodeType["SELECTORDINAL"] = "SELECTORDINAL";
15
+ })(NodeType || (exports.NodeType = NodeType = {}));
16
+ //# sourceMappingURL=ast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/ast.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,2CAA+B,CAAA;AACjC,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB"}
@@ -0,0 +1,16 @@
1
+ import { MessageNode } from './ast';
2
+ import { FormatterRegistry } from './formatter-registry';
3
+ import { FormatterContext } from './formatters/base-formatter';
4
+ export type CompiledMessage = (values: Record<string, any>, context: FormatterContext) => string;
5
+ export declare class Compiler {
6
+ private registry;
7
+ constructor(registry?: FormatterRegistry);
8
+ compile(ast: MessageNode): CompiledMessage;
9
+ private compileMessage;
10
+ private compileNode;
11
+ private compileArgument;
12
+ private compilePlural;
13
+ private compileSelect;
14
+ private compileSelectOrdinal;
15
+ }
16
+ //# sourceMappingURL=compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkF,MAAM,OAAO,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,MAAM,CAAC;AAEjG,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAoB;gBAExB,QAAQ,CAAC,EAAE,iBAAiB;IAIxC,OAAO,CAAC,GAAG,EAAE,WAAW,GAAG,eAAe;IAM1C,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,oBAAoB;CAc7B"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Compiler = void 0;
4
+ const ast_1 = require("./ast");
5
+ const formatter_registry_1 = require("./formatter-registry");
6
+ class Compiler {
7
+ registry;
8
+ constructor(registry) {
9
+ this.registry = registry || new formatter_registry_1.FormatterRegistry();
10
+ }
11
+ compile(ast) {
12
+ return (values, context) => {
13
+ return this.compileMessage(ast, values, context);
14
+ };
15
+ }
16
+ compileMessage(node, values, context) {
17
+ return node.elements.map(el => this.compileNode(el, values, context)).join('');
18
+ }
19
+ compileNode(node, values, context) {
20
+ switch (node.type) {
21
+ case ast_1.NodeType.LITERAL:
22
+ return node.value;
23
+ case ast_1.NodeType.ARGUMENT:
24
+ return this.compileArgument(node, values, context);
25
+ case ast_1.NodeType.PLURAL:
26
+ return this.compilePlural(node, values, context);
27
+ case ast_1.NodeType.SELECT:
28
+ return this.compileSelect(node, values, context);
29
+ case ast_1.NodeType.SELECTORDINAL:
30
+ return this.compileSelectOrdinal(node, values, context);
31
+ default:
32
+ return '';
33
+ }
34
+ }
35
+ compileArgument(node, values, context) {
36
+ const value = values[node.name];
37
+ if (value === undefined)
38
+ return `{${node.name}}`;
39
+ if (!node.format)
40
+ return String(value);
41
+ const formatter = this.registry.get(node.format);
42
+ if (!formatter)
43
+ return String(value);
44
+ return formatter.format(value, node.style, context);
45
+ }
46
+ compilePlural(node, values, context) {
47
+ const value = values[node.name];
48
+ const num = Number(value);
49
+ if (isNaN(num))
50
+ return this.compileMessage(node.cases.other || node.cases.one, values, context);
51
+ const formatter = this.registry.get('plural');
52
+ const category = formatter ? formatter.format(num, undefined, context) : 'other';
53
+ const caseNode = node.cases[category] || node.cases.other;
54
+ if (!caseNode)
55
+ return '';
56
+ const result = this.compileMessage(caseNode, values, context);
57
+ return result.replace(/#/g, String(num));
58
+ }
59
+ compileSelect(node, values, context) {
60
+ const value = String(values[node.name] || '');
61
+ const caseNode = node.cases[value] || node.cases.other;
62
+ if (!caseNode)
63
+ return '';
64
+ return this.compileMessage(caseNode, values, context);
65
+ }
66
+ compileSelectOrdinal(node, values, context) {
67
+ const value = values[node.name];
68
+ const num = Number(value);
69
+ if (isNaN(num))
70
+ return this.compileMessage(node.cases.other, values, context);
71
+ const formatter = this.registry.get('selectordinal');
72
+ const category = formatter ? formatter.format(num, undefined, context) : 'other';
73
+ const caseNode = node.cases[category] || node.cases.other;
74
+ if (!caseNode)
75
+ return '';
76
+ const result = this.compileMessage(caseNode, values, context);
77
+ return result.replace(/#/g, String(num));
78
+ }
79
+ }
80
+ exports.Compiler = Compiler;
81
+ //# sourceMappingURL=compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/compiler.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import { Formatter } from './formatters/base-formatter';
2
+ export declare class FormatterRegistry {
3
+ private formatters;
4
+ constructor();
5
+ private registerDefaults;
6
+ register(type: string, formatter: Formatter): void;
7
+ get(type: string): Formatter | undefined;
8
+ has(type: string): boolean;
9
+ }
10
+ //# sourceMappingURL=formatter-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter-registry.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatter-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAQxD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAgC;;IAMlD,OAAO,CAAC,gBAAgB;IASxB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAIlD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIxC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatterRegistry = void 0;
4
+ const number_formatter_1 = require("./formatters/number-formatter");
5
+ const date_formatter_1 = require("./formatters/date-formatter");
6
+ const time_formatter_1 = require("./formatters/time-formatter");
7
+ const plural_formatter_1 = require("./formatters/plural-formatter");
8
+ const select_formatter_1 = require("./formatters/select-formatter");
9
+ const selectordinal_formatter_1 = require("./formatters/selectordinal-formatter");
10
+ class FormatterRegistry {
11
+ formatters = new Map();
12
+ constructor() {
13
+ this.registerDefaults();
14
+ }
15
+ registerDefaults() {
16
+ this.register('number', new number_formatter_1.NumberFormatter());
17
+ this.register('date', new date_formatter_1.DateFormatter());
18
+ this.register('time', new time_formatter_1.TimeFormatter());
19
+ this.register('plural', new plural_formatter_1.PluralFormatter());
20
+ this.register('select', new select_formatter_1.SelectFormatter());
21
+ this.register('selectordinal', new selectordinal_formatter_1.SelectOrdinalFormatter());
22
+ }
23
+ register(type, formatter) {
24
+ this.formatters.set(type, formatter);
25
+ }
26
+ get(type) {
27
+ return this.formatters.get(type);
28
+ }
29
+ has(type) {
30
+ return this.formatters.has(type);
31
+ }
32
+ }
33
+ exports.FormatterRegistry = FormatterRegistry;
34
+ //# sourceMappingURL=formatter-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter-registry.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatter-registry.ts"],"names":[],"mappings":";;;AACA,oEAAgE;AAChE,gEAA4D;AAC5D,gEAA4D;AAC5D,oEAAgE;AAChE,oEAAgE;AAChE,kFAA8E;AAE9E,MAAa,iBAAiB;IACpB,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAElD;QACE,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,kCAAe,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,8BAAa,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,8BAAa,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,kCAAe,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,kCAAe,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,IAAI,gDAAsB,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,SAAoB;QACzC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AA3BD,8CA2BC"}
@@ -0,0 +1,8 @@
1
+ export interface FormatterContext {
2
+ locale: string;
3
+ [key: string]: any;
4
+ }
5
+ export interface Formatter {
6
+ format(value: any, style?: string, context?: FormatterContext): string;
7
+ }
8
+ //# sourceMappingURL=base-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/base-formatter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;CACxE"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=base-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/base-formatter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class DateFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=date-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/date-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBAAa,aAAc,YAAW,SAAS;IAC7C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CA0BvE"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateFormatter = void 0;
4
+ class DateFormatter {
5
+ format(value, style, context) {
6
+ const date = value instanceof Date ? value : new Date(value);
7
+ if (isNaN(date.getTime()))
8
+ return String(value);
9
+ const locale = context?.locale || 'en-US';
10
+ const options = {};
11
+ switch (style) {
12
+ case 'short':
13
+ options.dateStyle = 'short';
14
+ break;
15
+ case 'medium':
16
+ options.dateStyle = 'medium';
17
+ break;
18
+ case 'long':
19
+ options.dateStyle = 'long';
20
+ break;
21
+ case 'full':
22
+ options.dateStyle = 'full';
23
+ break;
24
+ default:
25
+ options.dateStyle = 'medium';
26
+ }
27
+ return new Intl.DateTimeFormat(locale, options).format(date);
28
+ }
29
+ }
30
+ exports.DateFormatter = DateFormatter;
31
+ //# sourceMappingURL=date-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/date-formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IACxB,MAAM,CAAC,KAAU,EAAE,KAAc,EAAE,OAA0B;QAC3D,MAAM,IAAI,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QAEhD,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC;QAC1C,MAAM,OAAO,GAA+B,EAAE,CAAC;QAE/C,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,OAAO;gBACV,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;gBAC5B,MAAM;YACR,KAAK,QAAQ;gBACX,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC;gBAC7B,MAAM;YACR,KAAK,MAAM;gBACT,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;gBAC3B,MAAM;YACR,KAAK,MAAM;gBACT,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;gBAC3B,MAAM;YACR;gBACE,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC;QACjC,CAAC;QAED,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;CACF;AA3BD,sCA2BC"}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class NumberFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=number-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/number-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBAAa,eAAgB,YAAW,SAAS;IAC/C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CAyBvE"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberFormatter = void 0;
4
+ class NumberFormatter {
5
+ format(value, style, context) {
6
+ const num = Number(value);
7
+ if (isNaN(num))
8
+ return String(value);
9
+ const locale = context?.locale || 'en-US';
10
+ const options = {};
11
+ switch (style) {
12
+ case 'integer':
13
+ options.maximumFractionDigits = 0;
14
+ break;
15
+ case 'currency':
16
+ options.style = 'currency';
17
+ options.currency = context?.currency || 'USD';
18
+ break;
19
+ case 'percent':
20
+ options.style = 'percent';
21
+ break;
22
+ case 'decimal':
23
+ default:
24
+ break;
25
+ }
26
+ return new Intl.NumberFormat(locale, options).format(num);
27
+ }
28
+ }
29
+ exports.NumberFormatter = NumberFormatter;
30
+ //# sourceMappingURL=number-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/number-formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IAC1B,MAAM,CAAC,KAAU,EAAE,KAAc,EAAE,OAA0B;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC;QAC1C,MAAM,OAAO,GAA6B,EAAE,CAAC;QAE7C,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,SAAS;gBACZ,OAAO,CAAC,qBAAqB,GAAG,CAAC,CAAC;gBAClC,MAAM;YACR,KAAK,UAAU;gBACb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;gBAC3B,OAAO,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC;gBAC9C,MAAM;YACR,KAAK,SAAS;gBACZ,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;gBAC1B,MAAM;YACR,KAAK,SAAS,CAAC;YACf;gBACE,MAAM;QACV,CAAC;QAED,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;CACF;AA1BD,0CA0BC"}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class PluralFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=plural-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/plural-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,qBAAa,eAAgB,YAAW,SAAS;IAC/C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CAOvE"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluralFormatter = void 0;
4
+ const language_plural_map_1 = require("../../pluralization/language-plural-map");
5
+ class PluralFormatter {
6
+ format(value, style, context) {
7
+ const num = Number(value);
8
+ if (isNaN(num))
9
+ return 'other';
10
+ const locale = context?.locale || 'en-US';
11
+ return (0, language_plural_map_1.getPluralCategory)(locale, num);
12
+ }
13
+ }
14
+ exports.PluralFormatter = PluralFormatter;
15
+ //# sourceMappingURL=plural-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/plural-formatter.ts"],"names":[],"mappings":";;;AACA,iFAA4E;AAE5E,MAAa,eAAe;IAC1B,MAAM,CAAC,KAAU,EAAE,KAAc,EAAE,OAA0B;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,OAAO,OAAO,CAAC;QAE/B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC;QAC1C,OAAO,IAAA,uCAAiB,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;CACF;AARD,0CAQC"}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class SelectFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=select-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/select-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBAAa,eAAgB,YAAW,SAAS;IAC/C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CAGvE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectFormatter = void 0;
4
+ class SelectFormatter {
5
+ format(value, style, context) {
6
+ return String(value);
7
+ }
8
+ }
9
+ exports.SelectFormatter = SelectFormatter;
10
+ //# sourceMappingURL=select-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/select-formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IAC1B,MAAM,CAAC,KAAU,EAAE,KAAc,EAAE,OAA0B;QAC3D,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF;AAJD,0CAIC"}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class SelectOrdinalFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=selectordinal-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectordinal-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/selectordinal-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBAAa,sBAAuB,YAAW,SAAS;IACtD,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CAavE"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectOrdinalFormatter = void 0;
4
+ class SelectOrdinalFormatter {
5
+ format(value, style, context) {
6
+ const num = Number(value);
7
+ if (isNaN(num))
8
+ return 'other';
9
+ // English ordinal rules (1st, 2nd, 3rd, 4th, etc.)
10
+ const mod10 = num % 10;
11
+ const mod100 = num % 100;
12
+ if (mod10 === 1 && mod100 !== 11)
13
+ return 'one';
14
+ if (mod10 === 2 && mod100 !== 12)
15
+ return 'two';
16
+ if (mod10 === 3 && mod100 !== 13)
17
+ return 'few';
18
+ return 'other';
19
+ }
20
+ }
21
+ exports.SelectOrdinalFormatter = SelectOrdinalFormatter;
22
+ //# sourceMappingURL=selectordinal-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectordinal-formatter.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/selectordinal-formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,sBAAsB;IACjC,MAAM,CAAC,KAAU,EAAE,KAAc,EAAE,OAA0B;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,OAAO,OAAO,CAAC;QAE/B,mDAAmD;QACnD,MAAM,KAAK,GAAG,GAAG,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;QAEzB,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAC/C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAdD,wDAcC"}
@@ -0,0 +1,5 @@
1
+ import { Formatter, FormatterContext } from './base-formatter';
2
+ export declare class TimeFormatter implements Formatter {
3
+ format(value: any, style?: string, context?: FormatterContext): string;
4
+ }
5
+ //# sourceMappingURL=time-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-formatter.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-i18n-lib/src/icu/formatters/time-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBAAa,aAAc,YAAW,SAAS;IAC7C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;CA0BvE"}