@lokascript/i18n 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +286 -0
- package/dist/browser.cjs +7669 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +50 -0
- package/dist/browser.d.ts +50 -0
- package/dist/browser.js +7592 -0
- package/dist/browser.js.map +1 -0
- package/dist/hyperfixi-i18n.min.js +2 -0
- package/dist/hyperfixi-i18n.min.js.map +1 -0
- package/dist/hyperfixi-i18n.mjs +8558 -0
- package/dist/hyperfixi-i18n.mjs.map +1 -0
- package/dist/index.cjs +14205 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +947 -0
- package/dist/index.d.ts +947 -0
- package/dist/index.js +14095 -0
- package/dist/index.js.map +1 -0
- package/dist/transformer-Ckask-yw.d.cts +1041 -0
- package/dist/transformer-Ckask-yw.d.ts +1041 -0
- package/package.json +84 -0
- package/src/browser.ts +122 -0
- package/src/compatibility/browser-tests/grammar-demo.spec.ts +169 -0
- package/src/constants.ts +366 -0
- package/src/dictionaries/ar.ts +233 -0
- package/src/dictionaries/bn.ts +156 -0
- package/src/dictionaries/de.ts +233 -0
- package/src/dictionaries/derive.ts +515 -0
- package/src/dictionaries/en.ts +237 -0
- package/src/dictionaries/es.ts +233 -0
- package/src/dictionaries/fr.ts +233 -0
- package/src/dictionaries/hi.ts +270 -0
- package/src/dictionaries/id.ts +233 -0
- package/src/dictionaries/index.ts +238 -0
- package/src/dictionaries/it.ts +233 -0
- package/src/dictionaries/ja.ts +233 -0
- package/src/dictionaries/ko.ts +233 -0
- package/src/dictionaries/ms.ts +276 -0
- package/src/dictionaries/pl.ts +239 -0
- package/src/dictionaries/pt.ts +237 -0
- package/src/dictionaries/qu.ts +233 -0
- package/src/dictionaries/ru.ts +270 -0
- package/src/dictionaries/sw.ts +233 -0
- package/src/dictionaries/th.ts +156 -0
- package/src/dictionaries/tl.ts +276 -0
- package/src/dictionaries/tr.ts +233 -0
- package/src/dictionaries/uk.ts +270 -0
- package/src/dictionaries/vi.ts +210 -0
- package/src/dictionaries/zh.ts +233 -0
- package/src/enhanced-i18n.test.ts +454 -0
- package/src/enhanced-i18n.ts +713 -0
- package/src/examples/new-languages.ts +326 -0
- package/src/formatting.test.ts +213 -0
- package/src/formatting.ts +416 -0
- package/src/grammar/direct-mappings.ts +353 -0
- package/src/grammar/grammar.test.ts +1053 -0
- package/src/grammar/index.ts +59 -0
- package/src/grammar/profiles/index.ts +860 -0
- package/src/grammar/transformer.ts +1318 -0
- package/src/grammar/types.ts +630 -0
- package/src/index.ts +202 -0
- package/src/new-languages.test.ts +389 -0
- package/src/parser/analyze-conflicts.test.ts +229 -0
- package/src/parser/ar.ts +40 -0
- package/src/parser/create-provider.ts +309 -0
- package/src/parser/de.ts +36 -0
- package/src/parser/es.ts +31 -0
- package/src/parser/fr.ts +31 -0
- package/src/parser/id.ts +34 -0
- package/src/parser/index.ts +50 -0
- package/src/parser/ja.ts +36 -0
- package/src/parser/ko.ts +37 -0
- package/src/parser/locale-manager.test.ts +198 -0
- package/src/parser/locale-manager.ts +197 -0
- package/src/parser/parser-integration.test.ts +439 -0
- package/src/parser/pt.ts +37 -0
- package/src/parser/qu.ts +37 -0
- package/src/parser/sw.ts +37 -0
- package/src/parser/tr.ts +38 -0
- package/src/parser/types.ts +113 -0
- package/src/parser/zh.ts +38 -0
- package/src/plugins/vite.ts +224 -0
- package/src/plugins/webpack.ts +124 -0
- package/src/pluralization.test.ts +197 -0
- package/src/pluralization.ts +393 -0
- package/src/runtime.ts +441 -0
- package/src/ssr-integration.ts +225 -0
- package/src/test-setup.ts +195 -0
- package/src/translation-validation.test.ts +171 -0
- package/src/translator.test.ts +252 -0
- package/src/translator.ts +297 -0
- package/src/types.ts +209 -0
- package/src/utils/locale.ts +190 -0
- package/src/utils/tokenizer-adapter.ts +469 -0
- package/src/utils/tokenizer.ts +19 -0
- package/src/validators/index.ts +174 -0
- package/src/validators/schema.ts +129 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
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 ar, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as de, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as es, f as esDictionary, e as esKeywords, i as fr, i as frDictionary, h as frKeywords, a7 as frenchProfile, a6 as germanProfile, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as id, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, g as ja, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, V as joinTokens, p as ko, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, a8 as portugueseProfile, Y as profiles, B as pt, B as ptDictionary, A as ptKeywords, w as qu, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as sw, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as tr, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, a4 as turkishProfile, q as zh, q as zhDictionary, z as zhKeywords } from './transformer-Ckask-yw.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct Language-Pair Mappings
|
|
5
|
+
*
|
|
6
|
+
* Enables translation between language pairs without English pivot.
|
|
7
|
+
* This reduces error compounding and provides more natural translations
|
|
8
|
+
* for closely related languages or those with shared vocabulary.
|
|
9
|
+
*
|
|
10
|
+
* Currently supported pairs:
|
|
11
|
+
* - Japanese ↔ Chinese (shared Kanji concepts)
|
|
12
|
+
* - Spanish ↔ Portuguese (Romance language mutual intelligibility)
|
|
13
|
+
* - Korean ↔ Japanese (SOV grammar similarity)
|
|
14
|
+
*/
|
|
15
|
+
interface DirectMapping {
|
|
16
|
+
/** Source language code */
|
|
17
|
+
source: string;
|
|
18
|
+
/** Target language code */
|
|
19
|
+
target: string;
|
|
20
|
+
/** Word mappings: source word -> target word */
|
|
21
|
+
words: Record<string, string>;
|
|
22
|
+
/** Category mappings for structured translation */
|
|
23
|
+
categories?: Record<string, Record<string, string>>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registry of direct translation pairs.
|
|
27
|
+
* Key format: "source->target" (e.g., "ja->zh")
|
|
28
|
+
*/
|
|
29
|
+
declare const directMappings: Map<string, DirectMapping>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if direct mapping exists for a language pair
|
|
32
|
+
*/
|
|
33
|
+
declare function hasDirectMapping(source: string, target: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get direct mapping for a language pair
|
|
36
|
+
*/
|
|
37
|
+
declare function getDirectMapping(source: string, target: string): DirectMapping | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Translate a single word using direct mapping
|
|
40
|
+
*/
|
|
41
|
+
declare function translateWordDirect(word: string, source: string, target: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Get all supported direct translation pairs
|
|
44
|
+
*/
|
|
45
|
+
declare function getSupportedDirectPairs(): Array<{
|
|
46
|
+
source: string;
|
|
47
|
+
target: string;
|
|
48
|
+
}>;
|
|
49
|
+
|
|
50
|
+
export { directMappings, getDirectMapping, getSupportedDirectPairs, hasDirectMapping, translateWordDirect };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
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 ar, n as arDictionary, m as arKeywords, a3 as arabicProfile, a2 as chineseProfile, b as createEnglishProvider, c as createKeywordProvider, l as de, l as deDictionary, k as deKeywords, C as detectBrowserLocale, $ as englishProfile, f as es, f as esDictionary, e as esKeywords, i as fr, i as frDictionary, h as frKeywords, a7 as frenchProfile, a6 as germanProfile, Z as getProfile, _ as getSupportedLocales, ah as grammarExamples, u as id, u as idDictionary, s as idKeywords, a9 as indonesianProfile, T as insertMarkers, g as ja, g as jaDictionary, j as jaKeywords, a0 as japaneseProfile, V as joinTokens, p as ko, p as koDictionary, o as koKeywords, a1 as koreanProfile, ad as parseStatement, a8 as portugueseProfile, Y as profiles, B as pt, B as ptDictionary, A as ptKeywords, w as qu, w as quDictionary, v as quKeywords, aa as quechuaProfile, R as reorderRoles, a5 as spanishProfile, y as sw, y as swDictionary, x as swKeywords, ab as swahiliProfile, af as toEnglish, ae as toLocale, r as tr, r as trDictionary, t as trKeywords, X as transformStatement, ag as translate, a4 as turkishProfile, q as zh, q as zhDictionary, z as zhKeywords } from './transformer-Ckask-yw.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct Language-Pair Mappings
|
|
5
|
+
*
|
|
6
|
+
* Enables translation between language pairs without English pivot.
|
|
7
|
+
* This reduces error compounding and provides more natural translations
|
|
8
|
+
* for closely related languages or those with shared vocabulary.
|
|
9
|
+
*
|
|
10
|
+
* Currently supported pairs:
|
|
11
|
+
* - Japanese ↔ Chinese (shared Kanji concepts)
|
|
12
|
+
* - Spanish ↔ Portuguese (Romance language mutual intelligibility)
|
|
13
|
+
* - Korean ↔ Japanese (SOV grammar similarity)
|
|
14
|
+
*/
|
|
15
|
+
interface DirectMapping {
|
|
16
|
+
/** Source language code */
|
|
17
|
+
source: string;
|
|
18
|
+
/** Target language code */
|
|
19
|
+
target: string;
|
|
20
|
+
/** Word mappings: source word -> target word */
|
|
21
|
+
words: Record<string, string>;
|
|
22
|
+
/** Category mappings for structured translation */
|
|
23
|
+
categories?: Record<string, Record<string, string>>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registry of direct translation pairs.
|
|
27
|
+
* Key format: "source->target" (e.g., "ja->zh")
|
|
28
|
+
*/
|
|
29
|
+
declare const directMappings: Map<string, DirectMapping>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if direct mapping exists for a language pair
|
|
32
|
+
*/
|
|
33
|
+
declare function hasDirectMapping(source: string, target: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get direct mapping for a language pair
|
|
36
|
+
*/
|
|
37
|
+
declare function getDirectMapping(source: string, target: string): DirectMapping | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Translate a single word using direct mapping
|
|
40
|
+
*/
|
|
41
|
+
declare function translateWordDirect(word: string, source: string, target: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Get all supported direct translation pairs
|
|
44
|
+
*/
|
|
45
|
+
declare function getSupportedDirectPairs(): Array<{
|
|
46
|
+
source: string;
|
|
47
|
+
target: string;
|
|
48
|
+
}>;
|
|
49
|
+
|
|
50
|
+
export { directMappings, getDirectMapping, getSupportedDirectPairs, hasDirectMapping, translateWordDirect };
|