@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,233 @@
1
+ // packages/i18n/src/dictionaries/ko.ts
2
+
3
+ import { Dictionary } from '../types';
4
+
5
+ export const ko: Dictionary = {
6
+ commands: {
7
+ // Event handling
8
+ on: '에',
9
+ tell: '말하다',
10
+ trigger: '트리거',
11
+ send: '보내다',
12
+
13
+ // DOM manipulation
14
+ take: '가져오다',
15
+ put: '넣다',
16
+ set: '설정',
17
+ get: '얻다',
18
+ add: '추가',
19
+ remove: '제거',
20
+ toggle: '토글',
21
+ hide: '숨기다',
22
+ show: '보이다',
23
+
24
+ // Control flow
25
+ if: '만약',
26
+ unless: '아니면',
27
+ repeat: '반복',
28
+ for: '동안',
29
+ while: '동안',
30
+ until: '까지',
31
+ continue: '계속',
32
+ break: '중단',
33
+ halt: '정지',
34
+
35
+ // Async
36
+ wait: '대기',
37
+ fetch: '가져오기',
38
+ call: '호출',
39
+ return: '반환',
40
+
41
+ // Other commands
42
+ make: '만들다',
43
+ log: '로그',
44
+ throw: '던지다',
45
+ catch: '잡다',
46
+ measure: '측정',
47
+ transition: '전환',
48
+
49
+ // Data Commands
50
+ increment: '증가',
51
+ decrement: '감소',
52
+ bind: '바인드',
53
+ default: '기본값',
54
+ persist: '유지',
55
+
56
+ // Navigation Commands
57
+ go: '이동',
58
+ pushUrl: 'URL푸시',
59
+ replaceUrl: 'URL교체',
60
+
61
+ // Utility Commands
62
+ copy: '복사',
63
+ pick: '선택',
64
+ beep: '비프',
65
+
66
+ // Advanced Commands
67
+ js: 'JS실행',
68
+ async: '비동기',
69
+ render: '렌더링',
70
+
71
+ // Animation Commands
72
+ swap: '교환',
73
+ morph: '변형',
74
+ settle: '안정',
75
+
76
+ // Content Commands
77
+ append: '추가',
78
+
79
+ // Control Flow
80
+ exit: '종료',
81
+
82
+ // Behaviors
83
+ install: '설치',
84
+ },
85
+
86
+ modifiers: {
87
+ to: '에',
88
+ from: '에서',
89
+ into: '으로',
90
+ with: '와',
91
+ at: '에',
92
+ in: '안에',
93
+ of: '의',
94
+ as: '로',
95
+ by: '에의해',
96
+ before: '전에',
97
+ after: '후에',
98
+ over: '위에',
99
+ under: '아래',
100
+ between: '사이',
101
+ through: '통해',
102
+ without: '없이',
103
+ },
104
+
105
+ events: {
106
+ click: '클릭',
107
+ dblclick: '더블클릭',
108
+ mousedown: '마우스다운',
109
+ mouseup: '마우스업',
110
+ mouseenter: '마우스엔터',
111
+ mouseleave: '마우스리브',
112
+ mouseover: '마우스오버',
113
+ mouseout: '마우스아웃',
114
+ mousemove: '마우스무브',
115
+
116
+ keydown: '키다운',
117
+ keyup: '키업',
118
+ keypress: '키프레스',
119
+
120
+ focus: '포커스',
121
+ blur: '블러',
122
+ change: '변경',
123
+ input: '입력',
124
+ submit: '제출',
125
+ reset: '리셋',
126
+
127
+ load: '로드',
128
+ unload: '언로드',
129
+ resize: '리사이즈',
130
+ scroll: '스크롤',
131
+
132
+ touchstart: '터치시작',
133
+ touchend: '터치종료',
134
+ touchmove: '터치이동',
135
+ touchcancel: '터치취소',
136
+ },
137
+
138
+ logical: {
139
+ when: '때',
140
+ where: '어디',
141
+ and: '그리고',
142
+ or: '또는',
143
+ not: '아니',
144
+ is: '이다',
145
+ exists: '존재',
146
+ matches: '일치',
147
+ contains: '포함',
148
+ includes: '포함하다',
149
+ equals: '같다',
150
+ has: '있다', // existence verb (context-based)
151
+ have: '있다', // same verb for first/third person
152
+ then: '그러면',
153
+ else: '아니면',
154
+ otherwise: '그렇지않으면',
155
+ end: '끝',
156
+ },
157
+
158
+ temporal: {
159
+ seconds: '초',
160
+ second: '초',
161
+ milliseconds: '밀리초',
162
+ millisecond: '밀리초',
163
+ minutes: '분',
164
+ minute: '분',
165
+ hours: '시간',
166
+ hour: '시간',
167
+ ms: 'ms',
168
+ s: '초',
169
+ min: '분',
170
+ h: '시',
171
+ },
172
+
173
+ values: {
174
+ true: '참',
175
+ false: '거짓',
176
+ null: '널',
177
+ undefined: '정의안됨',
178
+ it: '그것',
179
+ its: '그것의', // REVIEW: native speaker
180
+ me: '나',
181
+ my: '내',
182
+ myself: '나자신',
183
+ you: '너', // REVIEW: native speaker - formal/informal
184
+ your: '네', // REVIEW: native speaker - formal/informal
185
+ yourself: '너자신', // REVIEW: native speaker
186
+ element: '요소',
187
+ target: '대상',
188
+ detail: '세부',
189
+ event: '이벤트',
190
+ window: '창',
191
+ document: '문서',
192
+ body: '바디',
193
+ result: '결과',
194
+ value: '값',
195
+ },
196
+
197
+ attributes: {
198
+ class: '클래스',
199
+ classes: '클래스들',
200
+ style: '스타일',
201
+ styles: '스타일들',
202
+ attribute: '속성',
203
+ attributes: '속성들',
204
+ property: '프로퍼티',
205
+ properties: '프로퍼티들',
206
+ },
207
+
208
+ expressions: {
209
+ // Positional
210
+ first: '첫번째',
211
+ last: '마지막',
212
+ next: '다음',
213
+ previous: '이전',
214
+ prev: '이전',
215
+ at: '에서',
216
+ random: '무작위',
217
+
218
+ // DOM Traversal
219
+ closest: '가장가까운',
220
+ parent: '부모',
221
+ children: '자식',
222
+ within: '이내',
223
+
224
+ // Emptiness/Existence
225
+ no: '없음',
226
+ empty: '비어있는',
227
+ some: '일부',
228
+
229
+ // String operations
230
+ 'starts with': '로시작',
231
+ 'ends with': '로끝나는',
232
+ },
233
+ };
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Malay Dictionary
3
+ *
4
+ * Malay translations for hyperscript keywords.
5
+ * Malay is an SVO (Subject-Verb-Object) language with prepositions.
6
+ */
7
+
8
+ import { Dictionary } from '../types';
9
+
10
+ export const malayDictionary: Dictionary = {
11
+ commands: {
12
+ // Event handling
13
+ on: 'apabila',
14
+ tell: 'beritahu',
15
+ trigger: 'cetuskan',
16
+ send: 'hantar',
17
+
18
+ // DOM manipulation
19
+ take: 'ambil',
20
+ put: 'letak',
21
+ set: 'tetapkan',
22
+ get: 'dapatkan',
23
+ add: 'tambah',
24
+ remove: 'buang',
25
+ toggle: 'togol',
26
+ hide: 'sembunyi',
27
+ show: 'tunjuk',
28
+
29
+ // Control flow
30
+ if: 'jika',
31
+ unless: 'kecuali',
32
+ repeat: 'ulang',
33
+ for: 'untuk',
34
+ while: 'selagi',
35
+ until: 'sehingga',
36
+ continue: 'teruskan',
37
+ break: 'henti',
38
+ halt: 'henti',
39
+
40
+ // Async
41
+ wait: 'tunggu',
42
+ fetch: 'ambil_dari',
43
+ call: 'panggil',
44
+ return: 'pulang',
45
+
46
+ // Other commands
47
+ make: 'buat',
48
+ log: 'catat',
49
+ throw: 'lempar',
50
+ catch: 'tangkap',
51
+ measure: 'ukur',
52
+ transition: 'peralihan',
53
+
54
+ // Data Commands
55
+ increment: 'tambah_satu',
56
+ decrement: 'kurang_satu',
57
+ bind: 'ikat',
58
+ default: 'lalai',
59
+ persist: 'kekal',
60
+
61
+ // Navigation Commands
62
+ go: 'pergi',
63
+ pushUrl: 'tolak_url',
64
+ replaceUrl: 'ganti_url',
65
+
66
+ // Utility Commands
67
+ copy: 'salin',
68
+ pick: 'pilih',
69
+ beep: 'bunyi',
70
+
71
+ // Advanced Commands
72
+ js: 'js',
73
+ async: 'tak_segerak',
74
+ render: 'papar',
75
+
76
+ // Animation Commands
77
+ swap: 'tukar_tempat',
78
+ morph: 'ubah_bentuk',
79
+ settle: 'selesai',
80
+
81
+ // Content Commands
82
+ append: 'tambah_hujung',
83
+ prepend: 'tambah_mula',
84
+
85
+ // Control Flow
86
+ exit: 'keluar',
87
+ else: 'kalau_tidak',
88
+
89
+ // Focus Commands
90
+ focus: 'fokus',
91
+ blur: 'kabur',
92
+
93
+ // Behaviors
94
+ install: 'pasang',
95
+ behavior: 'kelakuan',
96
+ init: 'mula',
97
+ clone: 'klon',
98
+ },
99
+
100
+ modifiers: {
101
+ to: 'ke',
102
+ from: 'dari',
103
+ into: 'ke_dalam',
104
+ with: 'dengan',
105
+ at: 'di',
106
+ in: 'dalam',
107
+ of: 'daripada',
108
+ as: 'sebagai',
109
+ by: 'oleh',
110
+ before: 'sebelum',
111
+ after: 'selepas',
112
+ over: 'atas',
113
+ under: 'bawah',
114
+ between: 'antara',
115
+ through: 'melalui',
116
+ without: 'tanpa',
117
+ on: 'pada',
118
+ then: 'kemudian',
119
+ and: 'dan',
120
+ end: 'tamat',
121
+ until: 'sehingga',
122
+ },
123
+
124
+ events: {
125
+ click: 'click',
126
+ dblclick: 'dblclick',
127
+ mousedown: 'mousedown',
128
+ mouseup: 'mouseup',
129
+ mouseenter: 'mouseenter',
130
+ mouseleave: 'mouseleave',
131
+ mouseover: 'mouseover',
132
+ mouseout: 'mouseout',
133
+ mousemove: 'mousemove',
134
+
135
+ keydown: 'keydown',
136
+ keyup: 'keyup',
137
+ keypress: 'keypress',
138
+
139
+ focus: 'focus',
140
+ blur: 'blur',
141
+ change: 'change',
142
+ input: 'input',
143
+ submit: 'submit',
144
+ reset: 'reset',
145
+
146
+ load: 'load',
147
+ unload: 'unload',
148
+ resize: 'resize',
149
+ scroll: 'scroll',
150
+
151
+ touchstart: 'touchstart',
152
+ touchend: 'touchend',
153
+ touchmove: 'touchmove',
154
+ touchcancel: 'touchcancel',
155
+
156
+ every: 'setiap',
157
+ },
158
+
159
+ logical: {
160
+ when: 'apabila',
161
+ where: 'di_mana',
162
+ and: 'dan',
163
+ or: 'atau',
164
+ not: 'bukan',
165
+ is: 'adalah',
166
+ exists: 'wujud',
167
+ matches: 'sepadan',
168
+ contains: 'mengandungi',
169
+ includes: 'termasuk',
170
+ equals: 'sama',
171
+ has: 'ada', // possession verb (context-based)
172
+ have: 'ada', // same for first/third person
173
+ then: 'kemudian',
174
+ else: 'kalau_tidak',
175
+ otherwise: 'jika_tidak',
176
+ end: 'tamat',
177
+ if: 'jika',
178
+ empty: 'kosong',
179
+ true: 'benar',
180
+ false: 'salah',
181
+ null: 'null',
182
+ undefined: 'tidak_ditakrifkan',
183
+ },
184
+
185
+ temporal: {
186
+ seconds: 'saat',
187
+ second: 'saat',
188
+ milliseconds: 'milisaat',
189
+ millisecond: 'milisaat',
190
+ minutes: 'minit',
191
+ minute: 'minit',
192
+ hours: 'jam',
193
+ hour: 'jam',
194
+ ms: 'ms',
195
+ s: 's',
196
+ min: 'min',
197
+ h: 'j',
198
+ now: 'sekarang',
199
+ forever: 'selamanya',
200
+ times: 'kali',
201
+ },
202
+
203
+ values: {
204
+ true: 'benar',
205
+ false: 'salah',
206
+ null: 'null',
207
+ undefined: 'tidak_ditakrifkan',
208
+ it: 'ia',
209
+ its: 'nya',
210
+ me: 'saya',
211
+ my: 'saya_punya',
212
+ myself: 'diri_saya',
213
+ you: 'kamu',
214
+ your: 'kamu_punya',
215
+ yourself: 'diri_kamu',
216
+ element: 'elemen',
217
+ target: 'sasaran',
218
+ detail: 'perincian',
219
+ event: 'peristiwa',
220
+ window: 'tetingkap',
221
+ document: 'dokumen',
222
+ body: 'badan',
223
+ result: 'hasil',
224
+ value: 'nilai',
225
+ },
226
+
227
+ attributes: {
228
+ class: 'kelas',
229
+ classes: 'kelas_kelas',
230
+ style: 'gaya',
231
+ styles: 'gaya_gaya',
232
+ attribute: 'atribut',
233
+ attributes: 'atribut_atribut',
234
+ property: 'sifat',
235
+ properties: 'sifat_sifat',
236
+ id: 'id',
237
+ value: 'nilai',
238
+ text: 'teks',
239
+ html: 'html',
240
+ disabled: 'dilumpuhkan',
241
+ checked: 'ditanda',
242
+ },
243
+
244
+ expressions: {
245
+ // Positional
246
+ first: 'pertama',
247
+ last: 'terakhir',
248
+ next: 'seterusnya',
249
+ previous: 'sebelumnya',
250
+ prev: 'sebelum',
251
+ at: 'di',
252
+ random: 'rawak',
253
+
254
+ // DOM Traversal
255
+ closest: 'terdekat',
256
+ parent: 'induk',
257
+ children: 'anak_anak',
258
+ within: 'dalam',
259
+
260
+ // Emptiness/Existence
261
+ no: 'tiada',
262
+ empty: 'kosong',
263
+ some: 'beberapa',
264
+
265
+ // String operations
266
+ 'starts with': 'bermula_dengan',
267
+ 'ends with': 'berakhir_dengan',
268
+
269
+ // Additional
270
+ length: 'panjang',
271
+ index: 'indeks',
272
+ },
273
+ };
274
+
275
+ // Default export alias
276
+ export const ms = malayDictionary;