@lokascript/i18n 1.1.1 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,11 @@
1
- import { ai as I18nConfig, aj as TranslationOptions, ak as TranslationResult, al as Dictionary, am as ValidationResult$1, an as Token } from './transformer-Ckask-yw.cjs';
2
- export { D as AdpositionType, au as DICTIONARY_CATEGORIES, ao as DictionaryCategory, E as ENGLISH_COMMANDS, d as ENGLISH_KEYWORDS, H as GrammarRule, ac as GrammarTransformer, G as GrammaticalMarker, K as KeywordProvider, a as KeywordProviderOptions, Q as LANGUAGE_FAMILY_DEFAULTS, F as LanguageProfile, L as LocaleManager, ar as LocaleMetadata, M as MorphologyType, N as ParsedElement, J as ParsedStatement, P as PatternMatcher, I as PatternTransform, S as SemanticRole, at as TokenType, as as TranslationContext, U as UNIVERSAL_ENGLISH_KEYWORDS, O as UNIVERSAL_PATTERNS, ap as ValidationError, aq as ValidationWarning, W as WordOrder, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as esDictionary, e as esKeywords, ay as findInDictionary, ax as forEachCategory, i as frDictionary, h as frKeywords, aw as getDictionaryCategory, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, av as isDictionaryCategory, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, Y as profiles, B as ptDictionary, A as ptKeywords, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, az as translateFromEnglish, a4 as turkishProfile, q as zhDictionary, z as zhKeywords } from './transformer-Ckask-yw.cjs';
3
- import { Plugin } from 'vite';
1
+ import { I as I18nConfig, T as TranslationOptions, a as TranslationResult, D as Dictionary, V as ValidationResult$1, b as Token } from './types-naTJIIaT.cjs';
2
+ export { h as DICTIONARY_CATEGORIES, c as DictionaryCategory, L as LocaleMetadata, g as TokenType, f as TranslationContext, d as ValidationError, e as ValidationWarning, l as findInDictionary, k as forEachCategory, j as getDictionaryCategory, i as isDictionaryCategory, t as translateFromEnglish } from './types-naTJIIaT.cjs';
3
+ export { ar, de, dictionaries, en, es, fr, getDictionary, id, isLocaleSupported, ja, ko, pt, qu, supportedLocales, sw, tr, zh } from './dictionaries/index.cjs';
4
+ export { D as AdpositionType, E as ENGLISH_COMMANDS, d as ENGLISH_KEYWORDS, H as GrammarRule, ac as GrammarTransformer, G as GrammaticalMarker, K as KeywordProvider, a as KeywordProviderOptions, Q as LANGUAGE_FAMILY_DEFAULTS, F as LanguageProfile, L as LocaleManager, M as MorphologyType, N as ParsedElement, J as ParsedStatement, P as PatternMatcher, I as PatternTransform, S as SemanticRole, U as UNIVERSAL_ENGLISH_KEYWORDS, O as UNIVERSAL_PATTERNS, W as WordOrder, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as esDictionary, e as esKeywords, i as frDictionary, h as frKeywords, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, Y as profiles, B as ptDictionary, A as ptKeywords, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, a4 as turkishProfile, q as zhDictionary, z as zhKeywords } from './transformer-D8MM2_rz.cjs';
5
+ export { hyperscriptI18nVitePlugin } from './plugins/vite.cjs';
6
+ export { HyperscriptI18nWebpackPlugin } from './plugins/webpack.cjs';
4
7
  import { z } from 'zod';
8
+ import 'vite';
5
9
 
6
10
  declare class HyperscriptTranslator {
7
11
  private config;
@@ -28,92 +32,6 @@ declare class HyperscriptTranslator {
28
32
  }): string[];
29
33
  }
30
34
 
31
- /**
32
- * Dictionary Index
33
- *
34
- * Exports dictionaries for all supported languages.
35
- *
36
- * Strategy: Dictionaries are derived from semantic profiles where possible,
37
- * with fallbacks to manual definitions for categories not in profiles
38
- * (events, temporal, some values, attributes).
39
- *
40
- * The semantic package's language profiles are the single source of truth
41
- * for command/modifier/logical keyword translations.
42
- *
43
- * TRANSITION NOTE: Currently using full legacy overrides to preserve
44
- * backward compatibility. Once profiles and dictionaries are synchronized,
45
- * the legacy overrides can be reduced to only non-profile categories.
46
- */
47
-
48
- /**
49
- * English dictionary - uses legacy values for full compatibility.
50
- */
51
- declare const en: Dictionary;
52
- /**
53
- * Spanish dictionary - legacy overrides for compatibility.
54
- */
55
- declare const es: Dictionary;
56
- /**
57
- * Japanese dictionary - legacy overrides for compatibility.
58
- */
59
- declare const ja: Dictionary;
60
- /**
61
- * Korean dictionary - legacy overrides for compatibility.
62
- */
63
- declare const ko: Dictionary;
64
- /**
65
- * Chinese dictionary - legacy overrides for compatibility.
66
- */
67
- declare const zh: Dictionary;
68
- /**
69
- * French dictionary - legacy overrides for compatibility.
70
- */
71
- declare const fr: Dictionary;
72
- /**
73
- * German dictionary - legacy overrides for compatibility.
74
- */
75
- declare const de: Dictionary;
76
- /**
77
- * Arabic dictionary - legacy overrides for compatibility.
78
- */
79
- declare const ar: Dictionary;
80
- /**
81
- * Turkish dictionary - legacy overrides for compatibility.
82
- */
83
- declare const tr: Dictionary;
84
- /**
85
- * Indonesian dictionary - legacy overrides for compatibility.
86
- */
87
- declare const id: Dictionary;
88
- /**
89
- * Portuguese dictionary - legacy overrides for compatibility.
90
- */
91
- declare const pt: Dictionary;
92
- /**
93
- * Quechua dictionary - legacy overrides for compatibility.
94
- */
95
- declare const qu: Dictionary;
96
- /**
97
- * Swahili dictionary - legacy overrides for compatibility.
98
- */
99
- declare const sw: Dictionary;
100
- /**
101
- * All available dictionaries indexed by locale code.
102
- */
103
- declare const dictionaries: Record<string, Dictionary>;
104
- /**
105
- * Get all supported locale codes.
106
- */
107
- declare const supportedLocales: string[];
108
- /**
109
- * Check if a locale is supported.
110
- */
111
- declare const isLocaleSupported: (locale: string) => boolean;
112
- /**
113
- * Get dictionary with fallback to another locale.
114
- */
115
- declare const getDictionary: (locale: string, fallback?: string) => Dictionary | null;
116
-
117
35
  /**
118
36
  * Detect the language of hyperscript text
119
37
  */
@@ -160,39 +78,6 @@ declare function tokenize(text: string, locale: string): Token[];
160
78
 
161
79
  declare function validate(dictionary: Dictionary, locale: string): ValidationResult$1;
162
80
 
163
- interface HyperscriptI18nViteOptions {
164
- sourceLocale?: string;
165
- targetLocale?: string;
166
- preserveOriginal?: boolean;
167
- attributes?: string[];
168
- include?: RegExp | string[];
169
- exclude?: RegExp | string[];
170
- }
171
- declare function hyperscriptI18nVitePlugin(options?: HyperscriptI18nViteOptions): Plugin;
172
-
173
- interface Compiler {
174
- hooks: any;
175
- webpack: any;
176
- }
177
- interface WebpackPluginInstance {
178
- apply(compiler: Compiler): void;
179
- }
180
- interface HyperscriptI18nWebpackOptions {
181
- sourceLocale?: string;
182
- targetLocale?: string;
183
- preserveOriginal?: boolean;
184
- attributes?: string[];
185
- test?: RegExp;
186
- }
187
- declare class HyperscriptI18nWebpackPlugin implements WebpackPluginInstance {
188
- private options;
189
- private translator;
190
- constructor(options?: HyperscriptI18nWebpackOptions);
191
- apply(compiler: Compiler): void;
192
- private processAsset;
193
- private processHtml;
194
- }
195
-
196
81
  /**
197
82
  * SSR integration for i18n support
198
83
  */
@@ -944,4 +829,4 @@ declare const defaultTranslator: HyperscriptTranslator;
944
829
 
945
830
  declare const defaultRuntime: RuntimeI18nManager;
946
831
 
947
- export { type DateFormatOptions, DateFormatter, Dictionary, type EnhancedI18nInput, EnhancedI18nInputSchema, type EnhancedI18nOutput, EnhancedI18nOutputSchema, HyperscriptI18nWebpackPlugin, HyperscriptTranslator, I18nConfig, LocaleFormatter, type NumberFormatOptions, NumberFormatter, PluralAwareTranslator, type PluralForms, type PluralRule, type RelativeTimeFormatOptions, RuntimeI18nManager, type RuntimeI18nOptions, type SSRLocaleContext, SSRLocaleManager, type SSRLocaleOptions, Token, TranslationOptions, TranslationResult, TypedI18nContextImplementation, ValidationResult$1 as ValidationResult, ar, createEnhancedI18n, createExpressI18nMiddleware, createI18nContext, de, defaultRuntime, defaultTranslator, detectLocale, dictionaries, en, enhancedI18nImplementation, es, formatForLocale, fr, getBrowserLocales, getDictionary, getFormatter, getI18n, getPlural, hyperscriptI18nVitePlugin, id, initializeI18n, isLocaleSupported, isRTL, ja, ko, pluralRules, pluralTimeExpressions, pt, qu, runtimeI18n, supportedLocales, sw, tokenize, tr, validate, withI18n, zh };
832
+ export { type DateFormatOptions, DateFormatter, Dictionary, type EnhancedI18nInput, EnhancedI18nInputSchema, type EnhancedI18nOutput, EnhancedI18nOutputSchema, HyperscriptTranslator, I18nConfig, LocaleFormatter, type NumberFormatOptions, NumberFormatter, PluralAwareTranslator, type PluralForms, type PluralRule, type RelativeTimeFormatOptions, RuntimeI18nManager, type RuntimeI18nOptions, type SSRLocaleContext, SSRLocaleManager, type SSRLocaleOptions, Token, TranslationOptions, TranslationResult, TypedI18nContextImplementation, ValidationResult$1 as ValidationResult, createEnhancedI18n, createExpressI18nMiddleware, createI18nContext, defaultRuntime, defaultTranslator, detectLocale, enhancedI18nImplementation, formatForLocale, getBrowserLocales, getFormatter, getI18n, getPlural, initializeI18n, isRTL, pluralRules, pluralTimeExpressions, runtimeI18n, tokenize, validate, withI18n };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- import { ai as I18nConfig, aj as TranslationOptions, ak as TranslationResult, al as Dictionary, am as ValidationResult$1, an as Token } from './transformer-Ckask-yw.js';
2
- export { D as AdpositionType, au as DICTIONARY_CATEGORIES, ao as DictionaryCategory, E as ENGLISH_COMMANDS, d as ENGLISH_KEYWORDS, H as GrammarRule, ac as GrammarTransformer, G as GrammaticalMarker, K as KeywordProvider, a as KeywordProviderOptions, Q as LANGUAGE_FAMILY_DEFAULTS, F as LanguageProfile, L as LocaleManager, ar as LocaleMetadata, M as MorphologyType, N as ParsedElement, J as ParsedStatement, P as PatternMatcher, I as PatternTransform, S as SemanticRole, at as TokenType, as as TranslationContext, U as UNIVERSAL_ENGLISH_KEYWORDS, O as UNIVERSAL_PATTERNS, ap as ValidationError, aq as ValidationWarning, W as WordOrder, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as esDictionary, e as esKeywords, ay as findInDictionary, ax as forEachCategory, i as frDictionary, h as frKeywords, aw as getDictionaryCategory, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, av as isDictionaryCategory, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, Y as profiles, B as ptDictionary, A as ptKeywords, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, az as translateFromEnglish, a4 as turkishProfile, q as zhDictionary, z as zhKeywords } from './transformer-Ckask-yw.js';
3
- import { Plugin } from 'vite';
1
+ import { I as I18nConfig, T as TranslationOptions, a as TranslationResult, D as Dictionary, V as ValidationResult$1, b as Token } from './types-naTJIIaT.js';
2
+ export { h as DICTIONARY_CATEGORIES, c as DictionaryCategory, L as LocaleMetadata, g as TokenType, f as TranslationContext, d as ValidationError, e as ValidationWarning, l as findInDictionary, k as forEachCategory, j as getDictionaryCategory, i as isDictionaryCategory, t as translateFromEnglish } from './types-naTJIIaT.js';
3
+ export { ar, de, dictionaries, en, es, fr, getDictionary, id, isLocaleSupported, ja, ko, pt, qu, supportedLocales, sw, tr, zh } from './dictionaries/index.js';
4
+ export { D as AdpositionType, E as ENGLISH_COMMANDS, d as ENGLISH_KEYWORDS, H as GrammarRule, ac as GrammarTransformer, G as GrammaticalMarker, K as KeywordProvider, a as KeywordProviderOptions, Q as LANGUAGE_FAMILY_DEFAULTS, F as LanguageProfile, L as LocaleManager, M as MorphologyType, N as ParsedElement, J as ParsedStatement, P as PatternMatcher, I as PatternTransform, S as SemanticRole, U as UNIVERSAL_ENGLISH_KEYWORDS, O as UNIVERSAL_PATTERNS, W as WordOrder, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as esDictionary, e as esKeywords, i as frDictionary, h as frKeywords, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, Y as profiles, B as ptDictionary, A as ptKeywords, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, a4 as turkishProfile, q as zhDictionary, z as zhKeywords } from './transformer-BBKJJ2vd.js';
5
+ export { hyperscriptI18nVitePlugin } from './plugins/vite.js';
6
+ export { HyperscriptI18nWebpackPlugin } from './plugins/webpack.js';
4
7
  import { z } from 'zod';
8
+ import 'vite';
5
9
 
6
10
  declare class HyperscriptTranslator {
7
11
  private config;
@@ -28,92 +32,6 @@ declare class HyperscriptTranslator {
28
32
  }): string[];
29
33
  }
30
34
 
31
- /**
32
- * Dictionary Index
33
- *
34
- * Exports dictionaries for all supported languages.
35
- *
36
- * Strategy: Dictionaries are derived from semantic profiles where possible,
37
- * with fallbacks to manual definitions for categories not in profiles
38
- * (events, temporal, some values, attributes).
39
- *
40
- * The semantic package's language profiles are the single source of truth
41
- * for command/modifier/logical keyword translations.
42
- *
43
- * TRANSITION NOTE: Currently using full legacy overrides to preserve
44
- * backward compatibility. Once profiles and dictionaries are synchronized,
45
- * the legacy overrides can be reduced to only non-profile categories.
46
- */
47
-
48
- /**
49
- * English dictionary - uses legacy values for full compatibility.
50
- */
51
- declare const en: Dictionary;
52
- /**
53
- * Spanish dictionary - legacy overrides for compatibility.
54
- */
55
- declare const es: Dictionary;
56
- /**
57
- * Japanese dictionary - legacy overrides for compatibility.
58
- */
59
- declare const ja: Dictionary;
60
- /**
61
- * Korean dictionary - legacy overrides for compatibility.
62
- */
63
- declare const ko: Dictionary;
64
- /**
65
- * Chinese dictionary - legacy overrides for compatibility.
66
- */
67
- declare const zh: Dictionary;
68
- /**
69
- * French dictionary - legacy overrides for compatibility.
70
- */
71
- declare const fr: Dictionary;
72
- /**
73
- * German dictionary - legacy overrides for compatibility.
74
- */
75
- declare const de: Dictionary;
76
- /**
77
- * Arabic dictionary - legacy overrides for compatibility.
78
- */
79
- declare const ar: Dictionary;
80
- /**
81
- * Turkish dictionary - legacy overrides for compatibility.
82
- */
83
- declare const tr: Dictionary;
84
- /**
85
- * Indonesian dictionary - legacy overrides for compatibility.
86
- */
87
- declare const id: Dictionary;
88
- /**
89
- * Portuguese dictionary - legacy overrides for compatibility.
90
- */
91
- declare const pt: Dictionary;
92
- /**
93
- * Quechua dictionary - legacy overrides for compatibility.
94
- */
95
- declare const qu: Dictionary;
96
- /**
97
- * Swahili dictionary - legacy overrides for compatibility.
98
- */
99
- declare const sw: Dictionary;
100
- /**
101
- * All available dictionaries indexed by locale code.
102
- */
103
- declare const dictionaries: Record<string, Dictionary>;
104
- /**
105
- * Get all supported locale codes.
106
- */
107
- declare const supportedLocales: string[];
108
- /**
109
- * Check if a locale is supported.
110
- */
111
- declare const isLocaleSupported: (locale: string) => boolean;
112
- /**
113
- * Get dictionary with fallback to another locale.
114
- */
115
- declare const getDictionary: (locale: string, fallback?: string) => Dictionary | null;
116
-
117
35
  /**
118
36
  * Detect the language of hyperscript text
119
37
  */
@@ -160,39 +78,6 @@ declare function tokenize(text: string, locale: string): Token[];
160
78
 
161
79
  declare function validate(dictionary: Dictionary, locale: string): ValidationResult$1;
162
80
 
163
- interface HyperscriptI18nViteOptions {
164
- sourceLocale?: string;
165
- targetLocale?: string;
166
- preserveOriginal?: boolean;
167
- attributes?: string[];
168
- include?: RegExp | string[];
169
- exclude?: RegExp | string[];
170
- }
171
- declare function hyperscriptI18nVitePlugin(options?: HyperscriptI18nViteOptions): Plugin;
172
-
173
- interface Compiler {
174
- hooks: any;
175
- webpack: any;
176
- }
177
- interface WebpackPluginInstance {
178
- apply(compiler: Compiler): void;
179
- }
180
- interface HyperscriptI18nWebpackOptions {
181
- sourceLocale?: string;
182
- targetLocale?: string;
183
- preserveOriginal?: boolean;
184
- attributes?: string[];
185
- test?: RegExp;
186
- }
187
- declare class HyperscriptI18nWebpackPlugin implements WebpackPluginInstance {
188
- private options;
189
- private translator;
190
- constructor(options?: HyperscriptI18nWebpackOptions);
191
- apply(compiler: Compiler): void;
192
- private processAsset;
193
- private processHtml;
194
- }
195
-
196
81
  /**
197
82
  * SSR integration for i18n support
198
83
  */
@@ -944,4 +829,4 @@ declare const defaultTranslator: HyperscriptTranslator;
944
829
 
945
830
  declare const defaultRuntime: RuntimeI18nManager;
946
831
 
947
- export { type DateFormatOptions, DateFormatter, Dictionary, type EnhancedI18nInput, EnhancedI18nInputSchema, type EnhancedI18nOutput, EnhancedI18nOutputSchema, HyperscriptI18nWebpackPlugin, HyperscriptTranslator, I18nConfig, LocaleFormatter, type NumberFormatOptions, NumberFormatter, PluralAwareTranslator, type PluralForms, type PluralRule, type RelativeTimeFormatOptions, RuntimeI18nManager, type RuntimeI18nOptions, type SSRLocaleContext, SSRLocaleManager, type SSRLocaleOptions, Token, TranslationOptions, TranslationResult, TypedI18nContextImplementation, ValidationResult$1 as ValidationResult, ar, createEnhancedI18n, createExpressI18nMiddleware, createI18nContext, de, defaultRuntime, defaultTranslator, detectLocale, dictionaries, en, enhancedI18nImplementation, es, formatForLocale, fr, getBrowserLocales, getDictionary, getFormatter, getI18n, getPlural, hyperscriptI18nVitePlugin, id, initializeI18n, isLocaleSupported, isRTL, ja, ko, pluralRules, pluralTimeExpressions, pt, qu, runtimeI18n, supportedLocales, sw, tokenize, tr, validate, withI18n, zh };
832
+ export { type DateFormatOptions, DateFormatter, Dictionary, type EnhancedI18nInput, EnhancedI18nInputSchema, type EnhancedI18nOutput, EnhancedI18nOutputSchema, HyperscriptTranslator, I18nConfig, LocaleFormatter, type NumberFormatOptions, NumberFormatter, PluralAwareTranslator, type PluralForms, type PluralRule, type RelativeTimeFormatOptions, RuntimeI18nManager, type RuntimeI18nOptions, type SSRLocaleContext, SSRLocaleManager, type SSRLocaleOptions, Token, TranslationOptions, TranslationResult, TypedI18nContextImplementation, ValidationResult$1 as ValidationResult, createEnhancedI18n, createExpressI18nMiddleware, createI18nContext, defaultRuntime, defaultTranslator, detectLocale, enhancedI18nImplementation, formatForLocale, getBrowserLocales, getFormatter, getI18n, getPlural, initializeI18n, isRTL, pluralRules, pluralTimeExpressions, runtimeI18n, tokenize, validate, withI18n };