@digitaldefiance/i18n-lib 3.8.1 → 3.8.3

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 (502) hide show
  1. package/package.json +7 -6
  2. package/src/{active-context.ts → active-context.d.ts} +1 -0
  3. package/src/active-context.d.ts.map +1 -0
  4. package/src/active-context.js +3 -0
  5. package/src/active-context.js.map +1 -0
  6. package/src/builders/i18n-builder.d.ts +26 -0
  7. package/src/builders/i18n-builder.d.ts.map +1 -0
  8. package/src/builders/i18n-builder.js +70 -0
  9. package/src/builders/i18n-builder.js.map +1 -0
  10. package/src/builders/{index.ts → index.d.ts} +1 -1
  11. package/src/builders/index.d.ts.map +1 -0
  12. package/src/builders/index.js +8 -0
  13. package/src/builders/index.js.map +1 -0
  14. package/src/component-definition.d.ts +12 -0
  15. package/src/component-definition.d.ts.map +1 -0
  16. package/src/component-definition.js +3 -0
  17. package/src/component-definition.js.map +1 -0
  18. package/src/component-registration.d.ts +22 -0
  19. package/src/component-registration.d.ts.map +1 -0
  20. package/src/component-registration.js +3 -0
  21. package/src/component-registration.js.map +1 -0
  22. package/src/component-registry.d.ts +102 -0
  23. package/src/component-registry.d.ts.map +1 -0
  24. package/src/component-registry.js +282 -0
  25. package/src/component-registry.js.map +1 -0
  26. package/src/context-error-type.d.ts +8 -0
  27. package/src/context-error-type.d.ts.map +1 -0
  28. package/src/context-error-type.js +12 -0
  29. package/src/context-error-type.js.map +1 -0
  30. package/src/core/component-store.d.ts +93 -0
  31. package/src/core/component-store.d.ts.map +1 -0
  32. package/src/core/component-store.js +198 -0
  33. package/src/core/component-store.js.map +1 -0
  34. package/src/core/context-manager.d.ts +72 -0
  35. package/src/core/context-manager.d.ts.map +1 -0
  36. package/src/core/context-manager.js +98 -0
  37. package/src/core/context-manager.js.map +1 -0
  38. package/src/core/enum-registry.d.ts +48 -0
  39. package/src/core/enum-registry.d.ts.map +1 -0
  40. package/src/core/enum-registry.js +85 -0
  41. package/src/core/enum-registry.js.map +1 -0
  42. package/src/core/i18n-engine.d.ts +241 -0
  43. package/src/core/i18n-engine.d.ts.map +1 -0
  44. package/src/core/i18n-engine.js +568 -0
  45. package/src/core/i18n-engine.js.map +1 -0
  46. package/src/core/{index.ts → index.d.ts} +1 -4
  47. package/src/core/index.d.ts.map +1 -0
  48. package/src/core/index.js +21 -0
  49. package/src/core/index.js.map +1 -0
  50. package/src/core/language-registry.d.ts +180 -0
  51. package/src/core/language-registry.d.ts.map +1 -0
  52. package/src/core/language-registry.js +298 -0
  53. package/src/core/language-registry.js.map +1 -0
  54. package/src/{core-component-id.ts → core-component-id.d.ts} +2 -1
  55. package/src/core-component-id.d.ts.map +1 -0
  56. package/src/core-component-id.js +9 -0
  57. package/src/core-component-id.js.map +1 -0
  58. package/src/core-i18n.d.ts +69 -0
  59. package/src/core-i18n.d.ts.map +1 -0
  60. package/src/core-i18n.js +219 -0
  61. package/src/core-i18n.js.map +1 -0
  62. package/src/core-plugin-factory.d.ts +28 -0
  63. package/src/core-plugin-factory.d.ts.map +1 -0
  64. package/src/core-plugin-factory.js +80 -0
  65. package/src/core-plugin-factory.js.map +1 -0
  66. package/src/core-string-key.d.ts +52 -0
  67. package/src/core-string-key.d.ts.map +1 -0
  68. package/src/core-string-key.js +61 -0
  69. package/src/core-string-key.js.map +1 -0
  70. package/src/create-translation-adapter.d.ts +33 -0
  71. package/src/create-translation-adapter.d.ts.map +1 -0
  72. package/src/create-translation-adapter.js +72 -0
  73. package/src/create-translation-adapter.js.map +1 -0
  74. package/src/enum-registry.d.ts +65 -0
  75. package/src/enum-registry.d.ts.map +1 -0
  76. package/src/enum-registry.js +123 -0
  77. package/src/enum-registry.js.map +1 -0
  78. package/src/errors/{base.ts → base.d.ts} +1 -1
  79. package/src/errors/base.d.ts.map +1 -0
  80. package/src/errors/base.js +11 -0
  81. package/src/errors/base.js.map +1 -0
  82. package/src/errors/context-error.d.ts +50 -0
  83. package/src/errors/context-error.d.ts.map +1 -0
  84. package/src/errors/context-error.js +93 -0
  85. package/src/errors/context-error.js.map +1 -0
  86. package/src/errors/enhanced-error-base.d.ts +125 -0
  87. package/src/errors/enhanced-error-base.d.ts.map +1 -0
  88. package/src/errors/enhanced-error-base.js +165 -0
  89. package/src/errors/enhanced-error-base.js.map +1 -0
  90. package/src/errors/handleable.d.ts +83 -0
  91. package/src/errors/handleable.d.ts.map +1 -0
  92. package/src/errors/handleable.js +136 -0
  93. package/src/errors/handleable.js.map +1 -0
  94. package/src/errors/i18n-error.d.ts +211 -0
  95. package/src/errors/i18n-error.d.ts.map +1 -0
  96. package/src/errors/i18n-error.js +358 -0
  97. package/src/errors/i18n-error.js.map +1 -0
  98. package/src/errors/{index.ts → index.d.ts} +1 -4
  99. package/src/errors/index.d.ts.map +1 -0
  100. package/src/errors/index.js +17 -0
  101. package/src/errors/index.js.map +1 -0
  102. package/src/errors/simple-typed-error.d.ts +53 -0
  103. package/src/errors/simple-typed-error.d.ts.map +1 -0
  104. package/src/errors/simple-typed-error.js +51 -0
  105. package/src/errors/simple-typed-error.js.map +1 -0
  106. package/src/errors/{translatable-exports.ts → translatable-exports.d.ts} +1 -1
  107. package/src/errors/translatable-exports.d.ts.map +1 -0
  108. package/src/errors/translatable-exports.js +15 -0
  109. package/src/errors/translatable-exports.js.map +1 -0
  110. package/src/errors/translatable-generic.d.ts +87 -0
  111. package/src/errors/translatable-generic.d.ts.map +1 -0
  112. package/src/errors/translatable-generic.js +139 -0
  113. package/src/errors/translatable-generic.js.map +1 -0
  114. package/src/errors/translatable-handleable-generic.d.ts +116 -0
  115. package/src/errors/translatable-handleable-generic.d.ts.map +1 -0
  116. package/src/errors/translatable-handleable-generic.js +121 -0
  117. package/src/errors/translatable-handleable-generic.js.map +1 -0
  118. package/src/errors/translatable.d.ts +63 -0
  119. package/src/errors/translatable.d.ts.map +1 -0
  120. package/src/errors/translatable.js +85 -0
  121. package/src/errors/translatable.js.map +1 -0
  122. package/src/errors/typed-handleable.d.ts +62 -0
  123. package/src/errors/typed-handleable.d.ts.map +1 -0
  124. package/src/errors/typed-handleable.js +108 -0
  125. package/src/errors/typed-handleable.js.map +1 -0
  126. package/src/errors/typed.d.ts +206 -0
  127. package/src/errors/typed.d.ts.map +1 -0
  128. package/src/errors/typed.js +458 -0
  129. package/src/errors/typed.js.map +1 -0
  130. package/src/gender/{gender-categories.ts → gender-categories.d.ts} +2 -6
  131. package/src/gender/gender-categories.d.ts.map +1 -0
  132. package/src/gender/gender-categories.js +15 -0
  133. package/src/gender/gender-categories.js.map +1 -0
  134. package/src/gender/gender-resolver.d.ts +14 -0
  135. package/src/gender/gender-resolver.d.ts.map +1 -0
  136. package/src/gender/gender-resolver.js +35 -0
  137. package/src/gender/gender-resolver.js.map +1 -0
  138. package/src/gender/{index.ts → index.d.ts} +1 -0
  139. package/src/gender/index.d.ts.map +1 -0
  140. package/src/gender/index.js +6 -0
  141. package/src/gender/index.js.map +1 -0
  142. package/src/global-active-context.d.ts +50 -0
  143. package/src/global-active-context.d.ts.map +1 -0
  144. package/src/global-active-context.js +185 -0
  145. package/src/global-active-context.js.map +1 -0
  146. package/src/icu/ast.d.ts +48 -0
  147. package/src/icu/ast.d.ts.map +1 -0
  148. package/src/icu/ast.js +16 -0
  149. package/src/icu/ast.js.map +1 -0
  150. package/src/icu/compiler.d.ts +16 -0
  151. package/src/icu/compiler.d.ts.map +1 -0
  152. package/src/icu/compiler.js +87 -0
  153. package/src/icu/compiler.js.map +1 -0
  154. package/src/icu/formatter-registry.d.ts +10 -0
  155. package/src/icu/formatter-registry.d.ts.map +1 -0
  156. package/src/icu/formatter-registry.js +34 -0
  157. package/src/icu/formatter-registry.js.map +1 -0
  158. package/src/icu/formatters/base-formatter.d.ts +8 -0
  159. package/src/icu/formatters/base-formatter.d.ts.map +1 -0
  160. package/src/icu/formatters/base-formatter.js +3 -0
  161. package/src/icu/formatters/base-formatter.js.map +1 -0
  162. package/src/icu/formatters/date-formatter.d.ts +5 -0
  163. package/src/icu/formatters/date-formatter.d.ts.map +1 -0
  164. package/src/icu/formatters/date-formatter.js +31 -0
  165. package/src/icu/formatters/date-formatter.js.map +1 -0
  166. package/src/icu/formatters/number-formatter.d.ts +5 -0
  167. package/src/icu/formatters/number-formatter.d.ts.map +1 -0
  168. package/src/icu/formatters/number-formatter.js +33 -0
  169. package/src/icu/formatters/number-formatter.js.map +1 -0
  170. package/src/icu/formatters/plural-formatter.d.ts +5 -0
  171. package/src/icu/formatters/plural-formatter.d.ts.map +1 -0
  172. package/src/icu/formatters/plural-formatter.js +15 -0
  173. package/src/icu/formatters/plural-formatter.js.map +1 -0
  174. package/src/icu/formatters/select-formatter.d.ts +5 -0
  175. package/src/icu/formatters/select-formatter.d.ts.map +1 -0
  176. package/src/icu/formatters/select-formatter.js +10 -0
  177. package/src/icu/formatters/select-formatter.js.map +1 -0
  178. package/src/icu/formatters/selectordinal-formatter.d.ts +5 -0
  179. package/src/icu/formatters/selectordinal-formatter.d.ts.map +1 -0
  180. package/src/icu/formatters/selectordinal-formatter.js +22 -0
  181. package/src/icu/formatters/selectordinal-formatter.js.map +1 -0
  182. package/src/icu/formatters/time-formatter.d.ts +5 -0
  183. package/src/icu/formatters/time-formatter.d.ts.map +1 -0
  184. package/src/icu/formatters/time-formatter.js +31 -0
  185. package/src/icu/formatters/time-formatter.js.map +1 -0
  186. package/src/icu/helpers.d.ts +9 -0
  187. package/src/icu/helpers.d.ts.map +1 -0
  188. package/src/icu/helpers.js +31 -0
  189. package/src/icu/helpers.js.map +1 -0
  190. package/src/icu/parser.d.ts +31 -0
  191. package/src/icu/parser.d.ts.map +1 -0
  192. package/src/icu/parser.js +203 -0
  193. package/src/icu/parser.js.map +1 -0
  194. package/src/icu/runtime.d.ts +10 -0
  195. package/src/icu/runtime.d.ts.map +1 -0
  196. package/src/icu/runtime.js +33 -0
  197. package/src/icu/runtime.js.map +1 -0
  198. package/src/icu/tokenizer.d.ts +37 -0
  199. package/src/icu/tokenizer.d.ts.map +1 -0
  200. package/src/icu/tokenizer.js +187 -0
  201. package/src/icu/tokenizer.js.map +1 -0
  202. package/src/icu/validator.d.ts +11 -0
  203. package/src/icu/validator.d.ts.map +1 -0
  204. package/src/icu/validator.js +140 -0
  205. package/src/icu/validator.js.map +1 -0
  206. package/src/{index.ts → index.d.ts} +6 -38
  207. package/src/index.d.ts.map +1 -0
  208. package/src/index.js +76 -0
  209. package/src/index.js.map +1 -0
  210. package/src/interfaces/active-context.interface.d.ts +36 -0
  211. package/src/interfaces/active-context.interface.d.ts.map +1 -0
  212. package/src/interfaces/active-context.interface.js +3 -0
  213. package/src/interfaces/active-context.interface.js.map +1 -0
  214. package/src/interfaces/component-config.interface.d.ts +16 -0
  215. package/src/interfaces/component-config.interface.d.ts.map +1 -0
  216. package/src/interfaces/component-config.interface.js +6 -0
  217. package/src/interfaces/component-config.interface.js.map +1 -0
  218. package/src/interfaces/engine-config.interface.d.ts +22 -0
  219. package/src/interfaces/engine-config.interface.d.ts.map +1 -0
  220. package/src/interfaces/engine-config.interface.js +6 -0
  221. package/src/interfaces/engine-config.interface.js.map +1 -0
  222. package/src/interfaces/global-active-context.d.ts +23 -0
  223. package/src/interfaces/global-active-context.d.ts.map +1 -0
  224. package/src/interfaces/global-active-context.js +3 -0
  225. package/src/interfaces/global-active-context.js.map +1 -0
  226. package/src/interfaces/handleable-error-options.d.ts +14 -0
  227. package/src/interfaces/handleable-error-options.d.ts.map +1 -0
  228. package/src/interfaces/handleable-error-options.js +3 -0
  229. package/src/interfaces/handleable-error-options.js.map +1 -0
  230. package/src/interfaces/handleable.d.ts +21 -0
  231. package/src/interfaces/handleable.d.ts.map +1 -0
  232. package/src/interfaces/handleable.js +3 -0
  233. package/src/interfaces/handleable.js.map +1 -0
  234. package/src/interfaces/i18n-engine.interface.d.ts +46 -0
  235. package/src/interfaces/i18n-engine.interface.d.ts.map +1 -0
  236. package/src/interfaces/i18n-engine.interface.js +6 -0
  237. package/src/interfaces/i18n-engine.interface.js.map +1 -0
  238. package/src/interfaces/{index.ts → index.d.ts} +1 -1
  239. package/src/interfaces/index.d.ts.map +1 -0
  240. package/src/interfaces/index.js +7 -0
  241. package/src/interfaces/index.js.map +1 -0
  242. package/src/interfaces/language-definition.interface.d.ts +17 -0
  243. package/src/interfaces/language-definition.interface.d.ts.map +1 -0
  244. package/src/interfaces/language-definition.interface.js +6 -0
  245. package/src/interfaces/language-definition.interface.js.map +1 -0
  246. package/src/interfaces/translation-options.interface.d.ts +15 -0
  247. package/src/interfaces/translation-options.interface.d.ts.map +1 -0
  248. package/src/interfaces/translation-options.interface.js +6 -0
  249. package/src/interfaces/translation-options.interface.js.map +1 -0
  250. package/src/interfaces/validation-result.interface.d.ts +24 -0
  251. package/src/interfaces/validation-result.interface.d.ts.map +1 -0
  252. package/src/interfaces/validation-result.interface.js +6 -0
  253. package/src/interfaces/validation-result.interface.js.map +1 -0
  254. package/src/language-codes.d.ts +28 -0
  255. package/src/language-codes.d.ts.map +1 -0
  256. package/src/language-codes.js +32 -0
  257. package/src/language-codes.js.map +1 -0
  258. package/src/language-definition.d.ts +14 -0
  259. package/src/language-definition.d.ts.map +1 -0
  260. package/src/language-definition.js +3 -0
  261. package/src/language-definition.js.map +1 -0
  262. package/src/plugin-i18n-engine.d.ts +164 -0
  263. package/src/plugin-i18n-engine.d.ts.map +1 -0
  264. package/src/plugin-i18n-engine.js +493 -0
  265. package/src/plugin-i18n-engine.js.map +1 -0
  266. package/src/pluralization/{index.ts → index.d.ts} +1 -1
  267. package/src/pluralization/index.d.ts.map +1 -0
  268. package/src/pluralization/index.js +10 -0
  269. package/src/pluralization/index.js.map +1 -0
  270. package/src/pluralization/language-plural-map.d.ts +29 -0
  271. package/src/pluralization/language-plural-map.d.ts.map +1 -0
  272. package/src/pluralization/language-plural-map.js +155 -0
  273. package/src/pluralization/language-plural-map.js.map +1 -0
  274. package/src/pluralization/{plural-categories.ts → plural-categories.d.ts} +3 -5
  275. package/src/pluralization/plural-categories.d.ts.map +1 -0
  276. package/src/pluralization/plural-categories.js +8 -0
  277. package/src/pluralization/plural-categories.js.map +1 -0
  278. package/src/pluralization/plural-rules.d.ts +102 -0
  279. package/src/pluralization/plural-rules.d.ts.map +1 -0
  280. package/src/pluralization/plural-rules.js +263 -0
  281. package/src/pluralization/plural-rules.js.map +1 -0
  282. package/src/registry-config.d.ts +16 -0
  283. package/src/registry-config.d.ts.map +1 -0
  284. package/src/registry-config.js +3 -0
  285. package/src/registry-config.js.map +1 -0
  286. package/src/registry-error-type.d.ts +20 -0
  287. package/src/registry-error-type.d.ts.map +1 -0
  288. package/src/registry-error-type.js +24 -0
  289. package/src/registry-error-type.js.map +1 -0
  290. package/src/registry-error.d.ts +25 -0
  291. package/src/registry-error.d.ts.map +1 -0
  292. package/src/registry-error.js +63 -0
  293. package/src/registry-error.js.map +1 -0
  294. package/src/strict-types.d.ts +19 -0
  295. package/src/strict-types.d.ts.map +1 -0
  296. package/src/strict-types.js +18 -0
  297. package/src/strict-types.js.map +1 -0
  298. package/src/strings/de.d.ts +3 -0
  299. package/src/strings/de.d.ts.map +1 -0
  300. package/src/strings/de.js +57 -0
  301. package/src/strings/de.js.map +1 -0
  302. package/src/strings/en-GB.d.ts +3 -0
  303. package/src/strings/en-GB.d.ts.map +1 -0
  304. package/src/strings/en-GB.js +57 -0
  305. package/src/strings/en-GB.js.map +1 -0
  306. package/src/strings/en-US.d.ts +3 -0
  307. package/src/strings/en-US.d.ts.map +1 -0
  308. package/src/strings/en-US.js +57 -0
  309. package/src/strings/en-US.js.map +1 -0
  310. package/src/strings/es.d.ts +3 -0
  311. package/src/strings/es.d.ts.map +1 -0
  312. package/src/strings/es.js +57 -0
  313. package/src/strings/es.js.map +1 -0
  314. package/src/strings/fr.d.ts +3 -0
  315. package/src/strings/fr.d.ts.map +1 -0
  316. package/src/strings/fr.js +57 -0
  317. package/src/strings/fr.js.map +1 -0
  318. package/src/strings/ja.d.ts +3 -0
  319. package/src/strings/ja.d.ts.map +1 -0
  320. package/src/strings/ja.js +57 -0
  321. package/src/strings/ja.js.map +1 -0
  322. package/src/strings/uk.d.ts +3 -0
  323. package/src/strings/uk.d.ts.map +1 -0
  324. package/src/strings/uk.js +57 -0
  325. package/src/strings/uk.js.map +1 -0
  326. package/src/strings/zh-CN.d.ts +3 -0
  327. package/src/strings/zh-CN.d.ts.map +1 -0
  328. package/src/strings/zh-CN.js +57 -0
  329. package/src/strings/zh-CN.js.map +1 -0
  330. package/src/template.d.ts +13 -0
  331. package/src/template.d.ts.map +1 -0
  332. package/src/template.js +40 -0
  333. package/src/template.js.map +1 -0
  334. package/src/translation-engine.d.ts +9 -0
  335. package/src/translation-engine.d.ts.map +1 -0
  336. package/src/translation-engine.js +3 -0
  337. package/src/translation-engine.js.map +1 -0
  338. package/src/translation-request.d.ts +10 -0
  339. package/src/translation-request.d.ts.map +1 -0
  340. package/src/translation-request.js +3 -0
  341. package/src/translation-request.js.map +1 -0
  342. package/src/translation-response.d.ts +9 -0
  343. package/src/translation-response.d.ts.map +1 -0
  344. package/src/translation-response.js +3 -0
  345. package/src/translation-response.js.map +1 -0
  346. package/src/types/engine.d.ts +47 -0
  347. package/src/types/engine.d.ts.map +1 -0
  348. package/src/types/engine.js +8 -0
  349. package/src/types/engine.js.map +1 -0
  350. package/src/types/{index.ts → index.d.ts} +1 -1
  351. package/src/types/index.d.ts.map +1 -0
  352. package/src/types/index.js +9 -0
  353. package/src/types/index.js.map +1 -0
  354. package/src/types/{plural-types.ts → plural-types.d.ts} +3 -29
  355. package/src/types/plural-types.d.ts.map +1 -0
  356. package/src/types/plural-types.js +39 -0
  357. package/src/types/plural-types.js.map +1 -0
  358. package/src/{types.ts → types.d.ts} +21 -72
  359. package/src/types.d.ts.map +1 -0
  360. package/src/types.js +23 -0
  361. package/src/types.js.map +1 -0
  362. package/src/utils/currency.d.ts +81 -0
  363. package/src/utils/currency.d.ts.map +1 -0
  364. package/src/utils/currency.js +99 -0
  365. package/src/utils/currency.js.map +1 -0
  366. package/src/utils/html-escape.d.ts +22 -0
  367. package/src/utils/html-escape.d.ts.map +1 -0
  368. package/src/utils/html-escape.js +53 -0
  369. package/src/utils/html-escape.js.map +1 -0
  370. package/src/utils/{index.ts → index.d.ts} +1 -0
  371. package/src/utils/index.d.ts.map +1 -0
  372. package/src/utils/index.js +12 -0
  373. package/src/utils/index.js.map +1 -0
  374. package/src/utils/lru-cache.d.ts +42 -0
  375. package/src/utils/lru-cache.d.ts.map +1 -0
  376. package/src/utils/lru-cache.js +73 -0
  377. package/src/utils/lru-cache.js.map +1 -0
  378. package/src/utils/{plural-helpers.ts → plural-helpers.d.ts} +4 -14
  379. package/src/utils/plural-helpers.d.ts.map +1 -0
  380. package/src/utils/plural-helpers.js +35 -0
  381. package/src/utils/plural-helpers.js.map +1 -0
  382. package/src/utils/safe-object.d.ts +39 -0
  383. package/src/utils/safe-object.d.ts.map +1 -0
  384. package/src/utils/{safe-object.ts → safe-object.js} +34 -37
  385. package/src/utils/safe-object.js.map +1 -0
  386. package/src/utils/string-utils.d.ts +28 -0
  387. package/src/utils/string-utils.d.ts.map +1 -0
  388. package/src/utils/string-utils.js +63 -0
  389. package/src/utils/string-utils.js.map +1 -0
  390. package/src/utils/timezone.d.ts +50 -0
  391. package/src/utils/timezone.d.ts.map +1 -0
  392. package/src/utils/timezone.js +74 -0
  393. package/src/utils/timezone.js.map +1 -0
  394. package/src/utils/validation.d.ts +40 -0
  395. package/src/utils/validation.d.ts.map +1 -0
  396. package/src/utils/validation.js +69 -0
  397. package/src/utils/validation.js.map +1 -0
  398. package/src/utils.d.ts +65 -0
  399. package/src/utils.d.ts.map +1 -0
  400. package/src/utils.js +129 -0
  401. package/src/utils.js.map +1 -0
  402. package/src/validation/{index.ts → index.d.ts} +1 -0
  403. package/src/validation/index.d.ts.map +1 -0
  404. package/src/validation/index.js +5 -0
  405. package/src/validation/index.js.map +1 -0
  406. package/src/validation/plural-validator.d.ts +46 -0
  407. package/src/validation/plural-validator.d.ts.map +1 -0
  408. package/src/validation/plural-validator.js +123 -0
  409. package/src/validation/plural-validator.js.map +1 -0
  410. package/src/validation-config.d.ts +12 -0
  411. package/src/validation-config.d.ts.map +1 -0
  412. package/src/validation-config.js +3 -0
  413. package/src/validation-config.js.map +1 -0
  414. package/src/validation-result.d.ts +13 -0
  415. package/src/validation-result.d.ts.map +1 -0
  416. package/src/validation-result.js +3 -0
  417. package/src/validation-result.js.map +1 -0
  418. package/LICENSE +0 -21
  419. package/src/builders/i18n-builder.ts +0 -82
  420. package/src/component-definition.ts +0 -11
  421. package/src/component-registration.ts +0 -29
  422. package/src/component-registry.ts +0 -432
  423. package/src/context-error-type.ts +0 -7
  424. package/src/core/component-store.ts +0 -241
  425. package/src/core/context-manager.ts +0 -113
  426. package/src/core/enum-registry.ts +0 -106
  427. package/src/core/i18n-engine.ts +0 -710
  428. package/src/core/language-registry.ts +0 -345
  429. package/src/core-i18n.ts +0 -270
  430. package/src/core-plugin-factory.ts +0 -111
  431. package/src/core-string-key.ts +0 -59
  432. package/src/create-translation-adapter.ts +0 -93
  433. package/src/enum-registry.ts +0 -152
  434. package/src/errors/context-error.ts +0 -122
  435. package/src/errors/enhanced-error-base.ts +0 -260
  436. package/src/errors/handleable.ts +0 -152
  437. package/src/errors/i18n-error.ts +0 -494
  438. package/src/errors/simple-typed-error.ts +0 -81
  439. package/src/errors/translatable-generic.ts +0 -245
  440. package/src/errors/translatable-handleable-generic.ts +0 -222
  441. package/src/errors/translatable.ts +0 -138
  442. package/src/errors/typed-handleable.ts +0 -138
  443. package/src/errors/typed.ts +0 -617
  444. package/src/gender/gender-resolver.ts +0 -40
  445. package/src/global-active-context.ts +0 -266
  446. package/src/icu/ast.ts +0 -56
  447. package/src/icu/compiler.ts +0 -96
  448. package/src/icu/formatter-registry.ts +0 -36
  449. package/src/icu/formatters/base-formatter.ts +0 -8
  450. package/src/icu/formatters/date-formatter.ts +0 -30
  451. package/src/icu/formatters/number-formatter.ts +0 -32
  452. package/src/icu/formatters/plural-formatter.ts +0 -12
  453. package/src/icu/formatters/select-formatter.ts +0 -7
  454. package/src/icu/formatters/selectordinal-formatter.ts +0 -17
  455. package/src/icu/formatters/time-formatter.ts +0 -30
  456. package/src/icu/helpers.ts +0 -34
  457. package/src/icu/parser.ts +0 -242
  458. package/src/icu/runtime.ts +0 -37
  459. package/src/icu/tokenizer.ts +0 -212
  460. package/src/icu/validator.ts +0 -163
  461. package/src/interfaces/active-context.interface.ts +0 -41
  462. package/src/interfaces/component-config.interface.ts +0 -17
  463. package/src/interfaces/engine-config.interface.ts +0 -22
  464. package/src/interfaces/global-active-context.ts +0 -39
  465. package/src/interfaces/handleable-error-options.ts +0 -13
  466. package/src/interfaces/handleable.ts +0 -20
  467. package/src/interfaces/i18n-engine.interface.ts +0 -57
  468. package/src/interfaces/language-definition.interface.ts +0 -17
  469. package/src/interfaces/translation-options.interface.ts +0 -15
  470. package/src/interfaces/validation-result.interface.ts +0 -24
  471. package/src/language-codes.ts +0 -40
  472. package/src/language-definition.ts +0 -13
  473. package/src/plugin-i18n-engine.ts +0 -707
  474. package/src/pluralization/language-plural-map.ts +0 -186
  475. package/src/pluralization/plural-rules.ts +0 -228
  476. package/src/registry-config.ts +0 -16
  477. package/src/registry-error-type.ts +0 -19
  478. package/src/registry-error.ts +0 -100
  479. package/src/strict-types.ts +0 -35
  480. package/src/strings/de.ts +0 -75
  481. package/src/strings/en-GB.ts +0 -74
  482. package/src/strings/en-US.ts +0 -74
  483. package/src/strings/es.ts +0 -74
  484. package/src/strings/fr.ts +0 -75
  485. package/src/strings/ja.ts +0 -73
  486. package/src/strings/uk.ts +0 -73
  487. package/src/strings/zh-CN.ts +0 -72
  488. package/src/template.ts +0 -72
  489. package/src/translation-engine.ts +0 -18
  490. package/src/translation-request.ts +0 -12
  491. package/src/translation-response.ts +0 -8
  492. package/src/types/engine.ts +0 -55
  493. package/src/utils/currency.ts +0 -141
  494. package/src/utils/html-escape.ts +0 -55
  495. package/src/utils/lru-cache.ts +0 -76
  496. package/src/utils/string-utils.ts +0 -77
  497. package/src/utils/timezone.ts +0 -76
  498. package/src/utils/validation.ts +0 -66
  499. package/src/utils.ts +0 -215
  500. package/src/validation/plural-validator.ts +0 -168
  501. package/src/validation-config.ts +0 -11
  502. package/src/validation-result.ts +0 -12
package/src/utils.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Replaces variables in a string with their corresponding values from vars or constants.
3
+ * @param str - The string containing variables to replace
4
+ * @param vars - An object mapping variable names to their replacement values
5
+ * @param constants - An object containing constant values for replacement
6
+ * @returns The string with variables replaced
7
+ */
8
+ export declare function replaceVariables(str: string, vars?: Record<string, string | number>, constants?: any): string;
9
+ /**
10
+ * Checks if a given key indicates a template string.
11
+ * @param key - The key to check
12
+ * @returns True if the key indicates a template, false otherwise
13
+ */
14
+ export declare function isTemplate(key: string): boolean;
15
+ /**
16
+ * Checks if a given timezone string is valid.
17
+ * @param timezone - The timezone string to validate
18
+ * @returns
19
+ */
20
+ export declare function isValidTimezone(timezone: string): boolean;
21
+ /**
22
+ * Converts parts to a single string key, joining with underscores.
23
+ * @param parts - The parts to join
24
+ * @returns The joined string key
25
+ */
26
+ export declare function toStringKey<TStringKey extends string>(...parts: string[]): TStringKey;
27
+ /**
28
+ * Converts an enum value to a string key by joining parts with underscores and appending the enum value.
29
+ * @param value - The enum value
30
+ * @param parts - Additional parts to join
31
+ * @returns The constructed string key
32
+ */
33
+ export declare function toStringKeyFromEnum<TStringKey extends string>(value: string, ...parts: string[]): TStringKey;
34
+ /**
35
+ * Type that constructs string keys from enum values with prefixes and optional template suffix
36
+ */
37
+ type BuildStringKey<TEnumValue extends string, TPrefixes extends readonly string[], TIsTemplate extends boolean = false> = TPrefixes extends readonly [] ? `${TEnumValue}${TIsTemplate extends true ? 'Template' : ''}` : TPrefixes extends readonly [infer First, ...infer Rest] ? First extends string ? Rest extends readonly string[] ? `${First}_${BuildStringKey<TEnumValue, Rest, TIsTemplate>}` : never : never : never;
38
+ /**
39
+ * Type that maps all enum values to their corresponding string keys
40
+ */
41
+ type ReasonMapFromEnum<TEnum extends Record<string, string>, TStringKey extends string, TPrefixes extends readonly string[] = [], TTemplateKeys extends Set<TEnum[keyof TEnum]> = never> = {
42
+ [K in TEnum[keyof TEnum]]: BuildStringKey<K, TPrefixes, TTemplateKeys extends Set<K> ? true : false> extends TStringKey ? BuildStringKey<K, TPrefixes, TTemplateKeys extends Set<K> ? true : false> : never;
43
+ };
44
+ /**
45
+ * Builds a reason map from an enum object, mapping each enum value to a string key.
46
+ * @param enumObj - The enum object
47
+ * @param prefixes - Prefixes to prepend to each string key
48
+ * @param templateKeys - Optional set of enum values that should have 'Template' suffix for template processing
49
+ * @returns The constructed reason map
50
+ */
51
+ export declare function buildReasonMap<TEnum extends Record<string, string>, TStringKey extends string>(enumObj: TEnum, prefixes?: string[], templateKeys?: Set<TEnum[keyof TEnum]>): Record<TEnum[keyof TEnum], TStringKey>;
52
+ /**
53
+ * Type-safe version of buildReasonMap that ensures all enum values are mapped and all string keys exist
54
+ */
55
+ export declare function buildTypeSafeReasonMap<TEnum extends Record<string, string>, TStringKey extends string, TPrefixes extends readonly string[] = [], TTemplateKeys extends Set<TEnum[keyof TEnum]> = never>(enumObj: TEnum, prefixes: TPrefixes, templateKeys?: TTemplateKeys): ReasonMapFromEnum<TEnum, TStringKey, TPrefixes, TTemplateKeys>;
56
+ /**
57
+ * Validates that a reason map has entries for all enum values
58
+ */
59
+ export declare function validateReasonMap<TEnum extends Record<string, string>, TStringKey extends string>(enumObj: TEnum, reasonMap: Partial<Record<TEnum[keyof TEnum], TStringKey>>): reasonMap is Record<TEnum[keyof TEnum], TStringKey>;
60
+ /**
61
+ * Creates a complete reason map ensuring all enum values are covered
62
+ */
63
+ export declare function createCompleteReasonMap<TEnum extends Record<string, string>, TStringKey extends string>(enumObj: TEnum, prefixes?: readonly string[], templateKeys?: Set<TEnum[keyof TEnum]>): Record<TEnum[keyof TEnum], TStringKey>;
64
+ export {};
65
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @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AK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,EAEzB,OAAO,EAAE,KAAK,EACd,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,GACzD,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,CAAC,CAMrD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,EAEzB,OAAO,EAAE,KAAK,EACd,QAAQ,GAAE,SAAS,MAAM,EAAO,EAChC,YAAY,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,GACrC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,CAAC,CAYxC"}
package/src/utils.js ADDED
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replaceVariables = replaceVariables;
4
+ exports.isTemplate = isTemplate;
5
+ exports.isValidTimezone = isValidTimezone;
6
+ exports.toStringKey = toStringKey;
7
+ exports.toStringKeyFromEnum = toStringKeyFromEnum;
8
+ exports.buildReasonMap = buildReasonMap;
9
+ exports.buildTypeSafeReasonMap = buildTypeSafeReasonMap;
10
+ exports.validateReasonMap = validateReasonMap;
11
+ exports.createCompleteReasonMap = createCompleteReasonMap;
12
+ const tslib_1 = require("tslib");
13
+ const moment_timezone_1 = tslib_1.__importDefault(require("moment-timezone"));
14
+ /**
15
+ * Replaces variables in a string with their corresponding values from vars or constants.
16
+ * @param str - The string containing variables to replace
17
+ * @param vars - An object mapping variable names to their replacement values
18
+ * @param constants - An object containing constant values for replacement
19
+ * @returns The string with variables replaced
20
+ */
21
+ function replaceVariables(str, vars, constants) {
22
+ // Ensure input is a string
23
+ if (typeof str !== 'string') {
24
+ str = String(str);
25
+ }
26
+ const variables = str.match(/\{(.+?)\}/g);
27
+ if (!variables)
28
+ return str;
29
+ let result = str;
30
+ for (const variable of variables) {
31
+ const varName = variable.slice(1, -1);
32
+ let replacement = '';
33
+ if (vars && varName in vars) {
34
+ replacement = String(vars[varName]);
35
+ }
36
+ else if (constants && varName in constants) {
37
+ replacement = String(constants[varName]);
38
+ }
39
+ if (replacement) {
40
+ result = result.replace(variable, replacement);
41
+ }
42
+ }
43
+ return result;
44
+ }
45
+ /**
46
+ * Checks if a given key indicates a template string.
47
+ * @param key - The key to check
48
+ * @returns True if the key indicates a template, false otherwise
49
+ */
50
+ function isTemplate(key) {
51
+ return key.trim().toLowerCase().endsWith('template');
52
+ }
53
+ /**
54
+ * Checks if a given timezone string is valid.
55
+ * @param timezone - The timezone string to validate
56
+ * @returns
57
+ */
58
+ function isValidTimezone(timezone) {
59
+ return moment_timezone_1.default.tz.zone(timezone) !== null;
60
+ }
61
+ /**
62
+ * Converts parts to a single string key, joining with underscores.
63
+ * @param parts - The parts to join
64
+ * @returns The joined string key
65
+ */
66
+ function toStringKey(...parts) {
67
+ return parts.join('_');
68
+ }
69
+ /**
70
+ * Converts an enum value to a string key by joining parts with underscores and appending the enum value.
71
+ * @param value - The enum value
72
+ * @param parts - Additional parts to join
73
+ * @returns The constructed string key
74
+ */
75
+ function toStringKeyFromEnum(value, ...parts) {
76
+ const allParts = [...parts, value];
77
+ return allParts.join('_');
78
+ }
79
+ /**
80
+ * Builds a reason map from an enum object, mapping each enum value to a string key.
81
+ * @param enumObj - The enum object
82
+ * @param prefixes - Prefixes to prepend to each string key
83
+ * @param templateKeys - Optional set of enum values that should have 'Template' suffix for template processing
84
+ * @returns The constructed reason map
85
+ */
86
+ function buildReasonMap(enumObj, prefixes = [], templateKeys) {
87
+ const map = {};
88
+ Object.values(enumObj).forEach((value) => {
89
+ const baseKey = [...prefixes, value].join('_');
90
+ const finalKey = templateKeys?.has(value)
91
+ ? baseKey + 'Template'
92
+ : baseKey;
93
+ map[value] = finalKey;
94
+ });
95
+ return map;
96
+ }
97
+ /**
98
+ * Type-safe version of buildReasonMap that ensures all enum values are mapped and all string keys exist
99
+ */
100
+ function buildTypeSafeReasonMap(enumObj, prefixes, templateKeys) {
101
+ const map = {};
102
+ Object.values(enumObj).forEach((value) => {
103
+ const baseKey = [...prefixes, value].join('_');
104
+ const finalKey = templateKeys?.has(value)
105
+ ? baseKey + 'Template'
106
+ : baseKey;
107
+ map[value] = finalKey;
108
+ });
109
+ return map;
110
+ }
111
+ /**
112
+ * Validates that a reason map has entries for all enum values
113
+ */
114
+ function validateReasonMap(enumObj, reasonMap) {
115
+ return Object.values(enumObj).every((value) => value in reasonMap &&
116
+ reasonMap[value] !== undefined);
117
+ }
118
+ /**
119
+ * Creates a complete reason map ensuring all enum values are covered
120
+ */
121
+ function createCompleteReasonMap(enumObj, prefixes = [], templateKeys) {
122
+ const map = buildReasonMap(enumObj, [...prefixes], templateKeys);
123
+ if (!validateReasonMap(enumObj, map)) {
124
+ const missing = Object.values(enumObj).filter((value) => !(value in map));
125
+ throw new Error(`Missing reason map entries for: ${missing.join(', ')}`);
126
+ }
127
+ return map;
128
+ }
129
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/utils.ts"],"names":[],"mappings":";;AASA,4CA8BC;AAOD,gCAEC;AAOD,0CAEC;AAOD,kCAIC;AAQD,kDAMC;AA4CD,wCAmBC;AAKD,wDAuBC;AAKD,8CAYC;AAKD,0DAmBC;;AAtND,8EAAqC;AAErC;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,GAAW,EACX,IAAsC,EACtC,SAAe;IAEf,2BAA2B;IAC3B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,S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AAc,EACd,SAA0D;IAE1D,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CACjC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI,SAAS;QAClB,SAAS,CAAC,KAA2B,CAAC,KAAK,SAAS,CACvD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAIrC,OAAc,EACd,WAA8B,EAAE,EAChC,YAAsC;IAEtC,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,YAAY,CAG9D,CAAC;IAEF,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from './plural-validator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/validation/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./plural-validator"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/validation/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Plural form validation
3
+ */
4
+ import { PluralString } from '../types/plural-types';
5
+ /**
6
+ * Result of validating plural forms.
7
+ */
8
+ export interface PluralValidationResult {
9
+ /** Whether the validation passed */
10
+ isValid: boolean;
11
+ /** Array of validation errors */
12
+ errors: string[];
13
+ /** Array of validation warnings */
14
+ warnings: string[];
15
+ }
16
+ /**
17
+ * Options for plural form validation.
18
+ */
19
+ export interface PluralValidationOptions {
20
+ /** If true, treat missing required forms as errors instead of warnings */
21
+ strict?: boolean;
22
+ /** If true, warn about unused plural forms */
23
+ checkUnused?: boolean;
24
+ /** If true, check for consistent variable usage across forms */
25
+ checkVariables?: boolean;
26
+ }
27
+ /**
28
+ * Validate plural forms for a specific language.
29
+ * Checks that all required plural forms are present and optionally validates variable consistency.
30
+ * @param value - The plural string value to validate
31
+ * @param language - The language code
32
+ * @param key - The translation key (for error messages)
33
+ * @param options - Validation options
34
+ * @returns Validation result with errors and warnings
35
+ */
36
+ export declare function validatePluralForms(value: PluralString, language: string, key: string, options?: PluralValidationOptions): PluralValidationResult;
37
+ /**
38
+ * Validate that count variable exists when plural forms are used.
39
+ * Pluralization requires a 'count' variable to determine which form to use.
40
+ * @param value - The plural string value
41
+ * @param variables - The variables object to check
42
+ * @param key - The translation key (for error messages)
43
+ * @returns Validation result with warnings if count is missing
44
+ */
45
+ export declare function validateCountVariable(value: PluralString, variables: Record<string, any> | undefined, key: string): PluralValidationResult;
46
+ //# sourceMappingURL=plural-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-validator.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/validation/plural-validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,CA8CxB;AAsDD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EAC1C,GAAG,EAAE,MAAM,GACV,sBAAsB,CASxB"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ /**
3
+ * Plural form validation
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validatePluralForms = validatePluralForms;
7
+ exports.validateCountVariable = validateCountVariable;
8
+ const plural_types_1 = require("../types/plural-types");
9
+ const language_plural_map_1 = require("../pluralization/language-plural-map");
10
+ /**
11
+ * Validate plural forms for a specific language.
12
+ * Checks that all required plural forms are present and optionally validates variable consistency.
13
+ * @param value - The plural string value to validate
14
+ * @param language - The language code
15
+ * @param key - The translation key (for error messages)
16
+ * @param options - Validation options
17
+ * @returns Validation result with errors and warnings
18
+ */
19
+ function validatePluralForms(value, language, key, options = {}) {
20
+ const errors = [];
21
+ const warnings = [];
22
+ if (!(0, plural_types_1.isPluralString)(value)) {
23
+ return { isValid: true, errors, warnings };
24
+ }
25
+ const required = (0, language_plural_map_1.getRequiredPluralForms)(language);
26
+ const all = (0, language_plural_map_1.getAllPluralForms)(language);
27
+ const provided = Object.keys(value);
28
+ // Check required forms
29
+ for (const form of required) {
30
+ if (!value[form]) {
31
+ if (options.strict) {
32
+ errors.push(`Missing required plural form '${form}' for language '${language}' in key '${key}'`);
33
+ }
34
+ else {
35
+ warnings.push(`Missing required plural form '${form}' for language '${language}' in key '${key}'`);
36
+ }
37
+ }
38
+ }
39
+ // Check unused forms
40
+ if (options.checkUnused) {
41
+ for (const form of provided) {
42
+ if (!all.includes(form)) {
43
+ warnings.push(`Unused plural form '${form}' for language '${language}' in key '${key}'`);
44
+ }
45
+ }
46
+ }
47
+ // Check variable consistency
48
+ if (options.checkVariables) {
49
+ const variables = extractVariables(value);
50
+ const inconsistent = findInconsistentVariables(value, variables);
51
+ for (const [form, missing] of Object.entries(inconsistent)) {
52
+ warnings.push(`Plural form '${form}' in key '${key}' missing variables: ${missing.join(', ')}`);
53
+ }
54
+ }
55
+ return {
56
+ isValid: errors.length === 0,
57
+ errors,
58
+ warnings,
59
+ };
60
+ }
61
+ /**
62
+ * Extract all variables from plural forms.
63
+ * Scans all plural form texts for {variable} patterns.
64
+ * @param value - The plural string value
65
+ * @returns Set of all variable names found
66
+ */
67
+ function extractVariables(value) {
68
+ const vars = new Set();
69
+ if (typeof value === 'string')
70
+ return vars;
71
+ for (const text of Object.values(value)) {
72
+ if (text) {
73
+ const matches = text.match(/\{(\w+)\}/g);
74
+ if (matches) {
75
+ matches.forEach(m => vars.add(m.slice(1, -1)));
76
+ }
77
+ }
78
+ }
79
+ return vars;
80
+ }
81
+ /**
82
+ * Find forms with inconsistent variables.
83
+ * Identifies plural forms that are missing variables used in other forms.
84
+ * @param value - The plural string value
85
+ * @param allVars - Set of all variables found across all forms
86
+ * @returns Object mapping form names to arrays of missing variable names
87
+ */
88
+ function findInconsistentVariables(value, allVars) {
89
+ const inconsistent = {};
90
+ if (typeof value === 'string')
91
+ return inconsistent;
92
+ for (const [form, text] of Object.entries(value)) {
93
+ if (text) {
94
+ const formVars = new Set();
95
+ const matches = text.match(/\{(\w+)\}/g);
96
+ if (matches) {
97
+ matches.forEach(m => formVars.add(m.slice(1, -1)));
98
+ }
99
+ const missing = Array.from(allVars).filter(v => !formVars.has(v));
100
+ if (missing.length > 0) {
101
+ inconsistent[form] = missing;
102
+ }
103
+ }
104
+ }
105
+ return inconsistent;
106
+ }
107
+ /**
108
+ * Validate that count variable exists when plural forms are used.
109
+ * Pluralization requires a 'count' variable to determine which form to use.
110
+ * @param value - The plural string value
111
+ * @param variables - The variables object to check
112
+ * @param key - The translation key (for error messages)
113
+ * @returns Validation result with warnings if count is missing
114
+ */
115
+ function validateCountVariable(value, variables, key) {
116
+ const errors = [];
117
+ const warnings = [];
118
+ if ((0, plural_types_1.isPluralString)(value) && (!variables || variables.count === undefined)) {
119
+ warnings.push(`Plural forms used in key '${key}' but no 'count' variable provided`);
120
+ }
121
+ return { isValid: true, errors, warnings };
122
+ }
123
+ //# sourceMappingURL=plural-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-validator.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/validation/plural-validator.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAuCH,kDAmDC;AA8DD,sDAaC;AAlKD,wDAAqE;AACrE,8EAAiG;AA0BjG;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CACjC,KAAmB,EACnB,QAAgB,EAChB,GAAW,EACX,UAAmC,EAAE;IAErC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,CAAC,IAAA,6BAAc,EAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,4CAAsB,EAAC,QAAQ,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,IAAA,uCAAiB,EAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,QA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C,CAAC;YACrD,CAAC;YAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,KAAmB,EACnB,SAA0C,EAC1C,GAAW;IAEX,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,IAAA,6BAAc,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE,CAAC;QAC3E,QAAQ,CAAC,IAAI,CAAC,6BAA6B,GAAG,oCAAoC,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Configuration for component registration validation
3
+ */
4
+ export interface ValidationConfig {
5
+ /** Whether to require all languages to have all strings */
6
+ readonly requireCompleteStrings: boolean;
7
+ /** Whether to allow registration with missing strings (will use fallbacks) */
8
+ readonly allowPartialRegistration: boolean;
9
+ /** Default language to fall back to for missing strings */
10
+ readonly fallbackLanguageId: string;
11
+ }
12
+ //# sourceMappingURL=validation-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-config.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/validation-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=validation-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-config.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/validation-config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Validation result for component registration
3
+ */
4
+ export interface ValidationResult {
5
+ readonly isValid: boolean;
6
+ readonly missingKeys: ReadonlyArray<{
7
+ readonly languageId: string;
8
+ readonly componentId: string;
9
+ readonly stringKey: string;
10
+ }>;
11
+ readonly errors: readonly string[];
12
+ }
13
+ //# sourceMappingURL=validation-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-result.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/validation-result.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;QAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=validation-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-result.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/validation-result.ts"],"names":[],"mappings":""}
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Digital Defiance
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,82 +0,0 @@
1
- /**
2
- * Fluent builder for I18n Engine
3
- */
4
-
5
- import { I18nEngine } from '../core/i18n-engine';
6
- import { EngineConfig, LanguageDefinition } from '../interfaces';
7
-
8
- export class I18nBuilder {
9
- private languages: LanguageDefinition[] = [];
10
- private config: EngineConfig = {};
11
- private instanceKey = 'default';
12
- private registerInstance = true;
13
- private setAsDefault = true;
14
-
15
- private constructor() {}
16
-
17
- static create(): I18nBuilder {
18
- return new I18nBuilder();
19
- }
20
-
21
- withLanguages(languages: readonly LanguageDefinition[]): this {
22
- this.languages = [...languages];
23
- return this;
24
- }
25
-
26
- withDefaultLanguage(languageId: string): this {
27
- this.config.defaultLanguage = languageId;
28
- return this;
29
- }
30
-
31
- withFallbackLanguage(languageId: string): this {
32
- this.config.fallbackLanguage = languageId;
33
- return this;
34
- }
35
-
36
- withConstants(constants: Record<string, any>): this {
37
- this.config.constants = constants;
38
- return this;
39
- }
40
-
41
- withValidation(validation: EngineConfig['validation']): this {
42
- this.config.validation = validation;
43
- return this;
44
- }
45
-
46
- withInstanceKey(key: string): this {
47
- this.instanceKey = key;
48
- return this;
49
- }
50
-
51
- withRegisterInstance(register: boolean): this {
52
- this.registerInstance = register;
53
- return this;
54
- }
55
-
56
- withSetAsDefault(setDefault: boolean): this {
57
- this.setAsDefault = setDefault;
58
- return this;
59
- }
60
-
61
- isolated(): this {
62
- this.registerInstance = false;
63
- return this;
64
- }
65
-
66
- asDefault(): this {
67
- this.setAsDefault = true;
68
- return this;
69
- }
70
-
71
- build(): I18nEngine {
72
- if (this.languages.length === 0) {
73
- throw new Error('At least one language must be provided');
74
- }
75
-
76
- return new I18nEngine(this.languages, this.config, {
77
- instanceKey: this.instanceKey,
78
- registerInstance: this.registerInstance,
79
- setAsDefault: this.setAsDefault,
80
- });
81
- }
82
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Component definition with its string keys
3
- */
4
- export interface ComponentDefinition<TStringKeys extends string> {
5
- /** Unique identifier for the component */
6
- readonly id: string;
7
- /** Human-readable name for the component */
8
- readonly name: string;
9
- /** Array of all string keys this component requires */
10
- readonly stringKeys: readonly TStringKeys[];
11
- }
@@ -1,29 +0,0 @@
1
- import { ComponentDefinition } from './component-definition';
2
- import { PartialComponentLanguageStrings } from './types';
3
-
4
- /**
5
- * Registration payload for a component with its strings
6
- */
7
- export interface ComponentRegistration<
8
- TStringKeys extends string,
9
- TLanguages extends string,
10
- > {
11
- readonly component: ComponentDefinition<TStringKeys>;
12
- readonly strings: PartialComponentLanguageStrings<TStringKeys, TLanguages>;
13
- readonly enumName?: string;
14
- readonly enumObject?: Record<string, TStringKeys>;
15
- readonly aliases?: readonly string[];
16
- }
17
-
18
- /**
19
- * Type utility to extract string keys from a component definition
20
- */
21
- type ExtractStringKeys<T> = T extends ComponentDefinition<infer K> ? K : never;
22
-
23
- /**
24
- * Type utility to create a strongly typed component registration
25
- */
26
- export type CreateComponentRegistration<
27
- TComponent extends ComponentDefinition<any>,
28
- TLanguages extends string,
29
- > = ComponentRegistration<ExtractStringKeys<TComponent>, TLanguages>;