@lokascript/i18n 1.1.0 → 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.
@@ -0,0 +1,203 @@
1
+ import { D as Dictionary, c as DictionaryCategory } from '../types-naTJIIaT.cjs';
2
+
3
+ /**
4
+ * Dictionary Derivation from Semantic Profiles
5
+ *
6
+ * Creates Dictionary objects from LanguageProfile keywords,
7
+ * eliminating keyword duplication between packages.
8
+ *
9
+ * The semantic profile is the single source of truth for keyword translations.
10
+ * This adapter extracts the `primary` value from each KeywordTranslation.
11
+ */
12
+
13
+ /**
14
+ * KeywordTranslation interface (matches @lokascript/semantic)
15
+ */
16
+ interface KeywordTranslation {
17
+ readonly primary: string;
18
+ readonly alternatives?: string[];
19
+ readonly normalized?: string;
20
+ }
21
+ /**
22
+ * LanguageProfile interface (subset needed for derivation)
23
+ */
24
+ interface LanguageProfile {
25
+ readonly code: string;
26
+ readonly keywords: Record<string, KeywordTranslation>;
27
+ readonly references?: Record<string, string>;
28
+ }
29
+ /**
30
+ * Options for dictionary derivation.
31
+ */
32
+ interface DeriveOptions {
33
+ /**
34
+ * Override specific categories with custom values.
35
+ * Useful for categories not fully covered by the profile.
36
+ */
37
+ overrides?: Partial<Dictionary>;
38
+ /**
39
+ * Whether to include English fallbacks for missing entries.
40
+ * Default: true
41
+ */
42
+ includeFallbacks?: boolean;
43
+ }
44
+ /**
45
+ * Derive a Dictionary from a LanguageProfile.
46
+ *
47
+ * This is the main adapter function that creates dictionaries from
48
+ * semantic profiles, eliminating keyword duplication.
49
+ *
50
+ * @param profile - The language profile to derive from
51
+ * @param options - Derivation options
52
+ * @returns A complete Dictionary object
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * import { japaneseProfile } from '@lokascript/semantic';
57
+ * import { deriveFromProfile } from './derive';
58
+ *
59
+ * export const ja = deriveFromProfile(japaneseProfile);
60
+ * ```
61
+ */
62
+ declare function deriveFromProfile(profile: LanguageProfile, options?: DeriveOptions): Dictionary;
63
+ /**
64
+ * Create an English dictionary (identity mapping).
65
+ * Special case since English keywords map to themselves.
66
+ */
67
+ declare function createEnglishDictionary(): Dictionary;
68
+ /**
69
+ * Compare a derived dictionary against an original to find missing entries.
70
+ * Useful for validating that derivation is complete.
71
+ */
72
+ declare function validateDictionary(derived: Dictionary, original: Dictionary): {
73
+ missing: Record<DictionaryCategory, string[]>;
74
+ coverage: number;
75
+ };
76
+
77
+ /**
78
+ * Dictionary Index
79
+ *
80
+ * Exports dictionaries for all supported languages.
81
+ *
82
+ * Strategy: Dictionaries are derived from semantic profiles where possible,
83
+ * with fallbacks to manual definitions for categories not in profiles
84
+ * (events, temporal, some values, attributes).
85
+ *
86
+ * The semantic package's language profiles are the single source of truth
87
+ * for command/modifier/logical keyword translations.
88
+ *
89
+ * TRANSITION NOTE: Currently using full legacy overrides to preserve
90
+ * backward compatibility. Once profiles and dictionaries are synchronized,
91
+ * the legacy overrides can be reduced to only non-profile categories.
92
+ */
93
+
94
+ /**
95
+ * English dictionary - uses legacy values for full compatibility.
96
+ */
97
+ declare const en: Dictionary;
98
+ /**
99
+ * Spanish dictionary - legacy overrides for compatibility.
100
+ */
101
+ declare const es: Dictionary;
102
+ /**
103
+ * Japanese dictionary - legacy overrides for compatibility.
104
+ */
105
+ declare const ja: Dictionary;
106
+ /**
107
+ * Korean dictionary - legacy overrides for compatibility.
108
+ */
109
+ declare const ko: Dictionary;
110
+ /**
111
+ * Chinese dictionary - legacy overrides for compatibility.
112
+ */
113
+ declare const zh: Dictionary;
114
+ /**
115
+ * French dictionary - legacy overrides for compatibility.
116
+ */
117
+ declare const fr: Dictionary;
118
+ /**
119
+ * German dictionary - legacy overrides for compatibility.
120
+ */
121
+ declare const de: Dictionary;
122
+ /**
123
+ * Arabic dictionary - legacy overrides for compatibility.
124
+ */
125
+ declare const ar: Dictionary;
126
+ /**
127
+ * Turkish dictionary - legacy overrides for compatibility.
128
+ */
129
+ declare const tr: Dictionary;
130
+ /**
131
+ * Indonesian dictionary - legacy overrides for compatibility.
132
+ */
133
+ declare const id: Dictionary;
134
+ /**
135
+ * Portuguese dictionary - legacy overrides for compatibility.
136
+ */
137
+ declare const pt: Dictionary;
138
+ /**
139
+ * Quechua dictionary - legacy overrides for compatibility.
140
+ */
141
+ declare const qu: Dictionary;
142
+ /**
143
+ * Swahili dictionary - legacy overrides for compatibility.
144
+ */
145
+ declare const sw: Dictionary;
146
+ /**
147
+ * Italian dictionary - legacy overrides for compatibility.
148
+ */
149
+ declare const it: Dictionary;
150
+ /**
151
+ * Vietnamese dictionary - legacy overrides for compatibility.
152
+ */
153
+ declare const vi: Dictionary;
154
+ /**
155
+ * Polish dictionary - legacy overrides for compatibility.
156
+ */
157
+ declare const pl: Dictionary;
158
+ /**
159
+ * Russian dictionary - legacy overrides for compatibility.
160
+ */
161
+ declare const ru: Dictionary;
162
+ /**
163
+ * Ukrainian dictionary - legacy overrides for compatibility.
164
+ */
165
+ declare const uk: Dictionary;
166
+ /**
167
+ * Hindi dictionary - legacy overrides for compatibility.
168
+ */
169
+ declare const hi: Dictionary;
170
+ /**
171
+ * Bengali dictionary - legacy overrides for compatibility.
172
+ */
173
+ declare const bn: Dictionary;
174
+ /**
175
+ * Thai dictionary - legacy overrides for compatibility.
176
+ */
177
+ declare const th: Dictionary;
178
+ /**
179
+ * Malay dictionary - legacy overrides for compatibility.
180
+ */
181
+ declare const ms: Dictionary;
182
+ /**
183
+ * Tagalog dictionary - legacy overrides for compatibility.
184
+ */
185
+ declare const tl: Dictionary;
186
+ /**
187
+ * All available dictionaries indexed by locale code.
188
+ */
189
+ declare const dictionaries: Record<string, Dictionary>;
190
+ /**
191
+ * Get all supported locale codes.
192
+ */
193
+ declare const supportedLocales: string[];
194
+ /**
195
+ * Check if a locale is supported.
196
+ */
197
+ declare const isLocaleSupported: (locale: string) => boolean;
198
+ /**
199
+ * Get dictionary with fallback to another locale.
200
+ */
201
+ declare const getDictionary: (locale: string, fallback?: string) => Dictionary | null;
202
+
203
+ export { ar, bn, createEnglishDictionary, de, deriveFromProfile, dictionaries, en, es, fr, getDictionary, hi, id, isLocaleSupported, it, ja, ko, ms, pl, pt, qu, ru, supportedLocales, sw, th, tl, tr, uk, validateDictionary, vi, zh };
@@ -0,0 +1,203 @@
1
+ import { D as Dictionary, c as DictionaryCategory } from '../types-naTJIIaT.js';
2
+
3
+ /**
4
+ * Dictionary Derivation from Semantic Profiles
5
+ *
6
+ * Creates Dictionary objects from LanguageProfile keywords,
7
+ * eliminating keyword duplication between packages.
8
+ *
9
+ * The semantic profile is the single source of truth for keyword translations.
10
+ * This adapter extracts the `primary` value from each KeywordTranslation.
11
+ */
12
+
13
+ /**
14
+ * KeywordTranslation interface (matches @lokascript/semantic)
15
+ */
16
+ interface KeywordTranslation {
17
+ readonly primary: string;
18
+ readonly alternatives?: string[];
19
+ readonly normalized?: string;
20
+ }
21
+ /**
22
+ * LanguageProfile interface (subset needed for derivation)
23
+ */
24
+ interface LanguageProfile {
25
+ readonly code: string;
26
+ readonly keywords: Record<string, KeywordTranslation>;
27
+ readonly references?: Record<string, string>;
28
+ }
29
+ /**
30
+ * Options for dictionary derivation.
31
+ */
32
+ interface DeriveOptions {
33
+ /**
34
+ * Override specific categories with custom values.
35
+ * Useful for categories not fully covered by the profile.
36
+ */
37
+ overrides?: Partial<Dictionary>;
38
+ /**
39
+ * Whether to include English fallbacks for missing entries.
40
+ * Default: true
41
+ */
42
+ includeFallbacks?: boolean;
43
+ }
44
+ /**
45
+ * Derive a Dictionary from a LanguageProfile.
46
+ *
47
+ * This is the main adapter function that creates dictionaries from
48
+ * semantic profiles, eliminating keyword duplication.
49
+ *
50
+ * @param profile - The language profile to derive from
51
+ * @param options - Derivation options
52
+ * @returns A complete Dictionary object
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * import { japaneseProfile } from '@lokascript/semantic';
57
+ * import { deriveFromProfile } from './derive';
58
+ *
59
+ * export const ja = deriveFromProfile(japaneseProfile);
60
+ * ```
61
+ */
62
+ declare function deriveFromProfile(profile: LanguageProfile, options?: DeriveOptions): Dictionary;
63
+ /**
64
+ * Create an English dictionary (identity mapping).
65
+ * Special case since English keywords map to themselves.
66
+ */
67
+ declare function createEnglishDictionary(): Dictionary;
68
+ /**
69
+ * Compare a derived dictionary against an original to find missing entries.
70
+ * Useful for validating that derivation is complete.
71
+ */
72
+ declare function validateDictionary(derived: Dictionary, original: Dictionary): {
73
+ missing: Record<DictionaryCategory, string[]>;
74
+ coverage: number;
75
+ };
76
+
77
+ /**
78
+ * Dictionary Index
79
+ *
80
+ * Exports dictionaries for all supported languages.
81
+ *
82
+ * Strategy: Dictionaries are derived from semantic profiles where possible,
83
+ * with fallbacks to manual definitions for categories not in profiles
84
+ * (events, temporal, some values, attributes).
85
+ *
86
+ * The semantic package's language profiles are the single source of truth
87
+ * for command/modifier/logical keyword translations.
88
+ *
89
+ * TRANSITION NOTE: Currently using full legacy overrides to preserve
90
+ * backward compatibility. Once profiles and dictionaries are synchronized,
91
+ * the legacy overrides can be reduced to only non-profile categories.
92
+ */
93
+
94
+ /**
95
+ * English dictionary - uses legacy values for full compatibility.
96
+ */
97
+ declare const en: Dictionary;
98
+ /**
99
+ * Spanish dictionary - legacy overrides for compatibility.
100
+ */
101
+ declare const es: Dictionary;
102
+ /**
103
+ * Japanese dictionary - legacy overrides for compatibility.
104
+ */
105
+ declare const ja: Dictionary;
106
+ /**
107
+ * Korean dictionary - legacy overrides for compatibility.
108
+ */
109
+ declare const ko: Dictionary;
110
+ /**
111
+ * Chinese dictionary - legacy overrides for compatibility.
112
+ */
113
+ declare const zh: Dictionary;
114
+ /**
115
+ * French dictionary - legacy overrides for compatibility.
116
+ */
117
+ declare const fr: Dictionary;
118
+ /**
119
+ * German dictionary - legacy overrides for compatibility.
120
+ */
121
+ declare const de: Dictionary;
122
+ /**
123
+ * Arabic dictionary - legacy overrides for compatibility.
124
+ */
125
+ declare const ar: Dictionary;
126
+ /**
127
+ * Turkish dictionary - legacy overrides for compatibility.
128
+ */
129
+ declare const tr: Dictionary;
130
+ /**
131
+ * Indonesian dictionary - legacy overrides for compatibility.
132
+ */
133
+ declare const id: Dictionary;
134
+ /**
135
+ * Portuguese dictionary - legacy overrides for compatibility.
136
+ */
137
+ declare const pt: Dictionary;
138
+ /**
139
+ * Quechua dictionary - legacy overrides for compatibility.
140
+ */
141
+ declare const qu: Dictionary;
142
+ /**
143
+ * Swahili dictionary - legacy overrides for compatibility.
144
+ */
145
+ declare const sw: Dictionary;
146
+ /**
147
+ * Italian dictionary - legacy overrides for compatibility.
148
+ */
149
+ declare const it: Dictionary;
150
+ /**
151
+ * Vietnamese dictionary - legacy overrides for compatibility.
152
+ */
153
+ declare const vi: Dictionary;
154
+ /**
155
+ * Polish dictionary - legacy overrides for compatibility.
156
+ */
157
+ declare const pl: Dictionary;
158
+ /**
159
+ * Russian dictionary - legacy overrides for compatibility.
160
+ */
161
+ declare const ru: Dictionary;
162
+ /**
163
+ * Ukrainian dictionary - legacy overrides for compatibility.
164
+ */
165
+ declare const uk: Dictionary;
166
+ /**
167
+ * Hindi dictionary - legacy overrides for compatibility.
168
+ */
169
+ declare const hi: Dictionary;
170
+ /**
171
+ * Bengali dictionary - legacy overrides for compatibility.
172
+ */
173
+ declare const bn: Dictionary;
174
+ /**
175
+ * Thai dictionary - legacy overrides for compatibility.
176
+ */
177
+ declare const th: Dictionary;
178
+ /**
179
+ * Malay dictionary - legacy overrides for compatibility.
180
+ */
181
+ declare const ms: Dictionary;
182
+ /**
183
+ * Tagalog dictionary - legacy overrides for compatibility.
184
+ */
185
+ declare const tl: Dictionary;
186
+ /**
187
+ * All available dictionaries indexed by locale code.
188
+ */
189
+ declare const dictionaries: Record<string, Dictionary>;
190
+ /**
191
+ * Get all supported locale codes.
192
+ */
193
+ declare const supportedLocales: string[];
194
+ /**
195
+ * Check if a locale is supported.
196
+ */
197
+ declare const isLocaleSupported: (locale: string) => boolean;
198
+ /**
199
+ * Get dictionary with fallback to another locale.
200
+ */
201
+ declare const getDictionary: (locale: string, fallback?: string) => Dictionary | null;
202
+
203
+ export { ar, bn, createEnglishDictionary, de, deriveFromProfile, dictionaries, en, es, fr, getDictionary, hi, id, isLocaleSupported, it, ja, ko, ms, pl, pt, qu, ru, supportedLocales, sw, th, tl, tr, uk, validateDictionary, vi, zh };