@lokascript/i18n 1.1.1 → 1.1.2

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,3 +1,5 @@
1
+ import { D as Dictionary } from './types-naTJIIaT.js';
2
+
1
3
  /**
2
4
  * KeywordProvider interface for locale-aware parsing.
3
5
  *
@@ -88,127 +90,6 @@ interface KeywordProviderOptions {
88
90
  categories?: Array<'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions'>;
89
91
  }
90
92
 
91
- /**
92
- * Dictionary category names as a union type for type-safe access.
93
- */
94
- type DictionaryCategory = 'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions';
95
- /**
96
- * All valid dictionary categories.
97
- */
98
- declare const DICTIONARY_CATEGORIES: readonly DictionaryCategory[];
99
- /**
100
- * Dictionary structure for i18n translations.
101
- * Maps English canonical keywords to locale-specific translations.
102
- *
103
- * Note: Index signature removed for stricter type safety.
104
- * Use DICTIONARY_CATEGORIES to iterate over categories.
105
- */
106
- interface Dictionary {
107
- commands: Record<string, string>;
108
- modifiers: Record<string, string>;
109
- events: Record<string, string>;
110
- logical: Record<string, string>;
111
- temporal: Record<string, string>;
112
- values: Record<string, string>;
113
- attributes: Record<string, string>;
114
- expressions: Record<string, string>;
115
- }
116
- /**
117
- * Type guard to check if a string is a valid dictionary category.
118
- */
119
- declare function isDictionaryCategory(key: string): key is DictionaryCategory;
120
- /**
121
- * Safely get a category from a dictionary with type narrowing.
122
- * Returns undefined if the category doesn't exist.
123
- */
124
- declare function getDictionaryCategory(dict: Dictionary, category: string): Record<string, string> | undefined;
125
- /**
126
- * Iterate over all categories in a dictionary with proper typing.
127
- */
128
- declare function forEachCategory(dict: Dictionary, callback: (category: DictionaryCategory, entries: Record<string, string>) => void): void;
129
- /**
130
- * Find a translation in any category of a dictionary.
131
- * Returns the English key if found, undefined otherwise.
132
- */
133
- declare function findInDictionary(dict: Dictionary, localizedWord: string): {
134
- category: DictionaryCategory;
135
- englishKey: string;
136
- } | undefined;
137
- /**
138
- * Find a translation for an English word in any category.
139
- * Returns the localized word if found, undefined otherwise.
140
- */
141
- declare function translateFromEnglish(dict: Dictionary, englishWord: string): string | undefined;
142
- interface I18nConfig {
143
- locale: string;
144
- fallbackLocale?: string;
145
- dictionaries?: Record<string, Dictionary>;
146
- detectLocale?: boolean;
147
- rtlLocales?: string[];
148
- preserveOriginalAttribute?: string;
149
- }
150
- interface TranslationOptions {
151
- from?: string;
152
- to: string;
153
- preserveOriginal?: boolean;
154
- validate?: boolean;
155
- }
156
- interface ValidationResult {
157
- valid: boolean;
158
- errors: ValidationError[];
159
- warnings: ValidationWarning[];
160
- coverage: {
161
- total: number;
162
- translated: number;
163
- missing: string[];
164
- };
165
- }
166
- interface ValidationError {
167
- type: 'missing' | 'invalid' | 'duplicate';
168
- key: string;
169
- message: string;
170
- }
171
- interface ValidationWarning {
172
- type: 'unused' | 'deprecated' | 'inconsistent';
173
- key: string;
174
- message: string;
175
- }
176
- interface LocaleMetadata {
177
- code: string;
178
- name: string;
179
- nativeName: string;
180
- rtl: boolean;
181
- pluralRules?: (n: number) => string;
182
- }
183
- interface TranslationContext {
184
- locale: string;
185
- direction: 'ltr' | 'rtl';
186
- dictionary: Dictionary;
187
- metadata: LocaleMetadata;
188
- }
189
- type TokenType = 'command' | 'modifier' | 'event' | 'logical' | 'temporal' | 'value' | 'attribute' | 'expression' | 'identifier' | 'operator' | 'literal';
190
- interface Token {
191
- type: TokenType;
192
- value: string;
193
- translated?: string;
194
- position: {
195
- start: number;
196
- end: number;
197
- line: number;
198
- column: number;
199
- };
200
- }
201
- interface TranslationResult {
202
- translated: string;
203
- original?: string;
204
- tokens: Token[];
205
- locale: {
206
- from: string;
207
- to: string;
208
- };
209
- warnings?: string[];
210
- }
211
-
212
93
  /**
213
94
  * Generalized Grammar System for Multilingual Hyperscript
214
95
  *
@@ -1038,4 +919,4 @@ declare const examples: {
1038
919
  };
1039
920
  };
1040
921
 
1041
- export { englishProfile as $, ptKeywords as A, pt as B, detectBrowserLocale as C, type AdpositionType as D, ENGLISH_COMMANDS as E, type LanguageProfile as F, type GrammaticalMarker as G, type GrammarRule as H, type PatternTransform as I, type ParsedStatement as J, type KeywordProvider as K, LocaleManager as L, type MorphologyType as M, type ParsedElement as N, UNIVERSAL_PATTERNS as O, type PatternMatcher as P, LANGUAGE_FAMILY_DEFAULTS as Q, reorderRoles as R, type SemanticRole as S, insertMarkers as T, UNIVERSAL_ENGLISH_KEYWORDS as U, joinTokens as V, type WordOrder as W, transformStatement as X, profiles as Y, getProfile as Z, getSupportedLocales as _, type KeywordProviderOptions as a, japaneseProfile as a0, koreanProfile as a1, chineseProfile as a2, arabicProfile as a3, turkishProfile as a4, spanishProfile as a5, germanProfile as a6, frenchProfile as a7, portugueseProfile as a8, indonesianProfile as a9, quechuaProfile as aa, swahiliProfile as ab, GrammarTransformer as ac, parseStatement as ad, toLocale as ae, toEnglish as af, translate as ag, examples as ah, type I18nConfig as ai, type TranslationOptions as aj, type TranslationResult as ak, type Dictionary as al, type ValidationResult as am, type Token as an, type DictionaryCategory as ao, type ValidationError as ap, type ValidationWarning as aq, type LocaleMetadata as ar, type TranslationContext as as, type TokenType as at, DICTIONARY_CATEGORIES as au, isDictionaryCategory as av, getDictionaryCategory as aw, forEachCategory as ax, findInDictionary as ay, translateFromEnglish as az, createEnglishProvider as b, createKeywordProvider as c, ENGLISH_KEYWORDS as d, esKeywords as e, es as f, ja as g, frKeywords as h, fr as i, jaKeywords as j, deKeywords as k, de as l, arKeywords as m, ar as n, koKeywords as o, ko as p, zh as q, tr as r, idKeywords as s, trKeywords as t, id as u, quKeywords as v, qu as w, swKeywords as x, sw as y, zhKeywords as z };
922
+ export { englishProfile as $, ptKeywords as A, pt as B, detectBrowserLocale as C, type AdpositionType as D, ENGLISH_COMMANDS as E, type LanguageProfile as F, type GrammaticalMarker as G, type GrammarRule as H, type PatternTransform as I, type ParsedStatement as J, type KeywordProvider as K, LocaleManager as L, type MorphologyType as M, type ParsedElement as N, UNIVERSAL_PATTERNS as O, type PatternMatcher as P, LANGUAGE_FAMILY_DEFAULTS as Q, reorderRoles as R, type SemanticRole as S, insertMarkers as T, UNIVERSAL_ENGLISH_KEYWORDS as U, joinTokens as V, type WordOrder as W, transformStatement as X, profiles as Y, getProfile as Z, getSupportedLocales as _, type KeywordProviderOptions as a, japaneseProfile as a0, koreanProfile as a1, chineseProfile as a2, arabicProfile as a3, turkishProfile as a4, spanishProfile as a5, germanProfile as a6, frenchProfile as a7, portugueseProfile as a8, indonesianProfile as a9, quechuaProfile as aa, swahiliProfile as ab, GrammarTransformer as ac, parseStatement as ad, toLocale as ae, toEnglish as af, translate as ag, examples as ah, createEnglishProvider as b, createKeywordProvider as c, ENGLISH_KEYWORDS as d, esKeywords as e, es as f, ja as g, frKeywords as h, fr as i, jaKeywords as j, deKeywords as k, de as l, arKeywords as m, ar as n, koKeywords as o, ko as p, zh as q, tr as r, idKeywords as s, trKeywords as t, id as u, quKeywords as v, qu as w, swKeywords as x, sw as y, zhKeywords as z };
@@ -1,3 +1,5 @@
1
+ import { D as Dictionary } from './types-naTJIIaT.cjs';
2
+
1
3
  /**
2
4
  * KeywordProvider interface for locale-aware parsing.
3
5
  *
@@ -88,127 +90,6 @@ interface KeywordProviderOptions {
88
90
  categories?: Array<'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions'>;
89
91
  }
90
92
 
91
- /**
92
- * Dictionary category names as a union type for type-safe access.
93
- */
94
- type DictionaryCategory = 'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions';
95
- /**
96
- * All valid dictionary categories.
97
- */
98
- declare const DICTIONARY_CATEGORIES: readonly DictionaryCategory[];
99
- /**
100
- * Dictionary structure for i18n translations.
101
- * Maps English canonical keywords to locale-specific translations.
102
- *
103
- * Note: Index signature removed for stricter type safety.
104
- * Use DICTIONARY_CATEGORIES to iterate over categories.
105
- */
106
- interface Dictionary {
107
- commands: Record<string, string>;
108
- modifiers: Record<string, string>;
109
- events: Record<string, string>;
110
- logical: Record<string, string>;
111
- temporal: Record<string, string>;
112
- values: Record<string, string>;
113
- attributes: Record<string, string>;
114
- expressions: Record<string, string>;
115
- }
116
- /**
117
- * Type guard to check if a string is a valid dictionary category.
118
- */
119
- declare function isDictionaryCategory(key: string): key is DictionaryCategory;
120
- /**
121
- * Safely get a category from a dictionary with type narrowing.
122
- * Returns undefined if the category doesn't exist.
123
- */
124
- declare function getDictionaryCategory(dict: Dictionary, category: string): Record<string, string> | undefined;
125
- /**
126
- * Iterate over all categories in a dictionary with proper typing.
127
- */
128
- declare function forEachCategory(dict: Dictionary, callback: (category: DictionaryCategory, entries: Record<string, string>) => void): void;
129
- /**
130
- * Find a translation in any category of a dictionary.
131
- * Returns the English key if found, undefined otherwise.
132
- */
133
- declare function findInDictionary(dict: Dictionary, localizedWord: string): {
134
- category: DictionaryCategory;
135
- englishKey: string;
136
- } | undefined;
137
- /**
138
- * Find a translation for an English word in any category.
139
- * Returns the localized word if found, undefined otherwise.
140
- */
141
- declare function translateFromEnglish(dict: Dictionary, englishWord: string): string | undefined;
142
- interface I18nConfig {
143
- locale: string;
144
- fallbackLocale?: string;
145
- dictionaries?: Record<string, Dictionary>;
146
- detectLocale?: boolean;
147
- rtlLocales?: string[];
148
- preserveOriginalAttribute?: string;
149
- }
150
- interface TranslationOptions {
151
- from?: string;
152
- to: string;
153
- preserveOriginal?: boolean;
154
- validate?: boolean;
155
- }
156
- interface ValidationResult {
157
- valid: boolean;
158
- errors: ValidationError[];
159
- warnings: ValidationWarning[];
160
- coverage: {
161
- total: number;
162
- translated: number;
163
- missing: string[];
164
- };
165
- }
166
- interface ValidationError {
167
- type: 'missing' | 'invalid' | 'duplicate';
168
- key: string;
169
- message: string;
170
- }
171
- interface ValidationWarning {
172
- type: 'unused' | 'deprecated' | 'inconsistent';
173
- key: string;
174
- message: string;
175
- }
176
- interface LocaleMetadata {
177
- code: string;
178
- name: string;
179
- nativeName: string;
180
- rtl: boolean;
181
- pluralRules?: (n: number) => string;
182
- }
183
- interface TranslationContext {
184
- locale: string;
185
- direction: 'ltr' | 'rtl';
186
- dictionary: Dictionary;
187
- metadata: LocaleMetadata;
188
- }
189
- type TokenType = 'command' | 'modifier' | 'event' | 'logical' | 'temporal' | 'value' | 'attribute' | 'expression' | 'identifier' | 'operator' | 'literal';
190
- interface Token {
191
- type: TokenType;
192
- value: string;
193
- translated?: string;
194
- position: {
195
- start: number;
196
- end: number;
197
- line: number;
198
- column: number;
199
- };
200
- }
201
- interface TranslationResult {
202
- translated: string;
203
- original?: string;
204
- tokens: Token[];
205
- locale: {
206
- from: string;
207
- to: string;
208
- };
209
- warnings?: string[];
210
- }
211
-
212
93
  /**
213
94
  * Generalized Grammar System for Multilingual Hyperscript
214
95
  *
@@ -1038,4 +919,4 @@ declare const examples: {
1038
919
  };
1039
920
  };
1040
921
 
1041
- export { englishProfile as $, ptKeywords as A, pt as B, detectBrowserLocale as C, type AdpositionType as D, ENGLISH_COMMANDS as E, type LanguageProfile as F, type GrammaticalMarker as G, type GrammarRule as H, type PatternTransform as I, type ParsedStatement as J, type KeywordProvider as K, LocaleManager as L, type MorphologyType as M, type ParsedElement as N, UNIVERSAL_PATTERNS as O, type PatternMatcher as P, LANGUAGE_FAMILY_DEFAULTS as Q, reorderRoles as R, type SemanticRole as S, insertMarkers as T, UNIVERSAL_ENGLISH_KEYWORDS as U, joinTokens as V, type WordOrder as W, transformStatement as X, profiles as Y, getProfile as Z, getSupportedLocales as _, type KeywordProviderOptions as a, japaneseProfile as a0, koreanProfile as a1, chineseProfile as a2, arabicProfile as a3, turkishProfile as a4, spanishProfile as a5, germanProfile as a6, frenchProfile as a7, portugueseProfile as a8, indonesianProfile as a9, quechuaProfile as aa, swahiliProfile as ab, GrammarTransformer as ac, parseStatement as ad, toLocale as ae, toEnglish as af, translate as ag, examples as ah, type I18nConfig as ai, type TranslationOptions as aj, type TranslationResult as ak, type Dictionary as al, type ValidationResult as am, type Token as an, type DictionaryCategory as ao, type ValidationError as ap, type ValidationWarning as aq, type LocaleMetadata as ar, type TranslationContext as as, type TokenType as at, DICTIONARY_CATEGORIES as au, isDictionaryCategory as av, getDictionaryCategory as aw, forEachCategory as ax, findInDictionary as ay, translateFromEnglish as az, createEnglishProvider as b, createKeywordProvider as c, ENGLISH_KEYWORDS as d, esKeywords as e, es as f, ja as g, frKeywords as h, fr as i, jaKeywords as j, deKeywords as k, de as l, arKeywords as m, ar as n, koKeywords as o, ko as p, zh as q, tr as r, idKeywords as s, trKeywords as t, id as u, quKeywords as v, qu as w, swKeywords as x, sw as y, zhKeywords as z };
922
+ export { englishProfile as $, ptKeywords as A, pt as B, detectBrowserLocale as C, type AdpositionType as D, ENGLISH_COMMANDS as E, type LanguageProfile as F, type GrammaticalMarker as G, type GrammarRule as H, type PatternTransform as I, type ParsedStatement as J, type KeywordProvider as K, LocaleManager as L, type MorphologyType as M, type ParsedElement as N, UNIVERSAL_PATTERNS as O, type PatternMatcher as P, LANGUAGE_FAMILY_DEFAULTS as Q, reorderRoles as R, type SemanticRole as S, insertMarkers as T, UNIVERSAL_ENGLISH_KEYWORDS as U, joinTokens as V, type WordOrder as W, transformStatement as X, profiles as Y, getProfile as Z, getSupportedLocales as _, type KeywordProviderOptions as a, japaneseProfile as a0, koreanProfile as a1, chineseProfile as a2, arabicProfile as a3, turkishProfile as a4, spanishProfile as a5, germanProfile as a6, frenchProfile as a7, portugueseProfile as a8, indonesianProfile as a9, quechuaProfile as aa, swahiliProfile as ab, GrammarTransformer as ac, parseStatement as ad, toLocale as ae, toEnglish as af, translate as ag, examples as ah, createEnglishProvider as b, createKeywordProvider as c, ENGLISH_KEYWORDS as d, esKeywords as e, es as f, ja as g, frKeywords as h, fr as i, jaKeywords as j, deKeywords as k, de as l, arKeywords as m, ar as n, koKeywords as o, ko as p, zh as q, tr as r, idKeywords as s, trKeywords as t, id as u, quKeywords as v, qu as w, swKeywords as x, sw as y, zhKeywords as z };
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Dictionary category names as a union type for type-safe access.
3
+ */
4
+ type DictionaryCategory = 'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions';
5
+ /**
6
+ * All valid dictionary categories.
7
+ */
8
+ declare const DICTIONARY_CATEGORIES: readonly DictionaryCategory[];
9
+ /**
10
+ * Dictionary structure for i18n translations.
11
+ * Maps English canonical keywords to locale-specific translations.
12
+ *
13
+ * Note: Index signature removed for stricter type safety.
14
+ * Use DICTIONARY_CATEGORIES to iterate over categories.
15
+ */
16
+ interface Dictionary {
17
+ commands: Record<string, string>;
18
+ modifiers: Record<string, string>;
19
+ events: Record<string, string>;
20
+ logical: Record<string, string>;
21
+ temporal: Record<string, string>;
22
+ values: Record<string, string>;
23
+ attributes: Record<string, string>;
24
+ expressions: Record<string, string>;
25
+ }
26
+ /**
27
+ * Type guard to check if a string is a valid dictionary category.
28
+ */
29
+ declare function isDictionaryCategory(key: string): key is DictionaryCategory;
30
+ /**
31
+ * Safely get a category from a dictionary with type narrowing.
32
+ * Returns undefined if the category doesn't exist.
33
+ */
34
+ declare function getDictionaryCategory(dict: Dictionary, category: string): Record<string, string> | undefined;
35
+ /**
36
+ * Iterate over all categories in a dictionary with proper typing.
37
+ */
38
+ declare function forEachCategory(dict: Dictionary, callback: (category: DictionaryCategory, entries: Record<string, string>) => void): void;
39
+ /**
40
+ * Find a translation in any category of a dictionary.
41
+ * Returns the English key if found, undefined otherwise.
42
+ */
43
+ declare function findInDictionary(dict: Dictionary, localizedWord: string): {
44
+ category: DictionaryCategory;
45
+ englishKey: string;
46
+ } | undefined;
47
+ /**
48
+ * Find a translation for an English word in any category.
49
+ * Returns the localized word if found, undefined otherwise.
50
+ */
51
+ declare function translateFromEnglish(dict: Dictionary, englishWord: string): string | undefined;
52
+ interface I18nConfig {
53
+ locale: string;
54
+ fallbackLocale?: string;
55
+ dictionaries?: Record<string, Dictionary>;
56
+ detectLocale?: boolean;
57
+ rtlLocales?: string[];
58
+ preserveOriginalAttribute?: string;
59
+ }
60
+ interface TranslationOptions {
61
+ from?: string;
62
+ to: string;
63
+ preserveOriginal?: boolean;
64
+ validate?: boolean;
65
+ }
66
+ interface ValidationResult {
67
+ valid: boolean;
68
+ errors: ValidationError[];
69
+ warnings: ValidationWarning[];
70
+ coverage: {
71
+ total: number;
72
+ translated: number;
73
+ missing: string[];
74
+ };
75
+ }
76
+ interface ValidationError {
77
+ type: 'missing' | 'invalid' | 'duplicate';
78
+ key: string;
79
+ message: string;
80
+ }
81
+ interface ValidationWarning {
82
+ type: 'unused' | 'deprecated' | 'inconsistent';
83
+ key: string;
84
+ message: string;
85
+ }
86
+ interface LocaleMetadata {
87
+ code: string;
88
+ name: string;
89
+ nativeName: string;
90
+ rtl: boolean;
91
+ pluralRules?: (n: number) => string;
92
+ }
93
+ interface TranslationContext {
94
+ locale: string;
95
+ direction: 'ltr' | 'rtl';
96
+ dictionary: Dictionary;
97
+ metadata: LocaleMetadata;
98
+ }
99
+ type TokenType = 'command' | 'modifier' | 'event' | 'logical' | 'temporal' | 'value' | 'attribute' | 'expression' | 'identifier' | 'operator' | 'literal';
100
+ interface Token {
101
+ type: TokenType;
102
+ value: string;
103
+ translated?: string;
104
+ position: {
105
+ start: number;
106
+ end: number;
107
+ line: number;
108
+ column: number;
109
+ };
110
+ }
111
+ interface TranslationResult {
112
+ translated: string;
113
+ original?: string;
114
+ tokens: Token[];
115
+ locale: {
116
+ from: string;
117
+ to: string;
118
+ };
119
+ warnings?: string[];
120
+ }
121
+
122
+ export { type Dictionary as D, type I18nConfig as I, type LocaleMetadata as L, type TranslationOptions as T, type ValidationResult as V, type TranslationResult as a, type Token as b, type DictionaryCategory as c, type ValidationError as d, type ValidationWarning as e, type TranslationContext as f, type TokenType as g, DICTIONARY_CATEGORIES as h, isDictionaryCategory as i, getDictionaryCategory as j, forEachCategory as k, findInDictionary as l, translateFromEnglish as t };
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Dictionary category names as a union type for type-safe access.
3
+ */
4
+ type DictionaryCategory = 'commands' | 'modifiers' | 'events' | 'logical' | 'temporal' | 'values' | 'attributes' | 'expressions';
5
+ /**
6
+ * All valid dictionary categories.
7
+ */
8
+ declare const DICTIONARY_CATEGORIES: readonly DictionaryCategory[];
9
+ /**
10
+ * Dictionary structure for i18n translations.
11
+ * Maps English canonical keywords to locale-specific translations.
12
+ *
13
+ * Note: Index signature removed for stricter type safety.
14
+ * Use DICTIONARY_CATEGORIES to iterate over categories.
15
+ */
16
+ interface Dictionary {
17
+ commands: Record<string, string>;
18
+ modifiers: Record<string, string>;
19
+ events: Record<string, string>;
20
+ logical: Record<string, string>;
21
+ temporal: Record<string, string>;
22
+ values: Record<string, string>;
23
+ attributes: Record<string, string>;
24
+ expressions: Record<string, string>;
25
+ }
26
+ /**
27
+ * Type guard to check if a string is a valid dictionary category.
28
+ */
29
+ declare function isDictionaryCategory(key: string): key is DictionaryCategory;
30
+ /**
31
+ * Safely get a category from a dictionary with type narrowing.
32
+ * Returns undefined if the category doesn't exist.
33
+ */
34
+ declare function getDictionaryCategory(dict: Dictionary, category: string): Record<string, string> | undefined;
35
+ /**
36
+ * Iterate over all categories in a dictionary with proper typing.
37
+ */
38
+ declare function forEachCategory(dict: Dictionary, callback: (category: DictionaryCategory, entries: Record<string, string>) => void): void;
39
+ /**
40
+ * Find a translation in any category of a dictionary.
41
+ * Returns the English key if found, undefined otherwise.
42
+ */
43
+ declare function findInDictionary(dict: Dictionary, localizedWord: string): {
44
+ category: DictionaryCategory;
45
+ englishKey: string;
46
+ } | undefined;
47
+ /**
48
+ * Find a translation for an English word in any category.
49
+ * Returns the localized word if found, undefined otherwise.
50
+ */
51
+ declare function translateFromEnglish(dict: Dictionary, englishWord: string): string | undefined;
52
+ interface I18nConfig {
53
+ locale: string;
54
+ fallbackLocale?: string;
55
+ dictionaries?: Record<string, Dictionary>;
56
+ detectLocale?: boolean;
57
+ rtlLocales?: string[];
58
+ preserveOriginalAttribute?: string;
59
+ }
60
+ interface TranslationOptions {
61
+ from?: string;
62
+ to: string;
63
+ preserveOriginal?: boolean;
64
+ validate?: boolean;
65
+ }
66
+ interface ValidationResult {
67
+ valid: boolean;
68
+ errors: ValidationError[];
69
+ warnings: ValidationWarning[];
70
+ coverage: {
71
+ total: number;
72
+ translated: number;
73
+ missing: string[];
74
+ };
75
+ }
76
+ interface ValidationError {
77
+ type: 'missing' | 'invalid' | 'duplicate';
78
+ key: string;
79
+ message: string;
80
+ }
81
+ interface ValidationWarning {
82
+ type: 'unused' | 'deprecated' | 'inconsistent';
83
+ key: string;
84
+ message: string;
85
+ }
86
+ interface LocaleMetadata {
87
+ code: string;
88
+ name: string;
89
+ nativeName: string;
90
+ rtl: boolean;
91
+ pluralRules?: (n: number) => string;
92
+ }
93
+ interface TranslationContext {
94
+ locale: string;
95
+ direction: 'ltr' | 'rtl';
96
+ dictionary: Dictionary;
97
+ metadata: LocaleMetadata;
98
+ }
99
+ type TokenType = 'command' | 'modifier' | 'event' | 'logical' | 'temporal' | 'value' | 'attribute' | 'expression' | 'identifier' | 'operator' | 'literal';
100
+ interface Token {
101
+ type: TokenType;
102
+ value: string;
103
+ translated?: string;
104
+ position: {
105
+ start: number;
106
+ end: number;
107
+ line: number;
108
+ column: number;
109
+ };
110
+ }
111
+ interface TranslationResult {
112
+ translated: string;
113
+ original?: string;
114
+ tokens: Token[];
115
+ locale: {
116
+ from: string;
117
+ to: string;
118
+ };
119
+ warnings?: string[];
120
+ }
121
+
122
+ export { type Dictionary as D, type I18nConfig as I, type LocaleMetadata as L, type TranslationOptions as T, type ValidationResult as V, type TranslationResult as a, type Token as b, type DictionaryCategory as c, type ValidationError as d, type ValidationWarning as e, type TranslationContext as f, type TokenType as g, DICTIONARY_CATEGORIES as h, isDictionaryCategory as i, getDictionaryCategory as j, forEachCategory as k, findInDictionary as l, translateFromEnglish as t };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@lokascript/i18n",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Grammar transformation and keyword translation for hyperscript",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "module": "dist/index.mjs",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
@@ -43,7 +43,7 @@
43
43
  "lint": "eslint src --ext ts,tsx",
44
44
  "validate-dictionaries": "node scripts/validate-dictionaries.js"
45
45
  },
46
- "browser": "dist/hyperfixi-i18n.min.js",
46
+ "browser": "dist/lokascript-i18n.min.js",
47
47
  "sideEffects": false,
48
48
  "keywords": [
49
49
  "hyperscript",