@lokascript/i18n 3.2.0 → 4.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/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -5
- package/dist/browser.d.ts +4 -5
- package/dist/browser.js.map +1 -1
- package/dist/{index-DuIef8O7.d.ts → index-BvvoluMH.d.ts} +31 -47
- package/dist/{index-BykxjYST.d.cts → index-C4L2RKNl.d.cts} +31 -47
- package/dist/index.cjs +19367 -3750
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -258
- package/dist/index.d.ts +34 -258
- package/dist/index.js +19367 -3750
- package/dist/index.js.map +1 -1
- package/dist/lokascript-i18n.min.js.map +1 -1
- package/dist/lokascript-i18n.mjs +27 -45
- package/dist/lokascript-i18n.mjs.map +1 -1
- package/package.json +4 -4
- package/src/browser.ts +4 -7
- package/src/compatibility/browser-tests/grammar-demo.spec.ts +1 -1
- package/src/grammar/index.ts +5 -4
- package/src/grammar/profiles.test.ts +3 -2
- package/src/parser/ar.ts +2 -3
- package/src/parser/de.ts +2 -3
- package/src/parser/es.ts +2 -3
- package/src/parser/fr.ts +2 -3
- package/src/parser/he.ts +2 -3
- package/src/parser/id.ts +2 -3
- package/src/parser/index.ts +4 -6
- package/src/parser/ja.ts +2 -3
- package/src/parser/ko.ts +2 -3
- package/src/parser/locale-manager.ts +2 -6
- package/src/parser/pt.ts +2 -3
- package/src/parser/qu.ts +2 -3
- package/src/parser/sw.ts +2 -3
- package/src/parser/tr.ts +2 -3
- package/src/parser/types.ts +6 -5
- package/src/parser/zh.ts +1 -3
package/dist/lokascript-i18n.mjs
CHANGED
|
@@ -715,10 +715,9 @@ const es = {
|
|
|
715
715
|
* @example
|
|
716
716
|
* ```typescript
|
|
717
717
|
* import { esKeywords } from '@lokascript/i18n/parser/es';
|
|
718
|
-
* import { Parser } from '@hyperfixi/core';
|
|
719
718
|
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
719
|
+
* esKeywords.resolve('alternar'); // 'toggle'
|
|
720
|
+
* esKeywords.toLocale('on'); // 'en'
|
|
722
721
|
* ```
|
|
723
722
|
*/
|
|
724
723
|
const esKeywords = createKeywordProvider(es, 'es', {
|
|
@@ -960,10 +959,9 @@ const ja = {
|
|
|
960
959
|
* @example
|
|
961
960
|
* ```typescript
|
|
962
961
|
* import { jaKeywords } from '@lokascript/i18n/parser/ja';
|
|
963
|
-
* import { Parser } from '@hyperfixi/core';
|
|
964
962
|
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
963
|
+
* jaKeywords.resolve('\u5207\u308a\u66ff\u3048'); // 'toggle'
|
|
964
|
+
* jaKeywords.toLocale('on'); // '\u3067'
|
|
967
965
|
* ```
|
|
968
966
|
*/
|
|
969
967
|
const jaKeywords = createKeywordProvider(ja, 'ja', {
|
|
@@ -1199,10 +1197,9 @@ const fr = {
|
|
|
1199
1197
|
* @example
|
|
1200
1198
|
* ```typescript
|
|
1201
1199
|
* import { frKeywords } from '@lokascript/i18n/parser/fr';
|
|
1202
|
-
* import { Parser } from '@hyperfixi/core';
|
|
1203
1200
|
*
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1201
|
+
* frKeywords.resolve('basculer'); // 'toggle'
|
|
1202
|
+
* frKeywords.toLocale('on'); // 'sur'
|
|
1206
1203
|
* ```
|
|
1207
1204
|
*/
|
|
1208
1205
|
const frKeywords = createKeywordProvider(fr, 'fr', {
|
|
@@ -1459,10 +1456,9 @@ const de = {
|
|
|
1459
1456
|
* @example
|
|
1460
1457
|
* ```typescript
|
|
1461
1458
|
* import { deKeywords } from '@lokascript/i18n/parser/de';
|
|
1462
|
-
* import { Parser } from '@hyperfixi/core';
|
|
1463
1459
|
*
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1460
|
+
* deKeywords.resolve('umschalten'); // 'toggle'
|
|
1461
|
+
* deKeywords.toLocale('on'); // 'bei'
|
|
1466
1462
|
* ```
|
|
1467
1463
|
*/
|
|
1468
1464
|
const deKeywords = createKeywordProvider(de, 'de', {
|
|
@@ -1704,10 +1700,9 @@ const ar = {
|
|
|
1704
1700
|
* @example
|
|
1705
1701
|
* ```typescript
|
|
1706
1702
|
* import { arKeywords } from '@lokascript/i18n/parser/ar';
|
|
1707
|
-
* import { Parser } from '@hyperfixi/core';
|
|
1708
1703
|
*
|
|
1709
|
-
*
|
|
1710
|
-
*
|
|
1704
|
+
* arKeywords.resolve('\u0628\u062f\u0644'); // 'toggle'
|
|
1705
|
+
* arKeywords.toLocale('on'); // '\u0639\u0644\u0649'
|
|
1711
1706
|
* ```
|
|
1712
1707
|
*/
|
|
1713
1708
|
const arKeywords = createKeywordProvider(ar, 'ar', {
|
|
@@ -1946,10 +1941,9 @@ const ko = {
|
|
|
1946
1941
|
* @example
|
|
1947
1942
|
* ```typescript
|
|
1948
1943
|
* import { koKeywords } from '@lokascript/i18n/parser/ko';
|
|
1949
|
-
* import { Parser } from '@hyperfixi/core';
|
|
1950
1944
|
*
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1945
|
+
* koKeywords.resolve('\ud1a0\uae00'); // 'toggle'
|
|
1946
|
+
* koKeywords.toLocale('on'); // '\uc5d0'
|
|
1953
1947
|
* ```
|
|
1954
1948
|
*/
|
|
1955
1949
|
const koKeywords = createKeywordProvider(ko, 'ko', {
|
|
@@ -2202,10 +2196,8 @@ const zh = {
|
|
|
2202
2196
|
* @example
|
|
2203
2197
|
* ```typescript
|
|
2204
2198
|
* import { zhKeywords } from '@lokascript/i18n/parser/zh';
|
|
2205
|
-
* import { Parser } from '@hyperfixi/core';
|
|
2206
2199
|
*
|
|
2207
|
-
*
|
|
2208
|
-
* parser.parse('\u5f53 \u70b9\u51fb \u5207\u6362 .active');
|
|
2200
|
+
* zhKeywords.resolve('\u5207\u6362'); // 'toggle'
|
|
2209
2201
|
* ```
|
|
2210
2202
|
*/
|
|
2211
2203
|
const zhKeywords = createKeywordProvider(zh, 'zh', {
|
|
@@ -2458,10 +2450,9 @@ const tr = {
|
|
|
2458
2450
|
* @example
|
|
2459
2451
|
* ```typescript
|
|
2460
2452
|
* import { trKeywords } from '@lokascript/i18n/parser/tr';
|
|
2461
|
-
* import { Parser } from '@hyperfixi/core';
|
|
2462
2453
|
*
|
|
2463
|
-
*
|
|
2464
|
-
*
|
|
2454
|
+
* trKeywords.resolve('de\u011fi\u015ftir'); // 'toggle'
|
|
2455
|
+
* trKeywords.toLocale('on'); // '\u00fczerinde'
|
|
2465
2456
|
* ```
|
|
2466
2457
|
*/
|
|
2467
2458
|
const trKeywords = createKeywordProvider(tr, 'tr', {
|
|
@@ -2709,10 +2700,9 @@ const id = {
|
|
|
2709
2700
|
* @example
|
|
2710
2701
|
* ```typescript
|
|
2711
2702
|
* import { idKeywords } from '@lokascript/i18n/parser/id';
|
|
2712
|
-
* import { Parser } from '@hyperfixi/core';
|
|
2713
2703
|
*
|
|
2714
|
-
*
|
|
2715
|
-
*
|
|
2704
|
+
* idKeywords.resolve('alihkan'); // 'toggle'
|
|
2705
|
+
* idKeywords.toLocale('on'); // 'pada'
|
|
2716
2706
|
* ```
|
|
2717
2707
|
*/
|
|
2718
2708
|
const idKeywords = createKeywordProvider(id, 'id', {
|
|
@@ -2976,10 +2966,9 @@ const qu = {
|
|
|
2976
2966
|
* @example
|
|
2977
2967
|
* ```typescript
|
|
2978
2968
|
* import { quKeywords } from '@lokascript/i18n/parser/qu';
|
|
2979
|
-
* import { Parser } from '@hyperfixi/core';
|
|
2980
2969
|
*
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2970
|
+
* quKeywords.resolve('tikray'); // 'toggle'
|
|
2971
|
+
* quKeywords.toLocale('on'); // 'kaqpi'
|
|
2983
2972
|
* ```
|
|
2984
2973
|
*/
|
|
2985
2974
|
const quKeywords = createKeywordProvider(qu, 'qu', {
|
|
@@ -3250,10 +3239,9 @@ const sw = {
|
|
|
3250
3239
|
* @example
|
|
3251
3240
|
* ```typescript
|
|
3252
3241
|
* import { swKeywords } from '@lokascript/i18n/parser/sw';
|
|
3253
|
-
* import { Parser } from '@hyperfixi/core';
|
|
3254
3242
|
*
|
|
3255
|
-
*
|
|
3256
|
-
*
|
|
3243
|
+
* swKeywords.resolve('badilisha'); // 'toggle'
|
|
3244
|
+
* swKeywords.toLocale('on'); // 'kwenye'
|
|
3257
3245
|
* ```
|
|
3258
3246
|
*/
|
|
3259
3247
|
const swKeywords = createKeywordProvider(sw, 'sw', {
|
|
@@ -3496,10 +3484,9 @@ const pt = {
|
|
|
3496
3484
|
* @example
|
|
3497
3485
|
* ```typescript
|
|
3498
3486
|
* import { ptKeywords } from '@lokascript/i18n/parser/pt';
|
|
3499
|
-
* import { Parser } from '@hyperfixi/core';
|
|
3500
3487
|
*
|
|
3501
|
-
*
|
|
3502
|
-
*
|
|
3488
|
+
* ptKeywords.resolve('alternar'); // 'toggle'
|
|
3489
|
+
* ptKeywords.toLocale('on'); // 'em'
|
|
3503
3490
|
* ```
|
|
3504
3491
|
*/
|
|
3505
3492
|
const ptKeywords = createKeywordProvider(pt, 'pt', {
|
|
@@ -5862,10 +5849,9 @@ const he = {
|
|
|
5862
5849
|
* @example
|
|
5863
5850
|
* ```typescript
|
|
5864
5851
|
* import { heKeywords } from '@lokascript/i18n/parser/he';
|
|
5865
|
-
* import { Parser } from '@hyperfixi/core';
|
|
5866
5852
|
*
|
|
5867
|
-
*
|
|
5868
|
-
*
|
|
5853
|
+
* heKeywords.resolve('\u05de\u05ea\u05d2'); // 'toggle'
|
|
5854
|
+
* heKeywords.toLocale('on'); // '\u05d1'
|
|
5869
5855
|
* ```
|
|
5870
5856
|
*/
|
|
5871
5857
|
const heKeywords = createKeywordProvider(he, 'he', {
|
|
@@ -5896,9 +5882,6 @@ const heKeywords = createKeywordProvider(he, 'he', {
|
|
|
5896
5882
|
* // Get keyword provider for parsing
|
|
5897
5883
|
* const provider = LocaleManager.get(); // Returns esKeywords
|
|
5898
5884
|
* const frProvider = LocaleManager.get('fr'); // Returns frKeywords
|
|
5899
|
-
*
|
|
5900
|
-
* // Use with parser
|
|
5901
|
-
* const parser = new Parser({ keywords: LocaleManager.get() });
|
|
5902
5885
|
* ```
|
|
5903
5886
|
*/
|
|
5904
5887
|
class LocaleManager {
|
|
@@ -6022,10 +6005,9 @@ LocaleManager.englishProvider = createEnglishProvider();
|
|
|
6022
6005
|
* @example
|
|
6023
6006
|
* ```typescript
|
|
6024
6007
|
* import { detectBrowserLocale } from '@lokascript/i18n/parser';
|
|
6025
|
-
* import { Parser } from '@hyperfixi/core';
|
|
6026
6008
|
*
|
|
6027
|
-
* //
|
|
6028
|
-
*
|
|
6009
|
+
* // The provider for the browser's language (navigator.languages), or English
|
|
6010
|
+
* detectBrowserLocale().locale; // e.g. 'es'
|
|
6029
6011
|
* ```
|
|
6030
6012
|
*/
|
|
6031
6013
|
function detectBrowserLocale() {
|