@lokascript/i18n 2.5.0 → 2.6.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 (73) hide show
  1. package/dist/browser.cjs +1274 -154
  2. package/dist/browser.cjs.map +1 -1
  3. package/dist/browser.d.cts +3 -3
  4. package/dist/browser.d.ts +3 -3
  5. package/dist/browser.js +1274 -155
  6. package/dist/browser.js.map +1 -1
  7. package/dist/dictionaries/index.cjs +364 -133
  8. package/dist/dictionaries/index.cjs.map +1 -1
  9. package/dist/dictionaries/index.d.cts +1 -1
  10. package/dist/dictionaries/index.d.ts +1 -1
  11. package/dist/dictionaries/index.js +364 -133
  12. package/dist/dictionaries/index.js.map +1 -1
  13. package/dist/index.cjs +8860 -7740
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +3 -3
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +8860 -7741
  18. package/dist/index.js.map +1 -1
  19. package/dist/lokascript-i18n.min.js +1 -1
  20. package/dist/lokascript-i18n.min.js.map +1 -1
  21. package/dist/lokascript-i18n.mjs +1697 -146
  22. package/dist/lokascript-i18n.mjs.map +1 -1
  23. package/dist/plugins/vite.cjs +359 -132
  24. package/dist/plugins/vite.cjs.map +1 -1
  25. package/dist/plugins/vite.js +359 -132
  26. package/dist/plugins/vite.js.map +1 -1
  27. package/dist/plugins/webpack.cjs +359 -132
  28. package/dist/plugins/webpack.cjs.map +1 -1
  29. package/dist/plugins/webpack.js +359 -132
  30. package/dist/plugins/webpack.js.map +1 -1
  31. package/dist/{transformer-BLv389qz.d.ts → transformer-BA8YX9u1.d.ts} +120 -2
  32. package/dist/{transformer-PFsYELrc.d.cts → transformer-DM7iplCU.d.cts} +120 -2
  33. package/dist/{types-BcALAO6h.d.cts → types-BYtpqGq3.d.cts} +1 -1
  34. package/dist/{types-BcALAO6h.d.ts → types-BYtpqGq3.d.ts} +1 -1
  35. package/package.json +6 -6
  36. package/src/browser.ts +1 -0
  37. package/src/command-primary-roles.test.ts +59 -0
  38. package/src/constants.ts +51 -0
  39. package/src/dictionaries/ar.ts +8 -3
  40. package/src/dictionaries/bn.ts +3 -1
  41. package/src/dictionaries/de.ts +19 -4
  42. package/src/dictionaries/derive.ts +4 -0
  43. package/src/dictionaries/en.ts +9 -0
  44. package/src/dictionaries/es.ts +2 -2
  45. package/src/dictionaries/fr.ts +6 -2
  46. package/src/dictionaries/he.ts +7 -1
  47. package/src/dictionaries/hi.ts +17 -10
  48. package/src/dictionaries/id.ts +15 -8
  49. package/src/dictionaries/it.ts +6 -3
  50. package/src/dictionaries/ja.ts +10 -4
  51. package/src/dictionaries/ko.ts +9 -4
  52. package/src/dictionaries/ms.ts +2 -1
  53. package/src/dictionaries/pl.ts +11 -3
  54. package/src/dictionaries/pt.ts +10 -4
  55. package/src/dictionaries/qu.ts +46 -22
  56. package/src/dictionaries/ru.ts +14 -7
  57. package/src/dictionaries/sw.ts +37 -10
  58. package/src/dictionaries/th.ts +3 -1
  59. package/src/dictionaries/tl.ts +14 -7
  60. package/src/dictionaries/tr.ts +22 -9
  61. package/src/dictionaries/uk.ts +13 -7
  62. package/src/dictionaries/vi.ts +3 -3
  63. package/src/dictionaries/zh.ts +10 -2
  64. package/src/examples/new-languages.ts +1 -1
  65. package/src/grammar/grammar.test.ts +1242 -1
  66. package/src/grammar/index.ts +1 -0
  67. package/src/grammar/profiles/index.ts +358 -12
  68. package/src/grammar/transformer.ts +1053 -16
  69. package/src/grammar/types.ts +22 -1
  70. package/src/index.ts +1 -0
  71. package/src/new-languages.test.ts +7 -3
  72. package/src/parser/parser-integration.test.ts +5 -1
  73. package/src/positional-keyword-drift.test.ts +138 -0
@@ -11,11 +11,17 @@ export const sw: Dictionary = {
11
11
  send: 'tuma',
12
12
  take: 'chukua',
13
13
  put: 'weka',
14
- set: 'weka',
14
+ // weka is the semantic sw profile's `put` primary; `set` is seti. Emitting weka
15
+ // for set made the semantic parser read a transformed `set` as `put`.
16
+ // See ZH_BLOCK_BODY_SCOPE.md (#2 sweep — keyword realignment, cf. zh fetch).
17
+ set: 'seti',
15
18
  get: 'pata',
16
19
  add: 'ongeza',
17
20
  remove: 'ondoa',
18
21
  toggle: 'badilisha',
22
+ // command blur (the events section has the blur EVENT word; without this
23
+ // entry the transformer fell back to it and no profile read it as the verb)
24
+ blur: 'blur',
19
25
  hide: 'ficha',
20
26
  show: 'onyesha',
21
27
  if: 'kama',
@@ -31,13 +37,13 @@ export const sw: Dictionary = {
31
37
  fetch: 'leta',
32
38
  call: 'ita',
33
39
  return: 'rudi',
34
- make: 'fanya',
40
+ make: 'tengeneza', // auditor: dict emitted a word the profile reads differently
35
41
  log: 'andika',
36
42
  throw: 'tupa',
37
43
  catch: 'shika',
38
44
  measure: 'pima',
39
45
  transition: 'mpito',
40
- increment: 'ongeza',
46
+ increment: 'ongezeko',
41
47
  decrement: 'punguza',
42
48
  default: 'msingi',
43
49
  go: 'nenda',
@@ -50,18 +56,20 @@ export const sw: Dictionary = {
50
56
  async: 'sainkroni',
51
57
  render: 'chora',
52
58
  swap: 'badilishana',
53
- morph: 'badilishaUmbo',
59
+ morph: 'geuza', // auditor: dict emitted a word the profile reads differently
54
60
  settle: 'tulia',
55
- append: 'ongezaMwisho',
61
+ append: 'ambatanisha', // profile primary; 'ongezaMwisho' is unrecognized
56
62
  exit: 'toka',
57
63
  install: 'sakinisha',
58
64
  breakpoint: 'nukta-simama',
59
- clear: 'futa',
65
+ clear: 'safisha', // futa is a remove alternative in the profile
60
66
  close: 'funga',
61
67
  open: 'fungua',
62
68
  select: 'chagua',
63
69
  clone: 'nakili',
64
70
  prepend: 'tanguliza',
71
+ focus: 'lenga',
72
+ socket: 'soketi',
65
73
  },
66
74
 
67
75
  modifiers: {
@@ -72,7 +80,14 @@ export const sw: Dictionary = {
72
80
  at: 'katika',
73
81
  in: 'ndani',
74
82
  of: 'ya',
75
- as: 'kama',
83
+ // `kuwa` ("to be/become" — the conversion sense, cf. `badilisha kuwa`), not
84
+ // `kama`: sw `kama` is the IF keyword (commands.if above and the semantic sw
85
+ // profile's if primary), so emitting it for `as` grew a phantom `if` command
86
+ // out of every transformed `as <Type>` tail (`kama JSON`, `kama Number`) when
87
+ // the semantic parser split event-body statements. Same dict↔profile homonym
88
+ // disambiguation as pl get/pobierz. The semantic fetch-sw pattern still
89
+ // tolerates hand-written `kama` in as-marker position.
90
+ as: 'kuwa',
76
91
  by: 'na',
77
92
  before: 'kabla',
78
93
  after: 'baada',
@@ -130,7 +145,7 @@ export const sw: Dictionary = {
130
145
  else: 'sivyo',
131
146
  otherwise: 'vinginevyo',
132
147
  end: 'mwisho',
133
- live: 'moja_kwa_moja',
148
+ live: 'mubashara',
134
149
  changes: 'inabadilika',
135
150
  },
136
151
 
@@ -186,13 +201,25 @@ export const sw: Dictionary = {
186
201
 
187
202
  expressions: {
188
203
  first: 'kwanza',
189
- last: 'mwisho',
204
+ // 'mwisho' is the END keyword (block terminator) — the tokenizer's keyword
205
+ // map is last-wins, so a positional `last` emission of 'mwisho' reads as
206
+ // `end` and terminates the enclosing block mid-condition (focus-trap's
207
+ // `… inafanana mwisho <button/>` dropped the whole branch body). Emit the
208
+ // concatenated adjective form instead (wa mwisho — the saufsi/wennnicht/
209
+ // enyakın single-token class); the tokenizer reads it as `last`.
210
+ last: 'wamwisho',
190
211
  next: 'ijayo',
191
212
  previous: 'iliyopita',
192
213
  prev: 'awali',
193
214
  at: 'katika',
194
215
  random: 'nasibu',
195
- closest: 'karibu_zaidi',
216
+ // Natural Swahili: `karibu` ("near/close") is the ordinary word and already
217
+ // maps to closest. The earlier `karibu_zaidi` ("nearer") underscore-split to
218
+ // karibu/_/zaidi (the stray `_ zaidi` broke positional capture); the fused
219
+ // `karibuzaidi` parsed but isn't real Swahili. `karibu` alone is both natural
220
+ // and correct (the sw tokenizer is single-word-only, so a spaced `karibu
221
+ // zaidi` would strand `zaidi` regardless).
222
+ closest: 'karibu',
196
223
  parent: 'mzazi',
197
224
  children: 'watoto',
198
225
  within: 'ndani_ya',
@@ -38,7 +38,9 @@ export const thaiDictionary: Dictionary = {
38
38
  prepend: 'เพิ่มหน้า',
39
39
  focus: 'โฟกัส',
40
40
  blur: 'เบลอ',
41
- transition: 'เปลี่ยน',
41
+ // เปลี่ยนผ่าน, not เปลี่ยน: the semantic th profile's `change` keyword is
42
+ // เปลี่ยน, so a เปลี่ยน render could never anchor a transition command.
43
+ transition: 'เปลี่ยนผ่าน',
42
44
  settle: 'คงที่',
43
45
  measure: 'วัด',
44
46
  async: 'อะซิงค์',
@@ -9,10 +9,13 @@ export const tagalogDictionary: Dictionary = {
9
9
  tell: 'sabihin',
10
10
  trigger: 'palitawin',
11
11
  send: 'ipadala',
12
- take: 'kunin',
12
+ take: 'kumuha', // auditor: dict emitted a word the profile reads differently
13
13
  put: 'ilagay',
14
14
  set: 'itakda',
15
- get: 'kuhanin',
15
+ // Align with the semantic tl profile's `get` primary (`kunin`); the previous
16
+ // `kuhanin` is the base of fetch's `kuhanin_mula`, so the transformed `get`
17
+ // dropped (get-value parsed degenerate). Same dict↔profile alignment as id `toggle`.
18
+ get: 'kunin',
16
19
  add: 'idagdag',
17
20
  remove: 'alisin',
18
21
  toggle: 'palitan',
@@ -36,7 +39,7 @@ export const tagalogDictionary: Dictionary = {
36
39
  throw: 'ihagis',
37
40
  catch: 'hulihin',
38
41
  measure: 'sukatin',
39
- transition: 'baguhin',
42
+ transition: 'lumipat',
40
43
  increment: 'dagdagan',
41
44
  decrement: 'bawasan',
42
45
  default: 'pamantayan',
@@ -48,10 +51,10 @@ export const tagalogDictionary: Dictionary = {
48
51
  beep: 'tunog',
49
52
  js: 'js',
50
53
  async: 'sabay',
51
- render: 'ipakita',
54
+ render: 'irender', // auditor: dict emitted a word the profile reads differently
52
55
  swap: 'palitan_pwesto',
53
- morph: 'baguhin_hugis',
54
- settle: 'ayusin',
56
+ morph: 'baguhin', // auditor: dict emitted a word the profile reads differently
57
+ settle: 'magpatahimik', // auditor: dict emitted a word the profile reads differently
55
58
  append: 'idagdag_sa_dulo',
56
59
  prepend: 'idagdag_sa_simula',
57
60
  exit: 'lumabas',
@@ -80,7 +83,11 @@ export const tagalogDictionary: Dictionary = {
80
83
  as: 'bilang',
81
84
  by: 'sa_pamamagitan_ng',
82
85
  before: 'bago',
83
- after: 'pagkatapos',
86
+ // `matapos` (not `pagkatapos`) for the positional "after": `pagkatapos` is
87
+ // also Tagalog "then", so emitting it for the position modifier collides with
88
+ // the sequence connector. `matapos` is the unambiguous positional form and
89
+ // matches the semantic tl profile's `after`.
90
+ after: 'matapos',
84
91
  over: 'sa_ibabaw',
85
92
  under: 'sa_ilalim',
86
93
  between: 'sa_pagitan',
@@ -9,7 +9,7 @@ export const tr: Dictionary = {
9
9
  tell: 'söyle',
10
10
  trigger: 'tetikle',
11
11
  send: 'gönder',
12
- take: 'al',
12
+ take: 'tut', // auditor: dict emitted a word the profile reads differently
13
13
  put: 'koy',
14
14
  set: 'ayarla',
15
15
  get: 'al',
@@ -22,7 +22,11 @@ export const tr: Dictionary = {
22
22
  unless: 'değilse',
23
23
  repeat: 'tekrarla',
24
24
  for: 'için',
25
- while: 'iken',
25
+ // `süresince` (the semantic tr profile's while primary), not `iken`: `iken`
26
+ // is the profile's WHEN primary (logical.when below also emits it), so a
27
+ // fronted repeat-while head tokenized as `when` and the condition dropped
28
+ // wholesale. Same dict↔profile homonym disambiguation as pl get/pobierz.
29
+ while: 'süresince',
26
30
  until: 'kadar',
27
31
  continue: 'devam',
28
32
  break: 'dur',
@@ -52,7 +56,7 @@ export const tr: Dictionary = {
52
56
  swap: 'takas',
53
57
  morph: 'dönüştür',
54
58
  settle: 'sabitlen',
55
- append: 'ekle',
59
+ append: 'iliştir', // profile primary; 'ekle' is add's word (parsed as add)
56
60
  exit: 'çık',
57
61
  install: 'kur',
58
62
  breakpoint: 'kesme-noktası',
@@ -62,6 +66,7 @@ export const tr: Dictionary = {
62
66
  select: 'seç',
63
67
  clone: 'klonla',
64
68
  prepend: 'başınaekle',
69
+ socket: 'soket',
65
70
  },
66
71
 
67
72
  modifiers: {
@@ -86,8 +91,11 @@ export const tr: Dictionary = {
86
91
  events: {
87
92
  click: 'tıklama',
88
93
  dblclick: 'çift_tıklama',
89
- mousedown: 'fare_bas',
90
- mouseup: 'fare_bırak',
94
+ // Fused (no `_`): the semantic tokenizer splits on `_`, breaking event
95
+ // recognition (mousedown → "bas" / mouseup mis-captured). Mirrors the #535
96
+ // ru/uk fuse + #510 resize fix.
97
+ mousedown: 'farebas',
98
+ mouseup: 'farebırak',
91
99
  mouseenter: 'fare_gir',
92
100
  mouseleave: 'fare_çık',
93
101
  mouseover: 'fare_üstü',
@@ -104,7 +112,7 @@ export const tr: Dictionary = {
104
112
  reset: 'sıfırla',
105
113
  load: 'yükle',
106
114
  unload: 'yükle_kaldır',
107
- resize: 'boyut_değiştir',
115
+ resize: 'boyutlandırma',
108
116
  scroll: 'kaydır',
109
117
  touchstart: 'dokunma_başla',
110
118
  touchend: 'dokunma_bitir',
@@ -126,7 +134,7 @@ export const tr: Dictionary = {
126
134
  equals: 'eşittir',
127
135
  has: 'var',
128
136
  have: 'var',
129
- then: 'sonra',
137
+ then: 'ardından',
130
138
  else: 'yoksa',
131
139
  otherwise: 'aksi_halde',
132
140
  end: 'son',
@@ -186,13 +194,18 @@ export const tr: Dictionary = {
186
194
 
187
195
  expressions: {
188
196
  first: 'ilk',
189
- last: 'son',
197
+ // 'son' is also the END keyword emission (block terminator), and the
198
+ // parser's end-recognizers match it by value — so a positional `last`
199
+ // emission of 'son' terminated the enclosing block mid-condition
200
+ // (focus-trap's `eşleşir son <button/>` dropped the branch body; the sw
201
+ // mwisho class). 'sonuncu' ("the last one") is unambiguous.
202
+ last: 'sonuncu',
190
203
  next: 'sonraki',
191
204
  previous: 'önceki',
192
205
  prev: 'önc',
193
206
  at: 'de',
194
207
  random: 'rastgele',
195
- closest: 'en_yakın',
208
+ closest: 'enyakın',
196
209
  parent: 'ebeveyn',
197
210
  children: 'çocuklar',
198
211
  within: 'içinde',
@@ -7,7 +7,7 @@ export const ukrainianDictionary: Dictionary = {
7
7
  commands: {
8
8
  on: 'при',
9
9
  tell: 'сказати',
10
- trigger: 'викликати',
10
+ trigger: 'запустити', // auditor: dict emitted a word the profile reads differently
11
11
  send: 'надіслати',
12
12
  take: 'взяти',
13
13
  put: 'покласти',
@@ -18,8 +18,12 @@ export const ukrainianDictionary: Dictionary = {
18
18
  toggle: 'перемкнути',
19
19
  hide: 'сховати',
20
20
  show: 'показати',
21
+ // command verb; the events section keeps the noun прокрутка for `on scroll`.
22
+ // Without this entry the transformer fell back to the event noun, which the
23
+ // parser doesn't read as the scroll command (#321 focus family).
24
+ scroll: 'прокрутити',
21
25
  if: 'якщо',
22
- unless: 'якщо_не',
26
+ unless: 'крім',
23
27
  repeat: 'повторити',
24
28
  for: 'для',
25
29
  while: 'поки',
@@ -52,10 +56,10 @@ export const ukrainianDictionary: Dictionary = {
52
56
  swap: 'поміняти',
53
57
  morph: 'трансформувати',
54
58
  settle: 'стабілізувати',
55
- append: 'додати_в_кінець',
59
+ append: 'дописати', // profile alternative; the compound splits and додати parses as add
56
60
  exit: 'вийти',
57
61
  else: 'інакше',
58
- install: 'встановити',
62
+ install: 'інсталювати', // loanword — `встановити` is `set` (homonym); see ukrainian profile
59
63
  init: 'ініціалізувати',
60
64
  behavior: 'поведінка',
61
65
  focus: 'сфокусувати',
@@ -92,8 +96,10 @@ export const ukrainianDictionary: Dictionary = {
92
96
  events: {
93
97
  click: 'клік',
94
98
  dblclick: 'подвійний_клік',
95
- mousedown: 'миша_вниз',
96
- mouseup: 'миша_вгору',
99
+ // Fused (no `_`): the semantic tokenizer splits on `_`, so an underscore form
100
+ // breaks event recognition. Mirrors the #510 tr resize fix + enyakın.
101
+ mousedown: 'мишавниз',
102
+ mouseup: 'мишавгору',
97
103
  mouseenter: 'миша_вхід',
98
104
  mouseleave: 'миша_вихід',
99
105
  mouseover: 'наведення',
@@ -110,7 +116,7 @@ export const ukrainianDictionary: Dictionary = {
110
116
  reset: 'скидання',
111
117
  load: 'завантаження',
112
118
  unload: 'вивантаження',
113
- resize: 'зміна_розміру',
119
+ resize: 'змінарозміру', // fused (no `_`) — see mousedown note above
114
120
  scroll: 'прокрутка',
115
121
  touchstart: 'дотик_початок',
116
122
  touchend: 'дотик_кінець',
@@ -48,7 +48,7 @@ export const vi: Dictionary = {
48
48
  beep: 'beep',
49
49
  js: 'js',
50
50
  async: 'bất đồng bộ',
51
- render: 'hiển thị',
51
+ render: 'kết xuất', // distinct from `show` (was `hiển thị`, which collides with show: the semantic profile reads `hiển thị` as show, `kết xuất` as render)
52
52
  swap: 'hoán đổi',
53
53
  morph: 'biến đổi',
54
54
  settle: 'ổn định',
@@ -63,7 +63,7 @@ export const vi: Dictionary = {
63
63
  prepend: 'thêm đầu',
64
64
  else: 'không thì',
65
65
  breakpoint: 'điểm-dừng',
66
- clear: 'xóa',
66
+ clear: 'tẩy', // xóa is the remove PRIMARY in the profile
67
67
  close: 'đóng',
68
68
  open: 'mở',
69
69
  select: 'chọn',
@@ -130,7 +130,7 @@ export const vi: Dictionary = {
130
130
  else: 'không thì',
131
131
  end: 'kết thúc',
132
132
  then: 'rồi',
133
- live: 'trực tiếp',
133
+ live: 'live',
134
134
  changes: 'thay đổi',
135
135
  },
136
136
 
@@ -9,7 +9,11 @@ export const zh: Dictionary = {
9
9
  tell: '告诉',
10
10
  trigger: '触发',
11
11
  send: '发送',
12
- take: '获取',
12
+ // `拿取` (the semantic zh profile's take primary), not `获取` — `获取` is the
13
+ // profile's GET primary, so emitting it for take made `take …` parse as get
14
+ // (take-class-from-siblings: phantom get, take dropped). Exposed by the get-zh-ba
15
+ // pattern; same dict↔profile homonym family as pl get/fetch.
16
+ take: '拿取',
13
17
  put: '放置',
14
18
  set: '设置',
15
19
  get: '获得',
@@ -28,7 +32,10 @@ export const zh: Dictionary = {
28
32
  break: '中断',
29
33
  halt: '停止',
30
34
  wait: '等待',
31
- fetch: '获取',
35
+ // 抓取 (zhuāqǔ, "grab/scrape") is the semantic zh profile's `fetch` primary;
36
+ // 获取 (huòqǔ) is its `get` primary, so emitting 获取 here made the semantic
37
+ // parser read a transformed `fetch` as `get`. See ZH_BLOCK_BODY_SCOPE.md #3.
38
+ fetch: '抓取',
32
39
  call: '调用',
33
40
  return: '返回',
34
41
  make: '制作',
@@ -131,6 +138,7 @@ export const zh: Dictionary = {
131
138
  otherwise: '要不然',
132
139
  end: '结束',
133
140
  live: '实时',
141
+ bind: '绑定',
134
142
  changes: '改变时',
135
143
  },
136
144
 
@@ -100,7 +100,7 @@ export const quechuaExamples = {
100
100
 
101
101
  elements: {
102
102
  original: 'on mouseenter tell closest .card to add .highlight',
103
- translated: 'rat_yaykuy kaqpi niy aswan_kaylla .card man yapay .highlight',
103
+ translated: 'rat_yaykuy kaqpi niy kaylla .card man yapay .highlight',
104
104
  description: 'Element communication',
105
105
  },
106
106