@x18n/builtins 0.0.13 → 0.0.14

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 (168) hide show
  1. package/dist/angular-templates-DqIOGfzT.mjs +8 -0
  2. package/dist/extractors.mjs +7 -3
  3. package/dist/finders.d.mts +4 -1
  4. package/dist/finders.mjs +1 -1
  5. package/dist/formats/ecmascript.d.mts +5 -0
  6. package/dist/formats/ecmascript.mjs +211 -0
  7. package/dist/formats/ftl.d.mts +5 -0
  8. package/dist/formats/ftl.mjs +234 -0
  9. package/dist/formats/ini.d.mts +5 -0
  10. package/dist/formats/ini.mjs +158 -0
  11. package/dist/formats/json.d.mts +6 -0
  12. package/dist/formats/json.mjs +10 -0
  13. package/dist/formats/json5.d.mts +5 -0
  14. package/dist/formats/json5.mjs +30 -0
  15. package/dist/formats/jsonc.d.mts +6 -0
  16. package/dist/formats/jsonc.mjs +10 -0
  17. package/dist/formats/php.d.mts +5 -0
  18. package/dist/formats/php.mjs +200 -0
  19. package/dist/formats/po.d.mts +5 -0
  20. package/dist/formats/po.mjs +177 -0
  21. package/dist/formats/properties.d.mts +5 -0
  22. package/dist/formats/properties.mjs +123 -0
  23. package/dist/formats/resx.d.mts +6 -0
  24. package/dist/formats/resx.mjs +202 -0
  25. package/dist/formats/yaml.d.mts +5 -0
  26. package/dist/formats/yaml.mjs +113 -0
  27. package/dist/formats.d.mts +10 -34
  28. package/dist/formats.mjs +61 -1
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.mjs +28 -22
  31. package/dist/{vue-CF4pe-Yr.mjs → js-CV-ECNJG.mjs} +67 -222
  32. package/dist/json-CyjI8bjp.d.mts +8 -0
  33. package/dist/json-Db-8qSbE.mjs +73 -0
  34. package/dist/jsx-templates-B1J0no3i.mjs +17 -0
  35. package/dist/locale-root-C_rch3IQ.mjs +15 -0
  36. package/dist/manifests.d.mts +8 -0
  37. package/dist/manifests.mjs +66 -2
  38. package/dist/placeholders.d.mts +11 -0
  39. package/dist/placeholders.mjs +28 -1
  40. package/dist/plugin-Cb1b0axD.mjs +83 -0
  41. package/dist/plural-forms-B7_QX4nG.mjs +12 -0
  42. package/dist/presets/cargo-i18n.d.mts +6 -0
  43. package/dist/presets/cargo-i18n.mjs +28 -0
  44. package/dist/presets/chrome-extension.d.mts +6 -0
  45. package/dist/presets/chrome-extension.mjs +52 -0
  46. package/dist/presets/dotnet-resx.d.mts +6 -0
  47. package/dist/presets/dotnet-resx.mjs +64 -0
  48. package/dist/presets/easy-localization.d.mts +6 -0
  49. package/dist/presets/easy-localization.mjs +36 -0
  50. package/dist/presets/ember-intl.d.mts +5 -0
  51. package/dist/presets/ember-intl.mjs +31 -0
  52. package/dist/presets/fluent-react.d.mts +5 -0
  53. package/dist/presets/fluent-react.mjs +46 -0
  54. package/dist/presets/fluent-vue.d.mts +5 -0
  55. package/dist/presets/fluent-vue.mjs +51 -0
  56. package/dist/presets/flutter-translate.d.mts +6 -0
  57. package/dist/presets/flutter-translate.mjs +30 -0
  58. package/dist/presets/flutter.d.mts +6 -0
  59. package/dist/presets/flutter.mjs +21 -0
  60. package/dist/presets/general.d.mts +6 -0
  61. package/dist/presets/general.mjs +17 -0
  62. package/dist/presets/globalize.d.mts +5 -0
  63. package/dist/presets/globalize.mjs +25 -0
  64. package/dist/presets/gravity-ui-i18n.d.mts +6 -0
  65. package/dist/presets/gravity-ui-i18n.mjs +41 -0
  66. package/dist/presets/i18n-js.d.mts +5 -0
  67. package/dist/presets/i18n-js.mjs +19 -0
  68. package/dist/presets/i18n-tag.d.mts +5 -0
  69. package/dist/presets/i18n-tag.mjs +21 -0
  70. package/dist/presets/i18next-shopify.d.mts +6 -0
  71. package/dist/presets/i18next-shopify.mjs +23 -0
  72. package/dist/presets/i18next.d.mts +5 -0
  73. package/dist/presets/i18next.mjs +10 -0
  74. package/dist/presets/i18nice.d.mts +6 -0
  75. package/dist/presets/i18nice.mjs +29 -0
  76. package/dist/presets/jekyll.d.mts +5 -0
  77. package/dist/presets/jekyll.mjs +23 -0
  78. package/dist/presets/laravel-vue-i18n.d.mts +6 -0
  79. package/dist/presets/laravel-vue-i18n.mjs +54 -0
  80. package/dist/presets/laravel.d.mts +6 -0
  81. package/dist/presets/laravel.mjs +23 -0
  82. package/dist/presets/lingui.d.mts +5 -0
  83. package/dist/presets/lingui.mjs +61 -0
  84. package/dist/presets/next-international.d.mts +5 -0
  85. package/dist/presets/next-international.mjs +27 -0
  86. package/dist/presets/next-intl.d.mts +5 -0
  87. package/dist/presets/next-intl.mjs +55 -0
  88. package/dist/presets/next-translate.d.mts +5 -0
  89. package/dist/presets/next-translate.mjs +53 -0
  90. package/dist/presets/ngx-translate.d.mts +5 -0
  91. package/dist/presets/ngx-translate.mjs +41 -0
  92. package/dist/presets/nuxt-i18n-micro.d.mts +5 -0
  93. package/dist/presets/nuxt-i18n-micro.mjs +81 -0
  94. package/dist/presets/nuxt-i18n.d.mts +5 -0
  95. package/dist/presets/nuxt-i18n.mjs +23 -0
  96. package/dist/presets/paraglide.d.mts +5 -0
  97. package/dist/presets/paraglide.mjs +38 -0
  98. package/dist/presets/php-gettext.d.mts +6 -0
  99. package/dist/presets/php-gettext.mjs +27 -0
  100. package/dist/presets/php-joomla.d.mts +6 -0
  101. package/dist/presets/php-joomla.mjs +22 -0
  102. package/dist/presets/polyglot.d.mts +5 -0
  103. package/dist/presets/polyglot.mjs +23 -0
  104. package/dist/presets/python-gettext.d.mts +6 -0
  105. package/dist/presets/python-gettext.mjs +44 -0
  106. package/dist/presets/react-i18next.d.mts +5 -0
  107. package/dist/presets/react-i18next.mjs +67 -0
  108. package/dist/presets/react-intl.d.mts +5 -0
  109. package/dist/presets/react-intl.mjs +47 -0
  110. package/dist/presets/ruby-rails.d.mts +7 -0
  111. package/dist/presets/ruby-rails.mjs +44 -0
  112. package/dist/presets/solid-primitives-i18n.d.mts +5 -0
  113. package/dist/presets/solid-primitives-i18n.mjs +29 -0
  114. package/dist/presets/svelte-i18n.d.mts +5 -0
  115. package/dist/presets/svelte-i18n.mjs +33 -0
  116. package/dist/presets/svelte-i18next.d.mts +5 -0
  117. package/dist/presets/svelte-i18next.mjs +27 -0
  118. package/dist/presets/transloco.d.mts +5 -0
  119. package/dist/presets/transloco.mjs +44 -0
  120. package/dist/presets/typesafe-i18n.d.mts +6 -0
  121. package/dist/presets/typesafe-i18n.mjs +61 -0
  122. package/dist/presets/ui5.d.mts +5 -0
  123. package/dist/presets/ui5.mjs +35 -0
  124. package/dist/presets/vscode-extension.d.mts +5 -0
  125. package/dist/presets/vscode-extension.mjs +53 -0
  126. package/dist/presets/vue-i18n.d.mts +5 -0
  127. package/dist/presets/vue-i18n.mjs +59 -0
  128. package/dist/presets.d.mts +7 -54
  129. package/dist/presets.mjs +346 -1
  130. package/dist/reporters/github.d.mts +6 -0
  131. package/dist/reporters/github.mjs +27 -0
  132. package/dist/reporters/json.d.mts +6 -0
  133. package/dist/reporters/json.mjs +24 -0
  134. package/dist/reporters/markdown.d.mts +6 -0
  135. package/dist/reporters/markdown.mjs +37 -0
  136. package/dist/reporters/pretty.d.mts +6 -0
  137. package/dist/reporters/pretty.mjs +64 -0
  138. package/dist/reporters/sarif.d.mts +6 -0
  139. package/dist/reporters/sarif.mjs +48 -0
  140. package/dist/reporters.d.mts +5 -12
  141. package/dist/reporters.mjs +8 -218
  142. package/dist/scanners/astro.d.mts +6 -0
  143. package/dist/scanners/astro.mjs +256 -0
  144. package/dist/scanners/js.d.mts +6 -0
  145. package/dist/scanners/js.mjs +33 -0
  146. package/dist/scanners/regex-scopes.d.mts +14 -0
  147. package/dist/scanners/regex-scopes.mjs +41 -0
  148. package/dist/scanners/regex.d.mts +9 -0
  149. package/dist/{regex-AYVhuSb6.mjs → scanners/regex.mjs} +2 -40
  150. package/dist/scanners/svelte.d.mts +6 -0
  151. package/dist/{scanners-DhnnVp7s.mjs → scanners/svelte.mjs} +3 -3
  152. package/dist/scanners/vue.d.mts +6 -0
  153. package/dist/scanners/vue.mjs +172 -0
  154. package/dist/scanners.d.mts +9 -50
  155. package/dist/scanners.mjs +36 -4
  156. package/dist/sfc-blocks-DaGKDZsb.mjs +213 -0
  157. package/dist/shared-BWaXUmwA.mjs +70 -0
  158. package/dist/shared-D-tbsYmc.mjs +30 -0
  159. package/dist/shared-D4NJBKEP.mjs +17 -0
  160. package/dist/shared-Tq06G0gp.mjs +6 -0
  161. package/dist/shared-meYeVckh.mjs +11 -0
  162. package/dist/vue-compiler-0sfLIiiL.mjs +8 -0
  163. package/package.json +67 -3
  164. package/dist/formats-CFkM5co0.mjs +0 -1370
  165. package/dist/presets-Co5SlnKr.mjs +0 -1187
  166. package/dist/sfc-blocks-BqQ8m9rX.mjs +0 -161
  167. package/dist/yaml-plugin.d.mts +0 -8
  168. package/dist/yaml-plugin.mjs +0 -68
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/i18n-tag/index.d.ts
3
+ export declare function i18nTag(): Preset;
4
+ //#endregion
5
+ export { i18nTag as default };
@@ -0,0 +1,21 @@
1
+ import { n as scriptExtensions } from "../shared-D4NJBKEP.mjs";
2
+ import { createLibraryPlugin } from "@x18n/core";
3
+ //#region src/presets/i18n-tag/index.ts
4
+ function i18nTag() {
5
+ return {
6
+ name: "i18n-tag",
7
+ plugins: [createLibraryPlugin({
8
+ name: "x18n:i18n-tag",
9
+ regex: [{
10
+ extensions: [...scriptExtensions, "vue"],
11
+ patterns: ["i18n`({key})`"]
12
+ }],
13
+ templates: [{
14
+ template: "i18n`{key}`",
15
+ kinds: ["js-string", "js-template"]
16
+ }]
17
+ })]
18
+ };
19
+ }
20
+ //#endregion
21
+ export { i18nTag as default, i18nTag };
@@ -0,0 +1,6 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/i18next-shopify/index.d.ts
3
+ /** Shopify's i18next format: plural and ordinal forms as nested keys (`{key}.one`). */
4
+ export declare function i18nextShopify(): Preset;
5
+ //#endregion
6
+ export { i18nextShopify as default };
@@ -0,0 +1,23 @@
1
+ import { braces } from "../placeholders.mjs";
2
+ import reactI18next from "./react-i18next.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/i18next-shopify/index.ts
5
+ /** Shopify's i18next format: plural and ordinal forms as nested keys (`{key}.one`). */
6
+ function i18nextShopify() {
7
+ const derivedKeys = [
8
+ "{key}.ordinal.{ordinal}",
9
+ "{key}.{plural}",
10
+ ...["plural", ...Array.from({ length: 10 }, (_, i) => String(i))].map((form) => `{key}.${form}`)
11
+ ];
12
+ return {
13
+ name: "i18next-shopify",
14
+ plugins: [...reactI18next().plugins, createLibraryPlugin({
15
+ name: "x18n:i18next-shopify",
16
+ derivedKeys,
17
+ keyStyle: "nested",
18
+ placeholders: [braces]
19
+ })]
20
+ };
21
+ }
22
+ //#endregion
23
+ export { i18nextShopify as default, i18nextShopify };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/i18next/index.d.ts
3
+ export declare function i18next(): Preset;
4
+ //#endregion
5
+ export { i18next as default };
@@ -0,0 +1,10 @@
1
+ import { t as i18nextPlugin } from "../plugin-Cb1b0axD.mjs";
2
+ //#region src/presets/i18next/index.ts
3
+ function i18next() {
4
+ return {
5
+ name: "i18next",
6
+ plugins: [i18nextPlugin]
7
+ };
8
+ }
9
+ //#endregion
10
+ export { i18next as default, i18next };
@@ -0,0 +1,6 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/i18nice/index.d.ts
3
+ /** i18nice and python-i18n, which it forked: `{namespace}.{locale}.yml` files that start with the locale, `i18n.t('namespace.key')`. */
4
+ export declare function i18nice(): Preset;
5
+ //#endregion
6
+ export { i18nice as default };
@@ -0,0 +1,29 @@
1
+ import { percentBraces } from "../placeholders.mjs";
2
+ import { t as localeRoot } from "../locale-root-C_rch3IQ.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/i18nice/index.ts
5
+ /** i18nice and python-i18n, which it forked: `{namespace}.{locale}.yml` files that start with the locale, `i18n.t('namespace.key')`. */
6
+ function i18nice() {
7
+ return {
8
+ name: "i18nice",
9
+ plugins: [createLibraryPlugin({
10
+ name: "x18n:i18nice",
11
+ regex: [{
12
+ extensions: ["py"],
13
+ patterns: ["(?<![\\w.])(?:i18n\\.)?t\\(\\s*['\"]({key})['\"]"]
14
+ }],
15
+ resources: [{ pattern: "translations/{namespaces}.{locale}.{ext}" }, { pattern: "locales/{namespaces}.{locale}.{ext}" }],
16
+ derivedKeys: [
17
+ "{key}.zero",
18
+ "{key}.one",
19
+ "{key}.few",
20
+ "{key}.many"
21
+ ],
22
+ transformResource: localeRoot((ctx) => /\.(?:ya?ml|json)$/.test(ctx.path) && ctx.path.slice(0, ctx.path.lastIndexOf(".")).endsWith(`.${ctx.locale}`)),
23
+ templates: [{ template: "i18n.t('{key}')" }],
24
+ placeholders: [percentBraces]
25
+ })]
26
+ };
27
+ }
28
+ //#endregion
29
+ export { i18nice as default, i18nice };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/jekyll/index.d.ts
3
+ export declare function jekyll(): Preset;
4
+ //#endregion
5
+ export { jekyll as default };
@@ -0,0 +1,23 @@
1
+ import { createLibraryPlugin } from "@x18n/core";
2
+ //#region src/presets/jekyll/index.ts
3
+ function jekyll() {
4
+ return {
5
+ name: "jekyll",
6
+ plugins: [createLibraryPlugin({
7
+ name: "x18n:jekyll",
8
+ regex: [{
9
+ extensions: [
10
+ "html",
11
+ "md",
12
+ "liquid"
13
+ ],
14
+ patterns: ["\\{%\\s+t\\s+({key})\\s+%\\}"]
15
+ }],
16
+ resources: [{ pattern: "_i18n/{locale}.yml" }],
17
+ keyStyle: "nested",
18
+ templates: [{ template: "{% t {key} %}" }]
19
+ })]
20
+ };
21
+ }
22
+ //#endregion
23
+ export { jekyll as default, jekyll };
@@ -0,0 +1,6 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/laravel-vue-i18n/index.d.ts
3
+ /** laravel-vue-i18n: the Laravel translation files read from Vue, so keys match the `laravel` preset. */
4
+ export declare function laravelVueI18n(): Preset;
5
+ //#endregion
6
+ export { laravelVueI18n as default };
@@ -0,0 +1,54 @@
1
+ import { colon } from "../placeholders.mjs";
2
+ import { n as laravelResources, t as laravelKey } from "../shared-meYeVckh.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/laravel-vue-i18n/index.ts
5
+ /** laravel-vue-i18n: the Laravel translation files read from Vue, so keys match the `laravel` preset. */
6
+ function laravelVueI18n() {
7
+ return {
8
+ name: "laravel-vue-i18n",
9
+ plugins: [createLibraryPlugin({
10
+ name: "x18n:laravel-vue-i18n",
11
+ calls: [{ callee: [
12
+ "trans",
13
+ "wTrans",
14
+ "transChoice",
15
+ "wTransChoice",
16
+ "trans_choice",
17
+ "$t",
18
+ "$tChoice"
19
+ ] }],
20
+ resources: laravelResources,
21
+ normalizeKey: laravelKey,
22
+ extra: async (draft, ctx) => {
23
+ draft.extract = {
24
+ keygen: "source",
25
+ ...draft.extract
26
+ };
27
+ const phpFiles = await ctx.host.glob(["lang/*/**/*.php", "resources/lang/*/**/*.php"], { gitignore: false });
28
+ const locales = new Set(phpFiles.map((path) => {
29
+ const segments = path.split("/");
30
+ return segments[segments.indexOf("lang") + 1];
31
+ }));
32
+ draft.ignoreLocales = [...draft.ignoreLocales, ...[...locales].map((locale) => `php_${locale}`)];
33
+ },
34
+ templates: [
35
+ {
36
+ template: "{{ $t('{key}'{args}) }}",
37
+ kinds: ["vue-template-text"]
38
+ },
39
+ {
40
+ template: ":{attr}=\"$t('{key}'{args})\"",
41
+ kinds: ["vue-attribute"]
42
+ },
43
+ {
44
+ template: "trans('{key}'{args})",
45
+ kinds: ["js-string", "js-template"],
46
+ imports: ["import { trans } from 'laravel-vue-i18n'"]
47
+ }
48
+ ],
49
+ placeholders: [colon]
50
+ })]
51
+ };
52
+ }
53
+ //#endregion
54
+ export { laravelVueI18n as default, laravelVueI18n };
@@ -0,0 +1,6 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/laravel/index.d.ts
3
+ /** Laravel: `lang/{locale}/{file}.php` arrays and `lang/{locale}.json`; keys are `file.key`. Exclusive like i18n-ally. */
4
+ export declare function laravel(): Preset;
5
+ //#endregion
6
+ export { laravel as default };
@@ -0,0 +1,23 @@
1
+ import { colon } from "../placeholders.mjs";
2
+ import { n as laravelResources, t as laravelKey } from "../shared-meYeVckh.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/laravel/index.ts
5
+ /** Laravel: `lang/{locale}/{file}.php` arrays and `lang/{locale}.json`; keys are `file.key`. Exclusive like i18n-ally. */
6
+ function laravel() {
7
+ return {
8
+ name: "laravel",
9
+ plugins: [createLibraryPlugin({
10
+ name: "x18n:laravel",
11
+ regex: [{
12
+ extensions: ["php"],
13
+ patterns: ["[^\\w\\d](?:__|trans|@lang|trans_choice|Lang::get|Lang::choice)\\(\\s*'([^']+)'", "[^\\w\\d](?:__|trans|@lang|trans_choice|Lang::get|Lang::choice)\\(\\s*\"([^\"]+)\""]
14
+ }],
15
+ resources: laravelResources,
16
+ normalizeKey: laravelKey,
17
+ templates: [{ template: "__('{key}')" }],
18
+ placeholders: [colon]
19
+ })]
20
+ };
21
+ }
22
+ //#endregion
23
+ export { laravel as default, laravel };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/lingui/index.d.ts
3
+ export declare function lingui(): Preset;
4
+ //#endregion
5
+ export { lingui as default };
@@ -0,0 +1,61 @@
1
+ import { icu } from "../placeholders.mjs";
2
+ import { n as scriptExtensions } from "../shared-D4NJBKEP.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/lingui/index.ts
5
+ function lingui() {
6
+ return {
7
+ name: "lingui",
8
+ plugins: [createLibraryPlugin({
9
+ name: "x18n:lingui",
10
+ calls: [
11
+ { callee: [
12
+ "i18n._",
13
+ "i18n.t",
14
+ "t",
15
+ "_"
16
+ ] },
17
+ {
18
+ callee: [
19
+ "t",
20
+ "msg",
21
+ "defineMessage",
22
+ "i18n._",
23
+ "Trans"
24
+ ],
25
+ key: {
26
+ arg: 0,
27
+ property: "id"
28
+ }
29
+ },
30
+ {
31
+ callee: "useLingui",
32
+ factory: true,
33
+ returns: ["t", "_"]
34
+ }
35
+ ],
36
+ regex: [{
37
+ extensions: scriptExtensions,
38
+ patterns: ["\\bt`({key})`", "<Trans>[\\s]*({key})[\\s]*<\\/Trans>"]
39
+ }],
40
+ resources: [{ pattern: "src/locales/{locale}/messages.po" }, { pattern: "locales/{locale}/messages.po" }],
41
+ extra: (draft) => {
42
+ draft.extract = {
43
+ keygen: "source",
44
+ ...draft.extract
45
+ };
46
+ },
47
+ templates: [{
48
+ template: "<Trans>{key}</Trans>",
49
+ kinds: ["jsx-text"],
50
+ imports: ["import { Trans } from '@lingui/react/macro'"]
51
+ }, {
52
+ template: "t`{key}`",
53
+ kinds: ["js-string", "js-template"],
54
+ imports: ["import { t } from '@lingui/core/macro'"]
55
+ }],
56
+ placeholders: [icu]
57
+ })]
58
+ };
59
+ }
60
+ //#endregion
61
+ export { lingui as default, lingui };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/next-international/index.d.ts
3
+ export declare function nextInternational(): Preset;
4
+ //#endregion
5
+ export { nextInternational as default };
@@ -0,0 +1,27 @@
1
+ import { braces } from "../placeholders.mjs";
2
+ import { t as jsxTemplates } from "../jsx-templates-B1J0no3i.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/next-international/index.ts
5
+ function nextInternational() {
6
+ return {
7
+ name: "next-international",
8
+ plugins: [createLibraryPlugin({
9
+ name: "x18n:next-international",
10
+ calls: [{
11
+ callee: ["useI18n", "getI18n"],
12
+ factory: true,
13
+ returns: ["t"]
14
+ }, {
15
+ callee: ["useScopedI18n", "getScopedI18n"],
16
+ factory: true,
17
+ returns: ["t"],
18
+ keyPrefix: { arg: 0 }
19
+ }],
20
+ resources: [{ pattern: "locales/{locale}.{ext}" }, { pattern: "src/locales/{locale}.{ext}" }],
21
+ templates: jsxTemplates,
22
+ placeholders: [braces]
23
+ })]
24
+ };
25
+ }
26
+ //#endregion
27
+ export { nextInternational as default, nextInternational };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/next-intl/index.d.ts
3
+ export declare function nextIntl(): Preset;
4
+ //#endregion
5
+ export { nextIntl as default };
@@ -0,0 +1,55 @@
1
+ import { icu } from "../placeholders.mjs";
2
+ import { createLibraryPlugin } from "@x18n/core";
3
+ //#region src/presets/next-intl/index.ts
4
+ function nextIntl() {
5
+ return {
6
+ name: "next-intl",
7
+ plugins: [createLibraryPlugin({
8
+ name: "x18n:next-intl",
9
+ calls: [{
10
+ callee: ["useTranslations", "getTranslations"],
11
+ factory: true,
12
+ returns: [
13
+ "t",
14
+ "t.rich",
15
+ "t.markup",
16
+ "t.raw",
17
+ "t.has"
18
+ ],
19
+ keyPrefix: { arg: 0 }
20
+ }, {
21
+ callee: "getTranslations",
22
+ factory: true,
23
+ returns: [
24
+ "t",
25
+ "t.rich",
26
+ "t.markup",
27
+ "t.raw",
28
+ "t.has"
29
+ ],
30
+ keyPrefix: {
31
+ arg: 0,
32
+ property: "namespace"
33
+ }
34
+ }],
35
+ resources: [{ pattern: "messages/{locale}.json" }, { pattern: "src/messages/{locale}.json" }],
36
+ templates: [
37
+ {
38
+ template: "{t('{key}'{args})}",
39
+ kinds: ["jsx-text"]
40
+ },
41
+ {
42
+ template: "{attr}={t('{key}'{args})}",
43
+ kinds: ["jsx-attribute"]
44
+ },
45
+ {
46
+ template: "t('{key}'{args})",
47
+ kinds: ["js-string", "js-template"]
48
+ }
49
+ ],
50
+ placeholders: [icu]
51
+ })]
52
+ };
53
+ }
54
+ //#endregion
55
+ export { nextIntl as default, nextIntl };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/next-translate/index.d.ts
3
+ export declare function nextTranslate(): Preset;
4
+ //#endregion
5
+ export { nextTranslate as default };
@@ -0,0 +1,53 @@
1
+ import { doubleBraces } from "../placeholders.mjs";
2
+ import { n as scriptExtensions } from "../shared-D4NJBKEP.mjs";
3
+ import { t as jsxTemplates } from "../jsx-templates-B1J0no3i.mjs";
4
+ import { createLibraryPlugin } from "@x18n/core";
5
+ //#region src/presets/next-translate/index.ts
6
+ function nextTranslate() {
7
+ return {
8
+ name: "next-translate",
9
+ plugins: [createLibraryPlugin({
10
+ name: "x18n:next-translate",
11
+ namespace: {
12
+ separator: ":",
13
+ default: "common"
14
+ },
15
+ calls: [
16
+ {
17
+ callee: "useTranslation",
18
+ factory: true,
19
+ returns: ["t"],
20
+ namespace: { arg: 0 }
21
+ },
22
+ {
23
+ callee: "getT",
24
+ factory: true,
25
+ returns: ["t"],
26
+ namespace: { arg: 1 }
27
+ },
28
+ {
29
+ callee: "Trans",
30
+ key: {
31
+ arg: 0,
32
+ property: "i18nKey"
33
+ },
34
+ namespace: {
35
+ arg: 0,
36
+ property: "ns"
37
+ }
38
+ },
39
+ { callee: "t" }
40
+ ],
41
+ regex: [{
42
+ extensions: scriptExtensions,
43
+ patterns: ["[^\\w\\d]t`({key})`"]
44
+ }],
45
+ resources: [{ pattern: "locales/{locale}/{namespace}.json" }],
46
+ keyStyle: "nested",
47
+ templates: jsxTemplates,
48
+ placeholders: [doubleBraces]
49
+ })]
50
+ };
51
+ }
52
+ //#endregion
53
+ export { nextTranslate as default, nextTranslate };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/ngx-translate/index.d.ts
3
+ export declare function ngxTranslate(): Preset;
4
+ //#endregion
5
+ export { ngxTranslate as default };
@@ -0,0 +1,41 @@
1
+ import { doubleBraces } from "../placeholders.mjs";
2
+ import { t as angularTemplates } from "../angular-templates-DqIOGfzT.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/ngx-translate/index.ts
5
+ function ngxTranslate() {
6
+ return {
7
+ name: "ngx-translate",
8
+ plugins: [createLibraryPlugin({
9
+ name: "x18n:ngx-translate",
10
+ calls: [{ callee: [
11
+ "translate.instant",
12
+ "translate.get",
13
+ "translate.stream",
14
+ "translateService.instant",
15
+ "translateService.get",
16
+ "translateService.stream",
17
+ "_"
18
+ ] }],
19
+ regex: [{
20
+ extensions: angularTemplates,
21
+ patterns: [
22
+ "[`'\"]({key})[`'\"][\\s\\n]*\\|[\\s\\n]*translate\\b",
23
+ "[\\s\\n]translate>[\\s\\n]*({key})[\\s\\n]*</",
24
+ "\\[translate\\]=[\"']'({key})'[\"']",
25
+ "\\stranslate=[\"']({key})[\"']"
26
+ ]
27
+ }],
28
+ resources: [{ pattern: "src/assets/i18n/{locale}.json" }, { pattern: "src/assets/i18n/{locale}/{namespaces}.json" }],
29
+ templates: [{
30
+ template: "{{ '{key}' | translate }}",
31
+ kinds: ["html-text"]
32
+ }, {
33
+ template: "this.translate.instant('{key}'{args})",
34
+ kinds: ["js-string", "js-template"]
35
+ }],
36
+ placeholders: [doubleBraces]
37
+ })]
38
+ };
39
+ }
40
+ //#endregion
41
+ export { ngxTranslate as default, ngxTranslate };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/nuxt-i18n-micro/index.d.ts
3
+ export declare function nuxtI18nMicro(): Preset;
4
+ //#endregion
5
+ export { nuxtI18nMicro as default };
@@ -0,0 +1,81 @@
1
+ import { braces } from "../placeholders.mjs";
2
+ import { t as readNuxtConfig } from "../shared-Tq06G0gp.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/nuxt-i18n-micro/index.ts
5
+ /** Nuxt's route name of a page component, which names its translation folder: `pages/products/[id].vue` is `products-id`. Route groups like `(admin)` are not part of it. */
6
+ function routeName(path) {
7
+ const segments = /^(?:app\/)?pages\/(.+)\.vue$/.exec(path)?.[1]?.split("/").filter((segment) => !/^\(.+\)$/.test(segment));
8
+ if (!segments?.length) return void 0;
9
+ if (segments.length > 1 && segments.at(-1) === "index") segments.pop();
10
+ return segments.join("-").replace(/[[\].]/g, "");
11
+ }
12
+ function nuxtI18nMicro() {
13
+ const returns = [
14
+ "$t",
15
+ "$ts",
16
+ "$tc",
17
+ "$has"
18
+ ];
19
+ return {
20
+ name: "nuxt-i18n-micro",
21
+ plugins: [createLibraryPlugin({
22
+ name: "x18n:nuxt-i18n-micro",
23
+ calls: [{ callee: returns }, {
24
+ callee: ["useI18n", "useNuxtApp"],
25
+ factory: true,
26
+ returns
27
+ }],
28
+ templates: [
29
+ {
30
+ template: "{{ $t('{key}'{args}) }}",
31
+ kinds: ["vue-template-text"]
32
+ },
33
+ {
34
+ template: ":{attr}=\"$t('{key}'{args})\"",
35
+ kinds: ["vue-attribute"]
36
+ },
37
+ {
38
+ template: "$t('{key}'{args})",
39
+ kinds: ["js-string", "js-template"],
40
+ files: ["**/*.vue"],
41
+ imports: ["import { useI18n } from '#imports'", "const { $t } = useI18n()"]
42
+ }
43
+ ],
44
+ extra: async (draft, ctx) => {
45
+ const nuxtConfig = await readNuxtConfig(ctx.host);
46
+ const dir = nuxtConfig && /translationDir:\s*['"]([^'"]+)['"]/.exec(nuxtConfig)?.[1]?.replace(/^\.\/|\/$/g, "") || "locales";
47
+ draft.resources = [
48
+ ...draft.resources,
49
+ { pattern: `${dir}/{locale}.json` },
50
+ { pattern: `${dir}/{namespaces}/{locale}.json` }
51
+ ];
52
+ },
53
+ placeholders: [{
54
+ ...braces,
55
+ implicit: ["count"]
56
+ }]
57
+ }), {
58
+ name: "x18n:nuxt-i18n-micro-pages",
59
+ scanners: [{
60
+ id: "nuxt-i18n-micro-pages",
61
+ extensions: ["vue"],
62
+ scan(file) {
63
+ const route = routeName(file.path);
64
+ return {
65
+ usages: [],
66
+ scopes: route ? [{
67
+ range: {
68
+ start: 0,
69
+ end: file.text.length
70
+ },
71
+ keyPrefix: `pages.${route}`,
72
+ optionalPrefix: true
73
+ }] : []
74
+ };
75
+ }
76
+ }]
77
+ }]
78
+ };
79
+ }
80
+ //#endregion
81
+ export { nuxtI18nMicro as default, nuxtI18nMicro };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/nuxt-i18n/index.d.ts
3
+ export declare function nuxtI18n(): Preset;
4
+ //#endregion
5
+ export { nuxtI18n as default };
@@ -0,0 +1,23 @@
1
+ import vueI18n from "./vue-i18n.mjs";
2
+ import { t as readNuxtConfig } from "../shared-Tq06G0gp.mjs";
3
+ //#region src/presets/nuxt-i18n/index.ts
4
+ function nuxtI18n() {
5
+ return {
6
+ name: "nuxt-i18n",
7
+ plugins: [...vueI18n().plugins, {
8
+ name: "x18n:nuxt-i18n",
9
+ async config(draft, ctx) {
10
+ const nuxtConfig = await readNuxtConfig(ctx.host);
11
+ const langDir = nuxtConfig ? /langDir:\s*['"]([^'"]+)['"]/.exec(nuxtConfig)?.[1]?.replace(/^\.\/|\/$/g, "") : void 0;
12
+ const dirs = langDir ? [`i18n/${langDir}`, langDir] : [
13
+ "i18n/locales",
14
+ "locales",
15
+ "lang"
16
+ ];
17
+ draft.resources = [...draft.resources, ...dirs.map((dir) => ({ pattern: `${dir}/{locale}.{ext}` }))];
18
+ }
19
+ }]
20
+ };
21
+ }
22
+ //#endregion
23
+ export { nuxtI18n as default, nuxtI18n };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/paraglide/index.d.ts
3
+ export declare function paraglide(): Preset;
4
+ //#endregion
5
+ export { paraglide as default };