@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.
Files changed (96) hide show
  1. package/README.md +286 -0
  2. package/dist/browser.cjs +7669 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.cts +50 -0
  5. package/dist/browser.d.ts +50 -0
  6. package/dist/browser.js +7592 -0
  7. package/dist/browser.js.map +1 -0
  8. package/dist/hyperfixi-i18n.min.js +2 -0
  9. package/dist/hyperfixi-i18n.min.js.map +1 -0
  10. package/dist/hyperfixi-i18n.mjs +8558 -0
  11. package/dist/hyperfixi-i18n.mjs.map +1 -0
  12. package/dist/index.cjs +14205 -0
  13. package/dist/index.cjs.map +1 -0
  14. package/dist/index.d.cts +947 -0
  15. package/dist/index.d.ts +947 -0
  16. package/dist/index.js +14095 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/transformer-Ckask-yw.d.cts +1041 -0
  19. package/dist/transformer-Ckask-yw.d.ts +1041 -0
  20. package/package.json +84 -0
  21. package/src/browser.ts +122 -0
  22. package/src/compatibility/browser-tests/grammar-demo.spec.ts +169 -0
  23. package/src/constants.ts +366 -0
  24. package/src/dictionaries/ar.ts +233 -0
  25. package/src/dictionaries/bn.ts +156 -0
  26. package/src/dictionaries/de.ts +233 -0
  27. package/src/dictionaries/derive.ts +515 -0
  28. package/src/dictionaries/en.ts +237 -0
  29. package/src/dictionaries/es.ts +233 -0
  30. package/src/dictionaries/fr.ts +233 -0
  31. package/src/dictionaries/hi.ts +270 -0
  32. package/src/dictionaries/id.ts +233 -0
  33. package/src/dictionaries/index.ts +238 -0
  34. package/src/dictionaries/it.ts +233 -0
  35. package/src/dictionaries/ja.ts +233 -0
  36. package/src/dictionaries/ko.ts +233 -0
  37. package/src/dictionaries/ms.ts +276 -0
  38. package/src/dictionaries/pl.ts +239 -0
  39. package/src/dictionaries/pt.ts +237 -0
  40. package/src/dictionaries/qu.ts +233 -0
  41. package/src/dictionaries/ru.ts +270 -0
  42. package/src/dictionaries/sw.ts +233 -0
  43. package/src/dictionaries/th.ts +156 -0
  44. package/src/dictionaries/tl.ts +276 -0
  45. package/src/dictionaries/tr.ts +233 -0
  46. package/src/dictionaries/uk.ts +270 -0
  47. package/src/dictionaries/vi.ts +210 -0
  48. package/src/dictionaries/zh.ts +233 -0
  49. package/src/enhanced-i18n.test.ts +454 -0
  50. package/src/enhanced-i18n.ts +713 -0
  51. package/src/examples/new-languages.ts +326 -0
  52. package/src/formatting.test.ts +213 -0
  53. package/src/formatting.ts +416 -0
  54. package/src/grammar/direct-mappings.ts +353 -0
  55. package/src/grammar/grammar.test.ts +1053 -0
  56. package/src/grammar/index.ts +59 -0
  57. package/src/grammar/profiles/index.ts +860 -0
  58. package/src/grammar/transformer.ts +1318 -0
  59. package/src/grammar/types.ts +630 -0
  60. package/src/index.ts +202 -0
  61. package/src/new-languages.test.ts +389 -0
  62. package/src/parser/analyze-conflicts.test.ts +229 -0
  63. package/src/parser/ar.ts +40 -0
  64. package/src/parser/create-provider.ts +309 -0
  65. package/src/parser/de.ts +36 -0
  66. package/src/parser/es.ts +31 -0
  67. package/src/parser/fr.ts +31 -0
  68. package/src/parser/id.ts +34 -0
  69. package/src/parser/index.ts +50 -0
  70. package/src/parser/ja.ts +36 -0
  71. package/src/parser/ko.ts +37 -0
  72. package/src/parser/locale-manager.test.ts +198 -0
  73. package/src/parser/locale-manager.ts +197 -0
  74. package/src/parser/parser-integration.test.ts +439 -0
  75. package/src/parser/pt.ts +37 -0
  76. package/src/parser/qu.ts +37 -0
  77. package/src/parser/sw.ts +37 -0
  78. package/src/parser/tr.ts +38 -0
  79. package/src/parser/types.ts +113 -0
  80. package/src/parser/zh.ts +38 -0
  81. package/src/plugins/vite.ts +224 -0
  82. package/src/plugins/webpack.ts +124 -0
  83. package/src/pluralization.test.ts +197 -0
  84. package/src/pluralization.ts +393 -0
  85. package/src/runtime.ts +441 -0
  86. package/src/ssr-integration.ts +225 -0
  87. package/src/test-setup.ts +195 -0
  88. package/src/translation-validation.test.ts +171 -0
  89. package/src/translator.test.ts +252 -0
  90. package/src/translator.ts +297 -0
  91. package/src/types.ts +209 -0
  92. package/src/utils/locale.ts +190 -0
  93. package/src/utils/tokenizer-adapter.ts +469 -0
  94. package/src/utils/tokenizer.ts +19 -0
  95. package/src/validators/index.ts +174 -0
  96. package/src/validators/schema.ts +129 -0
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Hindi Dictionary
3
+ *
4
+ * Translations for Hindi language support.
5
+ * Uses imperative verb forms (common in software UIs).
6
+ */
7
+
8
+ import { Dictionary } from '../types';
9
+
10
+ export const hindiDictionary: Dictionary = {
11
+ commands: {
12
+ // Event handling
13
+ on: 'पर',
14
+ tell: 'बताएं',
15
+ trigger: 'ट्रिगर',
16
+ send: 'भेजें',
17
+
18
+ // DOM manipulation
19
+ take: 'लें',
20
+ put: 'रखें',
21
+ set: 'सेट',
22
+ get: 'प्राप्त',
23
+ add: 'जोड़ें',
24
+ remove: 'हटाएं',
25
+ toggle: 'टॉगल',
26
+ hide: 'छिपाएं',
27
+ show: 'दिखाएं',
28
+
29
+ // Control flow
30
+ if: 'अगर',
31
+ unless: 'जब_तक_नहीं',
32
+ repeat: 'दोहराएं',
33
+ for: 'के_लिए',
34
+ while: 'जब_तक',
35
+ until: 'तक',
36
+ continue: 'जारी',
37
+ break: 'रोकें',
38
+ halt: 'रोकें',
39
+
40
+ // Async
41
+ wait: 'प्रतीक्षा',
42
+ fetch: 'लाएं',
43
+ call: 'कॉल',
44
+ return: 'लौटाएं',
45
+
46
+ // Other commands
47
+ make: 'बनाएं',
48
+ log: 'लॉग',
49
+ throw: 'फेंकें',
50
+ catch: 'पकड़ें',
51
+ measure: 'मापें',
52
+ transition: 'संक्रमण',
53
+
54
+ // Data Commands
55
+ increment: 'बढ़ाएं',
56
+ decrement: 'घटाएं',
57
+ bind: 'बाँधें',
58
+ default: 'डिफ़ॉल्ट',
59
+ persist: 'सहेजें',
60
+
61
+ // Navigation Commands
62
+ go: 'जाएं',
63
+ pushUrl: 'url_जोड़ें',
64
+ replaceUrl: 'url_बदलें',
65
+
66
+ // Utility Commands
67
+ copy: 'कॉपी',
68
+ pick: 'चुनें',
69
+ beep: 'बीप',
70
+
71
+ // Advanced Commands
72
+ js: 'जेएस',
73
+ async: 'असिंक',
74
+ render: 'रेंडर',
75
+
76
+ // Animation Commands
77
+ swap: 'बदलें',
78
+ morph: 'रूपांतर',
79
+ settle: 'स्थिर',
80
+
81
+ // Content Commands
82
+ append: 'जोड़ें_अंत',
83
+
84
+ // Control Flow
85
+ exit: 'बाहर',
86
+ else: 'वरना',
87
+
88
+ // Behaviors
89
+ install: 'इंस्टॉल',
90
+ init: 'प्रारंभ',
91
+ behavior: 'व्यवहार',
92
+
93
+ // Focus
94
+ focus: 'फोकस',
95
+ blur: 'धुंधला',
96
+
97
+ // Clone
98
+ clone: 'कॉपी',
99
+ prepend: 'जोड़ें_शुरू',
100
+ },
101
+
102
+ modifiers: {
103
+ to: 'को',
104
+ from: 'से',
105
+ into: 'में',
106
+ with: 'के_साथ',
107
+ at: 'पर',
108
+ in: 'में',
109
+ of: 'का',
110
+ as: 'के_रूप_में',
111
+ by: 'द्वारा',
112
+ before: 'से_पहले',
113
+ after: 'के_बाद',
114
+ over: 'के_ऊपर',
115
+ under: 'के_नीचे',
116
+ between: 'के_बीच',
117
+ through: 'के_माध्यम_से',
118
+ without: 'के_बिना',
119
+ on: 'पर',
120
+ },
121
+
122
+ events: {
123
+ click: 'क्लिक',
124
+ dblclick: 'डबल_क्लिक',
125
+ mousedown: 'माउस_नीचे',
126
+ mouseup: 'माउस_ऊपर',
127
+ mouseenter: 'माउस_प्रवेश',
128
+ mouseleave: 'माउस_बाहर',
129
+ mouseover: 'माउस_ओवर',
130
+ mouseout: 'माउस_आउट',
131
+ mousemove: 'माउस_मूव',
132
+
133
+ keydown: 'की_नीचे',
134
+ keyup: 'की_ऊपर',
135
+ keypress: 'की_प्रेस',
136
+
137
+ focus: 'फोकस',
138
+ blur: 'धुंधला',
139
+ change: 'परिवर्तन',
140
+ input: 'इनपुट',
141
+ submit: 'जमा',
142
+ reset: 'रीसेट',
143
+
144
+ load: 'लोड',
145
+ unload: 'अनलोड',
146
+ resize: 'आकार_बदलें',
147
+ scroll: 'स्क्रॉल',
148
+
149
+ touchstart: 'टच_शुरू',
150
+ touchend: 'टच_समाप्त',
151
+ touchmove: 'टच_मूव',
152
+ touchcancel: 'टच_रद्द',
153
+ },
154
+
155
+ logical: {
156
+ when: 'जब',
157
+ where: 'कहाँ',
158
+ and: 'और',
159
+ or: 'या',
160
+ not: 'नहीं',
161
+ is: 'है',
162
+ exists: 'मौजूद',
163
+ matches: 'मेल_खाता',
164
+ contains: 'शामिल',
165
+ includes: 'में_है',
166
+ equals: 'बराबर',
167
+ then: 'फिर',
168
+ else: 'वरना',
169
+ otherwise: 'अन्यथा',
170
+ end: 'समाप्त',
171
+ has: 'है', // existence verb (context-based)
172
+ have: 'है', // same verb for first/third person
173
+ isNot: 'नहीं_है',
174
+ empty: 'खाली',
175
+ },
176
+
177
+ temporal: {
178
+ seconds: 'सेकंड',
179
+ second: 'सेकंड',
180
+ milliseconds: 'मिलीसेकंड',
181
+ millisecond: 'मिलीसेकंड',
182
+ minutes: 'मिनट',
183
+ minute: 'मिनट',
184
+ hours: 'घंटे',
185
+ hour: 'घंटा',
186
+ ms: 'मिसे',
187
+ s: 'से',
188
+ min: 'मि',
189
+ h: 'घं',
190
+ forever: 'हमेशा',
191
+ once: 'एक_बार',
192
+ every: 'हर',
193
+ until: 'तक',
194
+ },
195
+
196
+ values: {
197
+ true: 'सच',
198
+ false: 'झूठ',
199
+ null: 'खाली',
200
+ undefined: 'अपरिभाषित',
201
+ it: 'यह',
202
+ its: 'इसका',
203
+ me: 'मैं',
204
+ my: 'मेरा',
205
+ you: 'आप',
206
+ your: 'आपका',
207
+ yourself: 'स्वयं',
208
+ myself: 'मैं_स्वयं',
209
+ element: 'तत्व',
210
+ target: 'लक्ष्य',
211
+ detail: 'विवरण',
212
+ event: 'घटना',
213
+ window: 'विंडो',
214
+ document: 'दस्तावेज़',
215
+ body: 'बॉडी',
216
+ result: 'परिणाम',
217
+ value: 'मान',
218
+ first: 'पहला',
219
+ last: 'अंतिम',
220
+ next: 'अगला',
221
+ previous: 'पिछला',
222
+ closest: 'निकटतम',
223
+ parent: 'मूल',
224
+ },
225
+
226
+ attributes: {
227
+ class: 'क्लास',
228
+ classes: 'क्लासेस',
229
+ style: 'स्टाइल',
230
+ styles: 'स्टाइल्स',
231
+ attribute: 'गुण',
232
+ attributes: 'गुण',
233
+ property: 'संपत्ति',
234
+ properties: 'संपत्तियाँ',
235
+ disabled: 'अक्षम',
236
+ hidden: 'छिपा',
237
+ checked: 'चेक',
238
+ selected: 'चयनित',
239
+ readonly: 'केवल_पढ़ने',
240
+ required: 'आवश्यक',
241
+ text: 'पाठ',
242
+ html: 'html',
243
+ },
244
+
245
+ expressions: {
246
+ // Positional
247
+ first: 'पहला',
248
+ last: 'अंतिम',
249
+ next: 'अगला',
250
+ previous: 'पिछला',
251
+ prev: 'पिछ',
252
+ at: 'पर',
253
+ random: 'यादृच्छिक',
254
+
255
+ // DOM Traversal
256
+ closest: 'निकटतम',
257
+ parent: 'मूल',
258
+ children: 'बच्चे',
259
+ within: 'के_अंदर',
260
+
261
+ // Emptiness/Existence
262
+ no: 'नहीं',
263
+ empty: 'खाली',
264
+ some: 'कुछ',
265
+
266
+ // String operations
267
+ 'starts with': 'से_शुरू',
268
+ 'ends with': 'पर_समाप्त',
269
+ },
270
+ };
@@ -0,0 +1,233 @@
1
+ // packages/i18n/src/dictionaries/id.ts
2
+
3
+ import { Dictionary } from '../types';
4
+
5
+ export const id: Dictionary = {
6
+ commands: {
7
+ // Event handling
8
+ on: 'pada',
9
+ tell: 'katakan',
10
+ trigger: 'picu',
11
+ send: 'kirim',
12
+
13
+ // DOM manipulation
14
+ take: 'ambil',
15
+ put: 'taruh',
16
+ set: 'atur',
17
+ get: 'dapatkan',
18
+ add: 'tambah',
19
+ remove: 'hapus',
20
+ toggle: 'ganti',
21
+ hide: 'sembunyikan',
22
+ show: 'tampilkan',
23
+
24
+ // Control flow
25
+ if: 'jika',
26
+ unless: 'kecuali',
27
+ repeat: 'ulangi',
28
+ for: 'untuk',
29
+ while: 'selama',
30
+ until: 'sampai',
31
+ continue: 'lanjutkan',
32
+ break: 'hentikan',
33
+ halt: 'berhenti',
34
+
35
+ // Async
36
+ wait: 'tunggu',
37
+ fetch: 'ambil',
38
+ call: 'panggil',
39
+ return: 'kembali',
40
+
41
+ // Other commands
42
+ make: 'buat',
43
+ log: 'catat',
44
+ throw: 'lempar',
45
+ catch: 'tangkap',
46
+ measure: 'ukur',
47
+ transition: 'transisi',
48
+
49
+ // Data Commands
50
+ increment: 'tambahkan',
51
+ decrement: 'kurangi',
52
+ bind: 'ikat',
53
+ default: 'bawaan',
54
+ persist: 'simpan',
55
+
56
+ // Navigation Commands
57
+ go: 'pergi',
58
+ pushUrl: 'tambahUrl',
59
+ replaceUrl: 'gantiUrl',
60
+
61
+ // Utility Commands
62
+ copy: 'salin',
63
+ pick: 'pilih',
64
+ beep: 'bunyi',
65
+
66
+ // Advanced Commands
67
+ js: 'js',
68
+ async: 'asinkron',
69
+ render: 'tampilkan',
70
+
71
+ // Animation Commands
72
+ swap: 'tukar',
73
+ morph: 'ubah_bentuk',
74
+ settle: 'stabil',
75
+
76
+ // Content Commands
77
+ append: 'tambah_akhir',
78
+
79
+ // Control Flow
80
+ exit: 'keluar',
81
+
82
+ // Behaviors
83
+ install: 'pasang',
84
+ },
85
+
86
+ modifiers: {
87
+ to: 'ke',
88
+ from: 'dari',
89
+ into: 'ke_dalam',
90
+ with: 'dengan',
91
+ at: 'di',
92
+ in: 'dalam',
93
+ of: 'dari',
94
+ as: 'sebagai',
95
+ by: 'oleh',
96
+ before: 'sebelum',
97
+ after: 'setelah',
98
+ over: 'di_atas',
99
+ under: 'di_bawah',
100
+ between: 'antara',
101
+ through: 'melalui',
102
+ without: 'tanpa',
103
+ },
104
+
105
+ events: {
106
+ click: 'klik',
107
+ dblclick: 'klik_ganda',
108
+ mousedown: 'tekan_mouse',
109
+ mouseup: 'lepas_mouse',
110
+ mouseenter: 'mouse_masuk',
111
+ mouseleave: 'mouse_keluar',
112
+ mouseover: 'mouse_atas',
113
+ mouseout: 'mouse_luar',
114
+ mousemove: 'gerak_mouse',
115
+
116
+ keydown: 'tekan_tombol',
117
+ keyup: 'lepas_tombol',
118
+ keypress: 'pencet_tombol',
119
+
120
+ focus: 'fokus',
121
+ blur: 'blur',
122
+ change: 'ubah',
123
+ input: 'masukan',
124
+ submit: 'kirim',
125
+ reset: 'reset',
126
+
127
+ load: 'muat',
128
+ unload: 'bongkar',
129
+ resize: 'ubah_ukuran',
130
+ scroll: 'gulir',
131
+
132
+ touchstart: 'mulai_sentuh',
133
+ touchend: 'akhir_sentuh',
134
+ touchmove: 'gerak_sentuh',
135
+ touchcancel: 'batal_sentuh',
136
+ },
137
+
138
+ logical: {
139
+ when: 'ketika',
140
+ where: 'di_mana',
141
+ and: 'dan',
142
+ or: 'atau',
143
+ not: 'bukan',
144
+ is: 'adalah',
145
+ exists: 'ada',
146
+ matches: 'cocok',
147
+ contains: 'berisi',
148
+ includes: 'termasuk',
149
+ equals: 'sama',
150
+ has: 'punya', // possession verb (context-based)
151
+ have: 'punya', // same for first/third person
152
+ then: 'lalu',
153
+ else: 'lainnya',
154
+ otherwise: 'sebaliknya',
155
+ end: 'akhir',
156
+ },
157
+
158
+ temporal: {
159
+ seconds: 'detik',
160
+ second: 'detik',
161
+ milliseconds: 'milidetik',
162
+ millisecond: 'milidetik',
163
+ minutes: 'menit',
164
+ minute: 'menit',
165
+ hours: 'jam',
166
+ hour: 'jam',
167
+ ms: 'ms',
168
+ s: 'd',
169
+ min: 'mnt',
170
+ h: 'j',
171
+ },
172
+
173
+ values: {
174
+ true: 'benar',
175
+ false: 'salah',
176
+ null: 'kosong',
177
+ undefined: 'tidak_terdefinisi',
178
+ it: 'itu',
179
+ its: 'miliknya', // REVIEW: native speaker
180
+ me: 'saya',
181
+ my: 'saya punya',
182
+ myself: 'saya sendiri',
183
+ you: 'kamu', // REVIEW: native speaker - formal/informal
184
+ your: 'kamu punya', // REVIEW: native speaker
185
+ yourself: 'kamu sendiri', // REVIEW: native speaker
186
+ element: 'elemen',
187
+ target: 'target',
188
+ detail: 'detail',
189
+ event: 'peristiwa',
190
+ window: 'jendela',
191
+ document: 'dokumen',
192
+ body: 'badan',
193
+ result: 'hasil',
194
+ value: 'nilai',
195
+ },
196
+
197
+ attributes: {
198
+ class: 'kelas',
199
+ classes: 'kelas_kelas',
200
+ style: 'gaya',
201
+ styles: 'gaya_gaya',
202
+ attribute: 'atribut',
203
+ attributes: 'atribut_atribut',
204
+ property: 'properti',
205
+ properties: 'properti_properti',
206
+ },
207
+
208
+ expressions: {
209
+ // Positional
210
+ first: 'pertama',
211
+ last: 'terakhir',
212
+ next: 'berikutnya',
213
+ previous: 'sebelumnya',
214
+ prev: 'sblm',
215
+ at: 'di',
216
+ random: 'acak',
217
+
218
+ // DOM Traversal
219
+ closest: 'terdekat',
220
+ parent: 'induk',
221
+ children: 'anak_anak',
222
+ within: 'dalam',
223
+
224
+ // Emptiness/Existence
225
+ no: 'tidak_ada',
226
+ empty: 'kosong',
227
+ some: 'beberapa',
228
+
229
+ // String operations
230
+ 'starts with': 'dimulai dengan',
231
+ 'ends with': 'diakhiri dengan',
232
+ },
233
+ };