@esgettext/runtime 1.0.0 → 1.2.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 (321) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -25
  3. package/{lib-esm → dist}/core/browser-environment.d.ts +1 -0
  4. package/dist/core/browser-environment.d.ts.map +1 -0
  5. package/dist/core/catalog-cache.d.ts +22 -0
  6. package/dist/core/catalog-cache.d.ts.map +1 -0
  7. package/dist/core/catalog-cache.spec.d.ts +2 -0
  8. package/dist/core/catalog-cache.spec.d.ts.map +1 -0
  9. package/dist/core/catalog-format.spec.d.ts +2 -0
  10. package/dist/core/catalog-format.spec.d.ts.map +1 -0
  11. package/dist/core/catalog.d.ts +48 -0
  12. package/dist/core/catalog.d.ts.map +1 -0
  13. package/{lib → dist}/core/data-viewlet.d.ts +11 -0
  14. package/dist/core/data-viewlet.d.ts.map +1 -0
  15. package/dist/core/data-viewlet.spec.d.ts +2 -0
  16. package/dist/core/data-viewlet.spec.d.ts.map +1 -0
  17. package/{lib-esm → dist}/core/explode-locale.d.ts +1 -0
  18. package/dist/core/explode-locale.d.ts.map +1 -0
  19. package/dist/core/explode-locale.spec.d.ts +2 -0
  20. package/dist/core/explode-locale.spec.d.ts.map +1 -0
  21. package/{lib-esm → dist}/core/germanic-plural.d.ts +1 -0
  22. package/dist/core/germanic-plural.d.ts.map +1 -0
  23. package/{lib → dist}/core/gettext-impl.d.ts +1 -0
  24. package/dist/core/gettext-impl.d.ts.map +1 -0
  25. package/dist/core/gettext.spec.d.ts +2 -0
  26. package/dist/core/gettext.spec.d.ts.map +1 -0
  27. package/{lib-esm → dist}/core/index.d.ts +1 -0
  28. package/dist/core/index.d.ts.map +1 -0
  29. package/dist/core/locale-container.d.ts +32 -0
  30. package/dist/core/locale-container.d.ts.map +1 -0
  31. package/dist/core/platform.d.ts +3 -0
  32. package/dist/core/platform.d.ts.map +1 -0
  33. package/{lib → dist}/core/resolve-impl.d.ts +1 -0
  34. package/dist/core/resolve-impl.d.ts.map +1 -0
  35. package/dist/core/resolve.spec.d.ts +2 -0
  36. package/dist/core/resolve.spec.d.ts.map +1 -0
  37. package/{lib-esm → dist}/core/select-locale.d.ts +1 -0
  38. package/dist/core/select-locale.d.ts.map +1 -0
  39. package/dist/core/select-locale.spec.d.ts +2 -0
  40. package/dist/core/select-locale.spec.d.ts.map +1 -0
  41. package/dist/core/set-locale-browser.spec.d.ts +2 -0
  42. package/dist/core/set-locale-browser.spec.d.ts.map +1 -0
  43. package/dist/core/set-locale-node.spec.d.ts +2 -0
  44. package/dist/core/set-locale-node.spec.d.ts.map +1 -0
  45. package/{lib-esm → dist}/core/split-locale.d.ts +1 -0
  46. package/dist/core/split-locale.d.ts.map +1 -0
  47. package/dist/core/split-locale.spec.d.ts +2 -0
  48. package/dist/core/split-locale.spec.d.ts.map +1 -0
  49. package/dist/core/textdomain.d.ts +464 -0
  50. package/dist/core/textdomain.d.ts.map +1 -0
  51. package/dist/core/textdomain.spec.d.ts +2 -0
  52. package/dist/core/textdomain.spec.d.ts.map +1 -0
  53. package/{lib-esm → dist}/core/user-locales.d.ts +1 -0
  54. package/dist/core/user-locales.d.ts.map +1 -0
  55. package/dist/esgettext.cjs.js +1411 -0
  56. package/dist/esgettext.cjs.js.map +1 -0
  57. package/dist/esgettext.esm.js +1406 -0
  58. package/dist/esgettext.esm.js.map +1 -0
  59. package/dist/esgettext.js +1415 -0
  60. package/dist/esgettext.js.map +1 -0
  61. package/dist/esgettext.min.js +2 -0
  62. package/dist/esgettext.min.js.map +1 -0
  63. package/dist/index-browser.d.ts +3 -0
  64. package/dist/index-browser.d.ts.map +1 -0
  65. package/dist/index.d.ts +3 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/parser/index.d.ts +4 -0
  68. package/dist/parser/index.d.ts.map +1 -0
  69. package/{lib-esm → dist}/parser/parse-json-catalog.d.ts +1 -0
  70. package/dist/parser/parse-json-catalog.d.ts.map +1 -0
  71. package/{lib-esm → dist}/parser/parse-mo-catalog.d.ts +1 -0
  72. package/dist/parser/parse-mo-catalog.d.ts.map +1 -0
  73. package/dist/parser/parse-mo-catalog.spec.d.ts +2 -0
  74. package/dist/parser/parse-mo-catalog.spec.d.ts.map +1 -0
  75. package/dist/parser/parse-mo-json-catalog.d.ts +4 -0
  76. package/dist/parser/parse-mo-json-catalog.d.ts.map +1 -0
  77. package/dist/parser/parse-mo-json-catalog.spec.d.ts +2 -0
  78. package/dist/parser/parse-mo-json-catalog.spec.d.ts.map +1 -0
  79. package/{lib/transport/fs.d.ts → dist/transport/fs-browser.d.ts} +2 -1
  80. package/dist/transport/fs-browser.d.ts.map +1 -0
  81. package/{lib-esm → dist}/transport/fs.d.ts +1 -0
  82. package/dist/transport/fs.d.ts.map +1 -0
  83. package/{lib-esm → dist}/transport/http.d.ts +1 -0
  84. package/dist/transport/http.d.ts.map +1 -0
  85. package/dist/transport/http.spec.d.ts +2 -0
  86. package/dist/transport/http.spec.d.ts.map +1 -0
  87. package/{lib → dist}/transport/index.d.ts +2 -1
  88. package/dist/transport/index.d.ts.map +1 -0
  89. package/{lib → dist}/transport/transport.interface.d.ts +1 -0
  90. package/dist/transport/transport.interface.d.ts.map +1 -0
  91. package/package.json +30 -14
  92. package/_bundles/runtime.js +0 -1356
  93. package/_bundles/runtime.js.map +0 -1
  94. package/_bundles/runtime.min.js +0 -2
  95. package/_bundles/runtime.min.js.map +0 -1
  96. package/api-docs/assets/highlight.css +0 -127
  97. package/api-docs/assets/main.js +0 -59
  98. package/api-docs/assets/navigation.js +0 -1
  99. package/api-docs/assets/search.js +0 -1
  100. package/api-docs/assets/style.css +0 -1414
  101. package/api-docs/classes/Textdomain.html +0 -364
  102. package/api-docs/index.html +0 -222
  103. package/api-docs/interfaces/Catalog.html +0 -20
  104. package/api-docs/interfaces/CatalogEntries.html +0 -11
  105. package/api-docs/interfaces/LocaleContainer.html +0 -19
  106. package/api-docs/interfaces/Placeholders.html +0 -9
  107. package/api-docs/modules.html +0 -6
  108. package/lib/core/browser-environment.d.ts +0 -1
  109. package/lib/core/browser-environment.js +0 -12
  110. package/lib/core/browser-environment.js.map +0 -1
  111. package/lib/core/catalog-cache.d.ts +0 -10
  112. package/lib/core/catalog-cache.js +0 -39
  113. package/lib/core/catalog-cache.js.map +0 -1
  114. package/lib/core/catalog-cache.spec.d.ts +0 -1
  115. package/lib/core/catalog-cache.spec.js +0 -24
  116. package/lib/core/catalog-cache.spec.js.map +0 -1
  117. package/lib/core/catalog-format.spec.d.ts +0 -1
  118. package/lib/core/catalog-format.spec.js +0 -35
  119. package/lib/core/catalog-format.spec.js.map +0 -1
  120. package/lib/core/catalog.d.ts +0 -9
  121. package/lib/core/catalog.js +0 -3
  122. package/lib/core/catalog.js.map +0 -1
  123. package/lib/core/data-viewlet.js +0 -57
  124. package/lib/core/data-viewlet.js.map +0 -1
  125. package/lib/core/data-viewlet.spec.d.ts +0 -1
  126. package/lib/core/data-viewlet.spec.js +0 -62
  127. package/lib/core/data-viewlet.spec.js.map +0 -1
  128. package/lib/core/explode-locale.d.ts +0 -3
  129. package/lib/core/explode-locale.js +0 -37
  130. package/lib/core/explode-locale.js.map +0 -1
  131. package/lib/core/explode-locale.spec.d.ts +0 -1
  132. package/lib/core/explode-locale.spec.js +0 -41
  133. package/lib/core/explode-locale.spec.js.map +0 -1
  134. package/lib/core/germanic-plural.d.ts +0 -1
  135. package/lib/core/germanic-plural.js +0 -8
  136. package/lib/core/germanic-plural.js.map +0 -1
  137. package/lib/core/gettext-impl.js +0 -38
  138. package/lib/core/gettext-impl.js.map +0 -1
  139. package/lib/core/gettext.spec.d.ts +0 -1
  140. package/lib/core/gettext.spec.js +0 -391
  141. package/lib/core/gettext.spec.js.map +0 -1
  142. package/lib/core/index.d.ts +0 -4
  143. package/lib/core/index.js +0 -21
  144. package/lib/core/index.js.map +0 -1
  145. package/lib/core/locale-container.d.ts +0 -8
  146. package/lib/core/locale-container.js +0 -3
  147. package/lib/core/locale-container.js.map +0 -1
  148. package/lib/core/path-separator.d.ts +0 -1
  149. package/lib/core/path-separator.js +0 -12
  150. package/lib/core/path-separator.js.map +0 -1
  151. package/lib/core/resolve-impl.js +0 -253
  152. package/lib/core/resolve-impl.js.map +0 -1
  153. package/lib/core/resolve.spec.d.ts +0 -1
  154. package/lib/core/resolve.spec.js +0 -345
  155. package/lib/core/resolve.spec.js.map +0 -1
  156. package/lib/core/select-locale.d.ts +0 -1
  157. package/lib/core/select-locale.js +0 -43
  158. package/lib/core/select-locale.js.map +0 -1
  159. package/lib/core/select-locale.spec.d.ts +0 -1
  160. package/lib/core/select-locale.spec.js +0 -27
  161. package/lib/core/select-locale.spec.js.map +0 -1
  162. package/lib/core/set-locale-browser.spec.d.ts +0 -1
  163. package/lib/core/set-locale-browser.spec.js +0 -17
  164. package/lib/core/set-locale-browser.spec.js.map +0 -1
  165. package/lib/core/set-locale-node.spec.d.ts +0 -1
  166. package/lib/core/set-locale-node.spec.js +0 -26
  167. package/lib/core/set-locale-node.spec.js.map +0 -1
  168. package/lib/core/split-locale.d.ts +0 -7
  169. package/lib/core/split-locale.js +0 -39
  170. package/lib/core/split-locale.js.map +0 -1
  171. package/lib/core/split-locale.spec.d.ts +0 -1
  172. package/lib/core/split-locale.spec.js +0 -59
  173. package/lib/core/split-locale.spec.js.map +0 -1
  174. package/lib/core/textdomain.d.ts +0 -55
  175. package/lib/core/textdomain.js +0 -277
  176. package/lib/core/textdomain.js.map +0 -1
  177. package/lib/core/textdomain.spec.d.ts +0 -1
  178. package/lib/core/textdomain.spec.js +0 -33
  179. package/lib/core/textdomain.spec.js.map +0 -1
  180. package/lib/core/user-locales.d.ts +0 -1
  181. package/lib/core/user-locales.js +0 -12
  182. package/lib/core/user-locales.js.map +0 -1
  183. package/lib/index-browser.d.ts +0 -2
  184. package/lib/index-browser.js +0 -44
  185. package/lib/index-browser.js.map +0 -1
  186. package/lib/index.d.ts +0 -2
  187. package/lib/index.js +0 -37
  188. package/lib/index.js.map +0 -1
  189. package/lib/parser/index.d.ts +0 -2
  190. package/lib/parser/index.js +0 -19
  191. package/lib/parser/index.js.map +0 -1
  192. package/lib/parser/parse-json-catalog.d.ts +0 -3
  193. package/lib/parser/parse-json-catalog.js +0 -37
  194. package/lib/parser/parse-json-catalog.js.map +0 -1
  195. package/lib/parser/parse-json-catalog.spec.d.ts +0 -1
  196. package/lib/parser/parse-json-catalog.spec.js +0 -41
  197. package/lib/parser/parse-json-catalog.spec.js.map +0 -1
  198. package/lib/parser/parse-mo-catalog.d.ts +0 -2
  199. package/lib/parser/parse-mo-catalog.js +0 -86
  200. package/lib/parser/parse-mo-catalog.js.map +0 -1
  201. package/lib/parser/parse-mo-catalog.spec.d.ts +0 -1
  202. package/lib/parser/parse-mo-catalog.spec.js +0 -115
  203. package/lib/parser/parse-mo-catalog.spec.js.map +0 -1
  204. package/lib/transport/fs.js +0 -18
  205. package/lib/transport/fs.js.map +0 -1
  206. package/lib/transport/http.d.ts +0 -4
  207. package/lib/transport/http.js +0 -27
  208. package/lib/transport/http.js.map +0 -1
  209. package/lib/transport/http.spec.d.ts +0 -1
  210. package/lib/transport/http.spec.js +0 -119
  211. package/lib/transport/http.spec.js.map +0 -1
  212. package/lib/transport/index.js +0 -20
  213. package/lib/transport/index.js.map +0 -1
  214. package/lib/transport/transport.interface.js +0 -3
  215. package/lib/transport/transport.interface.js.map +0 -1
  216. package/lib-esm/core/browser-environment.js +0 -8
  217. package/lib-esm/core/browser-environment.js.map +0 -1
  218. package/lib-esm/core/catalog-cache.d.ts +0 -10
  219. package/lib-esm/core/catalog-cache.js +0 -36
  220. package/lib-esm/core/catalog-cache.js.map +0 -1
  221. package/lib-esm/core/catalog-cache.spec.d.ts +0 -1
  222. package/lib-esm/core/catalog-cache.spec.js +0 -22
  223. package/lib-esm/core/catalog-cache.spec.js.map +0 -1
  224. package/lib-esm/core/catalog-format.spec.d.ts +0 -1
  225. package/lib-esm/core/catalog-format.spec.js +0 -33
  226. package/lib-esm/core/catalog-format.spec.js.map +0 -1
  227. package/lib-esm/core/catalog.d.ts +0 -9
  228. package/lib-esm/core/catalog.js +0 -2
  229. package/lib-esm/core/catalog.js.map +0 -1
  230. package/lib-esm/core/data-viewlet.d.ts +0 -11
  231. package/lib-esm/core/data-viewlet.js +0 -54
  232. package/lib-esm/core/data-viewlet.js.map +0 -1
  233. package/lib-esm/core/data-viewlet.spec.d.ts +0 -1
  234. package/lib-esm/core/data-viewlet.spec.js +0 -60
  235. package/lib-esm/core/data-viewlet.spec.js.map +0 -1
  236. package/lib-esm/core/explode-locale.js +0 -33
  237. package/lib-esm/core/explode-locale.js.map +0 -1
  238. package/lib-esm/core/explode-locale.spec.d.ts +0 -1
  239. package/lib-esm/core/explode-locale.spec.js +0 -39
  240. package/lib-esm/core/explode-locale.spec.js.map +0 -1
  241. package/lib-esm/core/germanic-plural.js +0 -4
  242. package/lib-esm/core/germanic-plural.js.map +0 -1
  243. package/lib-esm/core/gettext-impl.d.ts +0 -10
  244. package/lib-esm/core/gettext-impl.js +0 -34
  245. package/lib-esm/core/gettext-impl.js.map +0 -1
  246. package/lib-esm/core/gettext.spec.d.ts +0 -1
  247. package/lib-esm/core/gettext.spec.js +0 -389
  248. package/lib-esm/core/gettext.spec.js.map +0 -1
  249. package/lib-esm/core/index.js +0 -5
  250. package/lib-esm/core/index.js.map +0 -1
  251. package/lib-esm/core/locale-container.d.ts +0 -8
  252. package/lib-esm/core/locale-container.js +0 -2
  253. package/lib-esm/core/locale-container.js.map +0 -1
  254. package/lib-esm/core/path-separator.d.ts +0 -1
  255. package/lib-esm/core/path-separator.js +0 -8
  256. package/lib-esm/core/path-separator.js.map +0 -1
  257. package/lib-esm/core/resolve-impl.d.ts +0 -3
  258. package/lib-esm/core/resolve-impl.js +0 -249
  259. package/lib-esm/core/resolve-impl.js.map +0 -1
  260. package/lib-esm/core/resolve.spec.d.ts +0 -1
  261. package/lib-esm/core/resolve.spec.js +0 -340
  262. package/lib-esm/core/resolve.spec.js.map +0 -1
  263. package/lib-esm/core/select-locale.js +0 -39
  264. package/lib-esm/core/select-locale.js.map +0 -1
  265. package/lib-esm/core/select-locale.spec.d.ts +0 -1
  266. package/lib-esm/core/select-locale.spec.js +0 -25
  267. package/lib-esm/core/select-locale.spec.js.map +0 -1
  268. package/lib-esm/core/set-locale-browser.spec.d.ts +0 -1
  269. package/lib-esm/core/set-locale-browser.spec.js +0 -15
  270. package/lib-esm/core/set-locale-browser.spec.js.map +0 -1
  271. package/lib-esm/core/set-locale-node.spec.d.ts +0 -1
  272. package/lib-esm/core/set-locale-node.spec.js +0 -24
  273. package/lib-esm/core/set-locale-node.spec.js.map +0 -1
  274. package/lib-esm/core/split-locale.js +0 -35
  275. package/lib-esm/core/split-locale.js.map +0 -1
  276. package/lib-esm/core/split-locale.spec.d.ts +0 -1
  277. package/lib-esm/core/split-locale.spec.js +0 -57
  278. package/lib-esm/core/split-locale.spec.js.map +0 -1
  279. package/lib-esm/core/textdomain.d.ts +0 -55
  280. package/lib-esm/core/textdomain.js +0 -274
  281. package/lib-esm/core/textdomain.js.map +0 -1
  282. package/lib-esm/core/textdomain.spec.d.ts +0 -1
  283. package/lib-esm/core/textdomain.spec.js +0 -31
  284. package/lib-esm/core/textdomain.spec.js.map +0 -1
  285. package/lib-esm/core/user-locales.js +0 -8
  286. package/lib-esm/core/user-locales.js.map +0 -1
  287. package/lib-esm/index-browser.d.ts +0 -2
  288. package/lib-esm/index-browser.js +0 -26
  289. package/lib-esm/index-browser.js.map +0 -1
  290. package/lib-esm/index.d.ts +0 -2
  291. package/lib-esm/index.js +0 -19
  292. package/lib-esm/index.js.map +0 -1
  293. package/lib-esm/parser/index.d.ts +0 -2
  294. package/lib-esm/parser/index.js +0 -3
  295. package/lib-esm/parser/index.js.map +0 -1
  296. package/lib-esm/parser/parse-json-catalog.js +0 -32
  297. package/lib-esm/parser/parse-json-catalog.js.map +0 -1
  298. package/lib-esm/parser/parse-json-catalog.spec.d.ts +0 -1
  299. package/lib-esm/parser/parse-json-catalog.spec.js +0 -39
  300. package/lib-esm/parser/parse-json-catalog.spec.js.map +0 -1
  301. package/lib-esm/parser/parse-mo-catalog.js +0 -82
  302. package/lib-esm/parser/parse-mo-catalog.js.map +0 -1
  303. package/lib-esm/parser/parse-mo-catalog.spec.d.ts +0 -1
  304. package/lib-esm/parser/parse-mo-catalog.spec.js +0 -113
  305. package/lib-esm/parser/parse-mo-catalog.spec.js.map +0 -1
  306. package/lib-esm/transport/fs.js +0 -15
  307. package/lib-esm/transport/fs.js.map +0 -1
  308. package/lib-esm/transport/http.js +0 -24
  309. package/lib-esm/transport/http.js.map +0 -1
  310. package/lib-esm/transport/http.spec.d.ts +0 -1
  311. package/lib-esm/transport/http.spec.js +0 -114
  312. package/lib-esm/transport/http.spec.js.map +0 -1
  313. package/lib-esm/transport/index.d.ts +0 -3
  314. package/lib-esm/transport/index.js +0 -4
  315. package/lib-esm/transport/index.js.map +0 -1
  316. package/lib-esm/transport/transport.interface.d.ts +0 -3
  317. package/lib-esm/transport/transport.interface.js +0 -2
  318. package/lib-esm/transport/transport.interface.js.map +0 -1
  319. package/webpack.common.js +0 -38
  320. package/webpack.dev.js +0 -9
  321. package/webpack.prod.js +0 -8
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- This software is Copyright (C) 2020 by Guido Flohr.
1
+ This software is Copyright (C) 2020-2024 by Guido Flohr.
2
2
 
3
3
  This is free software, licensed under:
4
4
 
package/README.md CHANGED
@@ -6,22 +6,22 @@ GNU gettext-alike translation runtime library.
6
6
 
7
7
  - [API Documentation](#api-documentation)
8
8
  - [Internationalizing Hello World](#internationalizing-hello-world)
9
- - [Choosing a Textdomain](#choosing-a-textdomain)
10
- - [Install the Library](#install-the-library)
11
- - [Import the Library](#import-the-library)
12
- - [Prepare Your Sources](#prepare-your-sources)
13
- - [Translation Methods](#translation-methods)
14
- - [Simple Translations With `_()`](#simple-translations-with-_)
15
- - [Variable Interpolation With `_x()`](#variable-interpolation-with-_x)
16
- - [Plural Forms With `_nx()`](#plural-forms-with-_nx)
17
- - [Message Context With `_p()`](#message-context-with-_p)
18
- - [Specific Locale with `_l`](#specific-locale-with-_l)
19
- - [TODO: Gender-Specific Translations](#todo-gender-specific-translations)
20
- - [Selecting the Preferred Language with `selectLocale()`](#selecting-the-preferred-language-with-selectlocale)
9
+ - [Choosing a Textdomain](#choosing-a-textdomain)
10
+ - [Install the Library](#install-the-library)
11
+ - [Import the Library](#import-the-library)
12
+ - [Prepare Your Sources](#prepare-your-sources)
13
+ - [Translation Methods](#translation-methods)
14
+ - [Simple Translations With `_()`](#simple-translations-with-_)
15
+ - [Variable Interpolation With `_x()`](#variable-interpolation-with-_x)
16
+ - [Plural Forms With `_nx()`](#plural-forms-with-_nx)
17
+ - [Message Context With `_p()`](#message-context-with-_p)
18
+ - [Specific Locale with `_l`](#specific-locale-with-_l)
19
+ - [TODO: Gender-Specific Translations](#todo-gender-specific-translations)
20
+ - [Selecting the Preferred Language with `selectLocale()`](#selecting-the-preferred-language-with-selectlocale)
21
21
  - [Internationalizing a Library](#internationalizing-a-library)
22
22
  - [Frequently-Asked Questions](#frequently-asked-questions)
23
- - [Why do Template Strings not Work?](#why-do-template-strings-not-work)
24
- - [What Does the Error "template literals with embedded expressions are not allowed as arguments to gettext functions because they are not constant" Mean?](#what-does-the-error-template-literals-with-embedded-expressions-are-not-allowed-as-arguments-to-gettext-functions-because-they-are-not-constant-mean)
23
+ - [Why do Template Strings not Work?](#why-do-template-strings-not-work)
24
+ - [What Does the Error "template literals with embedded expressions are not allowed as arguments to gettext functions because they are not constant" Mean?](#what-does-the-error-template-literals-with-embedded-expressions-are-not-allowed-as-arguments-to-gettext-functions-because-they-are-not-constant-mean)
25
25
  - [Copyright](#copyright)
26
26
 
27
27
  ## API Documentation
@@ -69,38 +69,36 @@ You normally install the library with `npm` or `yarn`.
69
69
  With `npm`:
70
70
 
71
71
  ```shell
72
- $ npm install --save esgettext
72
+ $ npm install --save @esgettext/runtime
73
73
  ```
74
74
 
75
75
  Or with `yarn`:
76
76
 
77
77
  ```shell
78
- $ yarn add esgettext
78
+ $ yarn add @esgettext/runtime
79
79
  ```
80
80
 
81
81
  ### Import the Library
82
82
 
83
83
  How to import the library, depends on your environment.
84
84
 
85
- If you have the `import` keyword:
85
+ If you have the `import` keyword (TypeScript or ES module syntax):
86
86
 
87
87
  ```javascript
88
- import Textdomain from '@esgettext/runtime';
88
+ import { Textdomain } from '@esgettext/runtime';
89
89
  ```
90
90
 
91
91
  If you can use `require`:
92
92
 
93
93
  ```javascript
94
- const esgettext = require('@esgettext/runtime');
95
- const Textdomain = esgettext.Textdomain;
94
+ const { Textdomain } = require('@esgettext/runtime');
96
95
  ```
97
96
 
98
- _FIXME! Is this correct?_
99
97
 
100
98
  If you are writing javascript loaded by a browser:
101
99
 
102
100
  ```html
103
- <script src="https://cdn.jsdelivr.net/npm/@esgettext/runtime/_bundles/runtime.min.js"></script>
101
+ <script src="https://cdn.jsdelivr.net/npm/@esgettext/runtime/dist/esgettext.min.js"></script>
104
102
  <script>
105
103
  var Textdomain = esgettext.Textdomain;
106
104
  // ... your code follows.
@@ -150,8 +148,8 @@ You then have to tell the library where to find translations for the "hello"
150
148
  textdomain. You do that with the instance method
151
149
  [`bindtextdomain()`](https://gflohr.github.io/esgettext/packages/runtime/api-docs/classes/textdomain.html#bindtextdomain) that
152
150
  receives a (base) directory as its argument. The actual translation catalog
153
- would then be searched at `/assets/locale/fr/LC_MESSAGES/hello.json` (or
154
- `hello.mo` depending on your environment).
151
+ would then be searched at `/assets/locale/fr/LC_MESSAGES/hello.mo.json` (or
152
+ `hello.mo` or `hello.json`, depending on your environment).
155
153
 
156
154
  Don't worry that there are no translations at the moment. Failure is handled
157
155
  gracefully by the library falling back to using the original, untranslated
@@ -404,7 +402,7 @@ template string with interpolated expressions.
404
402
 
405
403
  ## Copyright
406
404
 
407
- Copyright (C) 2020 Guido Flohr <guido.flohr@cantanea.com>, all
405
+ Copyright (C) 2020-2024 Guido Flohr <guido.flohr@cantanea.com>, all
408
406
  rights reserved.
409
407
 
410
408
  This software is available under the terms and conditions of the
@@ -1 +1,2 @@
1
1
  export declare function browserEnvironment(browser?: boolean): boolean;
2
+ //# sourceMappingURL=browser-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-environment.d.ts","sourceRoot":"","sources":["../../src/core/browser-environment.ts"],"names":[],"mappings":"AAUA,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAM7D"}
@@ -0,0 +1,22 @@
1
+ import { Catalog } from './catalog';
2
+ export declare class CatalogCache {
3
+ private static instance;
4
+ private static cache;
5
+ private constructor();
6
+ static getInstance(): CatalogCache;
7
+ static clear(): void;
8
+ /**
9
+ * Lookup a Catalog for a given base path, locale, and textdomain.
10
+ *
11
+ * The locale key is usually the locale identifier (e.g. de-DE or sr\@latin).
12
+ * But it can also be a colon separated list of such locale identifiers.
13
+ *
14
+ *
15
+ * @param localeKey - the locale key
16
+ * @param textdomain - the textdomain
17
+ * @returns the cached Catalog, a Promise or null for failure
18
+ */
19
+ static lookup(localeKey: string, textdomain: string): Catalog | Promise<Catalog> | null;
20
+ static store(localeKey: string, textdomain: string, entry: Catalog | Promise<Catalog>): void;
21
+ }
22
+ //# sourceMappingURL=catalog-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-cache.d.ts","sourceRoot":"","sources":["../../src/core/catalog-cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBpC,qBAAa,YAAY;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA6B;IAEjD,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,YAAY;IAQlC,MAAM,CAAC,KAAK,IAAI,IAAI;IAIpB;;;;;;;;;;OAUG;WACW,MAAM,CACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAChB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;WAWtB,KAAK,CAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAC/B,IAAI;CAWP"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=catalog-cache.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-cache.spec.d.ts","sourceRoot":"","sources":["../../src/core/catalog-cache.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=catalog-format.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-format.spec.d.ts","sourceRoot":"","sources":["../../src/core/catalog-format.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The set of translations found in a [[`Catalog`]].
3
+ *
4
+ * This interface is used internally. You will only need it if you want to
5
+ * write your own message retrieval method or want to inspect a loaded
6
+ * [[`Catalog`]].
7
+ *
8
+ * The translations are looked up by their singular form in the original
9
+ * language. The value is an array of strings. The first item is the singular
10
+ * translation, the optional following items are the plural forms.
11
+ *
12
+ * If a translation has a message context, the key is the context joined
13
+ * with the translation by a `'\u0004'` character. For example, the key for
14
+ * the msgid "Open" with the msgctxt "Menu|File" would be `Menu|File\u0004Open`.
15
+ */
16
+ export type CatalogEntries = {
17
+ [key: string]: Array<string>;
18
+ };
19
+ /**
20
+ * A [[`Catalog`]] is a container for a set of translations loaded from a
21
+ * `mo.json` or a binary `.mo` file.
22
+ *
23
+ * This interface is used internally. You will only need it if you want to
24
+ * write your own message retrieval method or want to inspect a loaded
25
+ * [[`Catalog`]].
26
+ */
27
+ export type Catalog = {
28
+ /** The major revision number of the catalog, currently always 0. */
29
+ major: number;
30
+ /** The minor revision number of the catalog, currently always 0 or 1. */
31
+ minor: number;
32
+ /**
33
+ * Compute the index of a plural form from a number of items. If a language
34
+ * has one singular and two plural forms, the singular form would have
35
+ * index 0 and the plural forms have index 1 and 2.
36
+ *
37
+ * The plural function would then compute one of 0, 1, or 2 from an
38
+ * arbitrary non-negative integer.
39
+ *
40
+ * @param numItems - the number of items.
41
+ *
42
+ * @returns the index of the plural form.
43
+ */
44
+ pluralFunction(numItems: number): number;
45
+ /** The actual translations. */
46
+ entries: CatalogEntries;
47
+ };
48
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/core/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG;IACrB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IAEd,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzC,+BAA+B;IAC/B,OAAO,EAAE,cAAc,CAAC;CACxB,CAAC"}
@@ -3,9 +3,20 @@ export declare class DataViewlet {
3
3
  private decoder;
4
4
  private _encoding;
5
5
  constructor(array: Uint8Array, encoding?: string);
6
+ /**
7
+ * Get the encoding for strings.
8
+ *
9
+ * @returns the encoding in use
10
+ */
6
11
  get encoding(): string;
12
+ /**
13
+ * Switch to a new encoding.
14
+ *
15
+ * @param encoding - new encoding to use
16
+ */
7
17
  set encoding(encoding: string);
8
18
  readUInt32BE(offset?: number): number;
9
19
  readUInt32LE(offset?: number): number;
10
20
  readString(offset?: number, length?: number): string;
11
21
  }
22
+ //# sourceMappingURL=data-viewlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-viewlet.d.ts","sourceRoot":"","sources":["../../src/core/data-viewlet.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IAYtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAXvB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAS;gBAUR,KAAK,EAAE,UAAU,EAClC,QAAQ,SAAU;IAMnB;;;;OAIG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;OAIG;IACH,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAG5B;IAUD,YAAY,CAAC,MAAM,SAAI,GAAG,MAAM;IAuBhC,YAAY,CAAC,MAAM,SAAI,GAAG,MAAM;IAqBhC,UAAU,CAAC,MAAM,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAc/C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data-viewlet.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-viewlet.spec.d.ts","sourceRoot":"","sources":["../../src/core/data-viewlet.spec.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  import { SplitLocale } from './split-locale';
2
2
  export type ExplodedLocale = Array<Array<string>>;
3
3
  export declare function explodeLocale(locale: SplitLocale, vary?: boolean): ExplodedLocale;
4
+ //# sourceMappingURL=explode-locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explode-locale.d.ts","sourceRoot":"","sources":["../../src/core/explode-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAElD,wBAAgB,aAAa,CAC5B,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE,OAAO,GACZ,cAAc,CAgChB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=explode-locale.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explode-locale.spec.d.ts","sourceRoot":"","sources":["../../src/core/explode-locale.spec.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
1
  export declare function germanicPlural(numItems: number): number;
2
+ //# sourceMappingURL=germanic-plural.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"germanic-plural.d.ts","sourceRoot":"","sources":["../../src/core/germanic-plural.ts"],"names":[],"mappings":"AAOA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -8,3 +8,4 @@ interface GettextImplArgs {
8
8
  }
9
9
  export declare function gettextImpl(args: GettextImplArgs): string;
10
10
  export {};
11
+ //# sourceMappingURL=gettext-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gettext-impl.d.ts","sourceRoot":"","sources":["../../src/core/gettext-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,UAAU,eAAe;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CA8BzD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gettext.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gettext.spec.d.ts","sourceRoot":"","sources":["../../src/core/gettext.spec.ts"],"names":[],"mappings":""}
@@ -2,3 +2,4 @@ export * from './catalog';
2
2
  export * from './textdomain';
3
3
  export * from './catalog-cache';
4
4
  export * from './locale-container';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { Catalog } from './catalog';
2
+ /**
3
+ * An object storing locale information. It resembles the directory structure
4
+ * that [[`Catalog`]] objects are found in.
5
+ *
6
+ * Example, if your textdomain is 'myapp':
7
+ *
8
+ * <pre class="language-javascript"><code class="language-javascript">\{
9
+ * fr: \{
10
+ * LC_MESSAGES: \{
11
+ * myapp: catalogs['fr']
12
+ * \}
13
+ * \},
14
+ * 'de-DE': \{
15
+ * LC_MESSAGES: \{
16
+ * myapp: catalogs['de-DE']
17
+ * \}
18
+ * \}
19
+ * \}
20
+ * </code></pre>
21
+ */
22
+ export type LocaleContainer = {
23
+ /** A language code like 'fr' or 'de-DE'. */
24
+ [key: string]: {
25
+ /** The Locale category, always 'LC_MESSAGES'. */
26
+ [key: string]: {
27
+ /** The textdomain. */
28
+ [key: string]: Catalog;
29
+ };
30
+ };
31
+ };
32
+ //# sourceMappingURL=locale-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-container.d.ts","sourceRoot":"","sources":["../../src/core/locale-container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,4CAA4C;IAC5C,CAAC,GAAG,EAAE,MAAM,GAAG;QACd,iDAAiD;QACjD,CAAC,GAAG,EAAE,MAAM,GAAG;YACd,sBAAsB;YACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACvB,CAAC;KACF,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const isNode: boolean;
2
+ export declare const pathSeparator: string;
3
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/core/platform.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,SAGY,CAAC;AAEhC,eAAO,MAAM,aAAa,QAC0B,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { Catalog } from './catalog';
2
2
  import { LocaleContainer } from './locale-container';
3
3
  export declare function resolveImpl(domainname: string, path: string | LocaleContainer, format: string, localeKey: string): Promise<Catalog>;
4
+ //# sourceMappingURL=resolve-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-impl.d.ts","sourceRoot":"","sources":["../../src/core/resolve-impl.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAKpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA4MrD,wBAAsB,WAAW,CAChC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,eAAe,EAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolve.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.spec.d.ts","sourceRoot":"","sources":["../../src/core/resolve.spec.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
1
  export declare function selectLocale(supported: Array<string>, requested: Array<string>): string;
2
+ //# sourceMappingURL=select-locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-locale.d.ts","sourceRoot":"","sources":["../../src/core/select-locale.ts"],"names":[],"mappings":"AAgBA,wBAAgB,YAAY,CAC3B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EACxB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,GACtB,MAAM,CAiCR"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=select-locale.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-locale.spec.d.ts","sourceRoot":"","sources":["../../src/core/select-locale.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=set-locale-browser.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-locale-browser.spec.d.ts","sourceRoot":"","sources":["../../src/core/set-locale-browser.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=set-locale-node.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-locale-node.spec.d.ts","sourceRoot":"","sources":["../../src/core/set-locale-node.spec.ts"],"names":[],"mappings":""}
@@ -5,3 +5,4 @@ export interface SplitLocale {
5
5
  modifier?: string;
6
6
  }
7
7
  export declare function splitLocale(locale: string): SplitLocale | null;
8
+ //# sourceMappingURL=split-locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-locale.d.ts","sourceRoot":"","sources":["../../src/core/split-locale.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAwC9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=split-locale.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-locale.spec.d.ts","sourceRoot":"","sources":["../../src/core/split-locale.spec.ts"],"names":[],"mappings":""}