@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,53 @@
1
+ import { braces } from "../placeholders.mjs";
2
+ import { createLibraryPlugin } from "@x18n/core";
3
+ //#region src/presets/vscode-extension/nls.ts
4
+ const nlsFile = /^(?:(.*)\/)?package\.nls(?:\.([\w-]+))?\.json$/;
5
+ const bundleFile = /^(?:(.*)\/)?bundle\.l10n(?:\.([\w-]+))?\.json$/;
6
+ /** VS Code extension strings: `package.nls[.locale].json` and `l10n/bundle.l10n[.locale].json`. */
7
+ const nlsFinder = {
8
+ id: "nls",
9
+ async find(ctx) {
10
+ const paths = await ctx.host.glob(["**/package.nls*.json", "**/bundle.l10n*.json"], {
11
+ ignore: ["**/node_modules/**"],
12
+ gitignore: true
13
+ });
14
+ const out = [];
15
+ for (const path of paths) {
16
+ const nls = nlsFile.exec(path);
17
+ const bundle = nls ? void 0 : bundleFile.exec(path);
18
+ const match = nls ?? bundle;
19
+ if (!match) continue;
20
+ out.push({
21
+ path,
22
+ locale: match[2] ?? ctx.config.sourceLocale,
23
+ namespace: void 0,
24
+ format: "json"
25
+ });
26
+ }
27
+ return out;
28
+ }
29
+ };
30
+ //#endregion
31
+ //#region src/presets/vscode-extension/index.ts
32
+ function vscodeExtension() {
33
+ return {
34
+ name: "vscode-extension",
35
+ plugins: [createLibraryPlugin({
36
+ name: "x18n:vscode-extension",
37
+ calls: [{ callee: ["l10n.t", "vscode.l10n.t"] }],
38
+ finders: [nlsFinder],
39
+ extra: (draft) => {
40
+ draft.usage = {
41
+ ...draft.usage,
42
+ regex: [...draft.usage.regex, {
43
+ extensions: ["json"],
44
+ patterns: ["\"%({key})%\""]
45
+ }]
46
+ };
47
+ },
48
+ placeholders: [braces]
49
+ })]
50
+ };
51
+ }
52
+ //#endregion
53
+ export { vscodeExtension as default, vscodeExtension };
@@ -0,0 +1,5 @@
1
+ import { Preset } from "@x18n/core";
2
+ //#region src/presets/vue-i18n/index.d.ts
3
+ export declare function vueI18n(): Preset;
4
+ //#endregion
5
+ export { vueI18n as default };
@@ -0,0 +1,59 @@
1
+ import { t as sfcBlocks } from "../sfc-blocks-DaGKDZsb.mjs";
2
+ import { braces, linked } from "../placeholders.mjs";
3
+ import { createLibraryPlugin } from "@x18n/core";
4
+ //#region src/presets/vue-i18n/index.ts
5
+ const vueI18nCalls = [{ callee: [
6
+ "$t",
7
+ "t",
8
+ "tc",
9
+ "$tc",
10
+ "te",
11
+ "$te",
12
+ "tm",
13
+ "$tm",
14
+ "i18n.t",
15
+ "i18n.global.t",
16
+ "$i18n.t",
17
+ "i18n.tc",
18
+ "i18n.te"
19
+ ] }, {
20
+ callee: "useI18n",
21
+ factory: true,
22
+ returns: [
23
+ "t",
24
+ "tc",
25
+ "te",
26
+ "tm"
27
+ ]
28
+ }];
29
+ function vueI18n() {
30
+ return {
31
+ name: "vue-i18n",
32
+ plugins: [createLibraryPlugin({
33
+ name: "x18n:vue-i18n",
34
+ calls: vueI18nCalls,
35
+ templates: [
36
+ {
37
+ template: "{{ $t('{key}'{args}) }}",
38
+ kinds: ["vue-template-text"]
39
+ },
40
+ {
41
+ template: ":{attr}=\"$t('{key}'{args})\"",
42
+ kinds: ["vue-attribute"]
43
+ },
44
+ {
45
+ template: "t('{key}'{args})",
46
+ kinds: ["js-string", "js-template"],
47
+ files: ["**/*.vue"],
48
+ imports: ["import { useI18n } from 'vue-i18n'", "const { t } = useI18n()"]
49
+ }
50
+ ],
51
+ placeholders: [{
52
+ ...braces,
53
+ implicit: ["n", "count"]
54
+ }, linked]
55
+ }), sfcBlocks()]
56
+ };
57
+ }
58
+ //#endregion
59
+ export { vueI18n as default, vueI18n };
@@ -1,60 +1,13 @@
1
- import { Preset, PresetFactory } from "@x18n/core";
2
- //#region src/presets/angular.d.ts
3
- export declare function ngxTranslate(): Preset;
4
- export declare function transloco(): Preset;
5
- //#endregion
6
- //#region src/presets/js.d.ts
7
- export declare function vueI18n(): Preset;
8
- export declare function nuxtI18n(): Preset;
9
- export declare function i18next(): Preset;
10
- export declare function reactI18next(): Preset;
11
- export declare function nextIntl(): Preset;
12
- export declare function reactIntl(): Preset;
13
- export declare function svelteI18n(): Preset;
14
- export declare function vscodeExtension(): Preset;
15
- /** Always last: hard-string extraction templates for plain JS, TS and HTML. */
16
- export declare function general(): Preset;
17
- //#endregion
18
- //#region src/presets/mobile.d.ts
19
- /** Flutter with `flutter_i18n`: JSON or YAML assets, `FlutterI18n.translate(context, 'key')`. */
20
- export declare function flutter(): Preset;
21
- //#endregion
22
- //#region src/presets/server.d.ts
23
- /** Laravel: `lang/{locale}/{file}.php` arrays and `lang/{locale}.json`; keys are `file.key`. Exclusive like i18n-ally. */
24
- export declare function laravel(): Preset;
25
- /** Joomla: INI language files, `Text::_('KEY')`. */
26
- export declare function phpJoomla(): Preset;
27
- /** PHP gettext with `.po` files. Exclusive and never detected, as in i18n-ally: list it in `presets`. */
28
- export declare function phpGettext(): Preset;
29
- /** `t('.title')` in `app/views/users/index.html.erb` means `users.index.title`. */
30
- export declare function railsLazyKey(raw: string, path: string): string | undefined;
31
- export declare function rubyRails(): Preset;
32
- export declare function jekyll(): Preset;
33
- //#endregion
34
- //#region src/presets/web.d.ts
35
- export declare function nextInternational(): Preset;
36
- export declare function nextTranslate(): Preset;
37
- /** Shopify's i18next format: plural and ordinal forms as nested keys (`{key}.one`). */
38
- export declare function i18nextShopify(): Preset;
39
- export declare function i18nTag(): Preset;
40
- export declare function fluentVue(): Preset;
41
- export declare function polyglot(): Preset;
42
- export declare function globalize(): Preset;
43
- export declare function ui5(): Preset;
44
- export declare function lingui(): Preset;
45
- export declare function emberIntl(): Preset;
46
- export declare function i18nJs(): Preset;
47
- /** Chrome and WebExtension `_locales/{locale}/messages.json`: `{ "name": { "message": "..." } }` reads as `name`. */
48
- export declare function chromeExtension(): Preset;
49
- export declare function solidPrimitivesI18n(): Preset;
50
- export declare function paraglide(): Preset;
51
- //#endregion
1
+ import { PresetEntry } from "@x18n/core";
52
2
  //#region src/presets/index.d.ts
53
3
  /**
54
- * Presets by name, in detection order: every i18n-ally framework has one.
55
- * Presets that share plugins (react-i18next and i18next) apply them once.
4
+ * Built-in presets by name, in detection order: every i18n-ally framework has one.
5
+ * A preset is a folder. `<name>/entry.ts` holds its detection and a `load` for `<name>/index.ts`,
6
+ * the preset itself; it is cheap and always loaded, while the preset is imported only when detection passes
7
+ * or the config lists it.
8
+ * Presets that share plugins (react-i18next, svelte-i18next and i18next) apply them once.
56
9
  */
57
10
  export declare const presets: {
58
- readonly [name: string]: PresetFactory;
11
+ readonly [name: string]: PresetEntry;
59
12
  };
60
13
  //#endregion
package/dist/presets.mjs CHANGED
@@ -1 +1,346 @@
1
- export { n as chromeExtension, r as emberIntl, i as fluentVue, S as flutter, C as general, a as globalize, o as i18nJs, s as i18nTag, w as i18next, c as i18nextShopify, g as jekyll, _ as laravel, l as lingui, u as nextInternational, T as nextIntl, d as nextTranslate, M as ngxTranslate, E as nuxtI18n, f as paraglide, v as phpGettext, y as phpJoomla, p as polyglot, t as presets, b as railsLazyKey, D as reactI18next, O as reactIntl, x as rubyRails, m as solidPrimitivesI18n, k as svelteI18n, N as transloco, h as ui5, A as vscodeExtension, j as vueI18n } from "./presets-Co5SlnKr.mjs";
1
+ import { t as dependsOn } from "./shared-D4NJBKEP.mjs";
2
+ //#region src/presets/cargo-i18n/entry.ts
3
+ const entry$42 = {
4
+ detect: dependsOn(["i18n-embed-fl", "i18n-embed"]),
5
+ load: () => import("./presets/cargo-i18n.mjs")
6
+ };
7
+ //#endregion
8
+ //#region src/presets/chrome-extension/entry.ts
9
+ /** A Chrome or WebExtension manifest that declares `default_locale`. */
10
+ async function hasDefaultLocale(ctx) {
11
+ for (const path of [
12
+ "manifest.json",
13
+ "src/manifest.json",
14
+ "public/manifest.json"
15
+ ]) if ((await ctx.host.readFile(path))?.includes("\"default_locale\"")) return true;
16
+ return false;
17
+ }
18
+ const entry$41 = {
19
+ detect: hasDefaultLocale,
20
+ load: () => import("./presets/chrome-extension.mjs")
21
+ };
22
+ //#endregion
23
+ //#region src/presets/dotnet-resx/entry.ts
24
+ const entry$40 = {
25
+ detect: async (ctx) => await ctx.fileExists("**/*.{csproj,vbproj,fsproj}") && await ctx.fileExists("**/*.resx"),
26
+ load: () => import("./presets/dotnet-resx.mjs")
27
+ };
28
+ //#endregion
29
+ //#region src/presets/easy-localization/entry.ts
30
+ const entry$39 = {
31
+ detect: dependsOn(["easy_localization"]),
32
+ load: () => import("./presets/easy-localization.mjs")
33
+ };
34
+ //#endregion
35
+ //#region src/presets/ember-intl/entry.ts
36
+ const entry$38 = {
37
+ detect: dependsOn(["ember-intl"]),
38
+ load: () => import("./presets/ember-intl.mjs")
39
+ };
40
+ //#endregion
41
+ //#region src/presets/fluent-react/entry.ts
42
+ const entry$37 = {
43
+ detect: dependsOn(["@fluent/react"]),
44
+ load: () => import("./presets/fluent-react.mjs")
45
+ };
46
+ //#endregion
47
+ //#region src/presets/fluent-vue/entry.ts
48
+ const entry$36 = {
49
+ detect: dependsOn([
50
+ "fluent-vue",
51
+ "fluent-vue-loader",
52
+ "rollup-plugin-fluent-vue",
53
+ "unplugin-fluent-vue"
54
+ ]),
55
+ load: () => import("./presets/fluent-vue.mjs")
56
+ };
57
+ //#endregion
58
+ //#region src/presets/flutter-translate/entry.ts
59
+ const entry$35 = {
60
+ detect: dependsOn(["flutter_translate"]),
61
+ load: () => import("./presets/flutter-translate.mjs")
62
+ };
63
+ //#endregion
64
+ //#region src/presets/flutter/entry.ts
65
+ const entry$34 = {
66
+ detect: dependsOn(["flutter_i18n"]),
67
+ load: () => import("./presets/flutter.mjs")
68
+ };
69
+ //#endregion
70
+ //#region src/presets/general/entry.ts
71
+ const entry$33 = {
72
+ detect: () => true,
73
+ load: () => import("./presets/general.mjs")
74
+ };
75
+ //#endregion
76
+ //#region src/presets/globalize/entry.ts
77
+ const entry$32 = {
78
+ detect: dependsOn(["globalize"]),
79
+ load: () => import("./presets/globalize.mjs")
80
+ };
81
+ //#endregion
82
+ //#region src/presets/gravity-ui-i18n/entry.ts
83
+ const entry$31 = {
84
+ detect: dependsOn(["@gravity-ui/i18n"]),
85
+ load: () => import("./presets/gravity-ui-i18n.mjs")
86
+ };
87
+ //#endregion
88
+ //#region src/presets/i18n-js/entry.ts
89
+ const entry$30 = {
90
+ detect: dependsOn(["i18n-js"]),
91
+ load: () => import("./presets/i18n-js.mjs")
92
+ };
93
+ //#endregion
94
+ //#region src/presets/i18n-tag/entry.ts
95
+ const entry$29 = {
96
+ detect: dependsOn(["es2015-i18n-tag"]),
97
+ load: () => import("./presets/i18n-tag.mjs")
98
+ };
99
+ //#endregion
100
+ //#region src/presets/i18next-shopify/entry.ts
101
+ const entry$28 = {
102
+ detect: dependsOn(["@shopify/i18next-shopify"]),
103
+ load: () => import("./presets/i18next-shopify.mjs")
104
+ };
105
+ //#endregion
106
+ //#region src/presets/i18next/entry.ts
107
+ const entry$27 = {
108
+ detect: dependsOn(["i18next"]),
109
+ load: () => import("./presets/i18next.mjs")
110
+ };
111
+ //#endregion
112
+ //#region src/presets/i18nice/entry.ts
113
+ const entry$26 = {
114
+ detect: dependsOn(["i18nice", "python-i18n"]),
115
+ load: () => import("./presets/i18nice.mjs")
116
+ };
117
+ //#endregion
118
+ //#region src/presets/jekyll/entry.ts
119
+ const entry$25 = {
120
+ detect: dependsOn(["jekyll-multiple-languages-plugin"]),
121
+ load: () => import("./presets/jekyll.mjs")
122
+ };
123
+ //#endregion
124
+ //#region src/presets/laravel-vue-i18n/entry.ts
125
+ const entry$24 = {
126
+ detect: dependsOn(["laravel-vue-i18n"]),
127
+ load: () => import("./presets/laravel-vue-i18n.mjs")
128
+ };
129
+ //#endregion
130
+ //#region src/presets/laravel/entry.ts
131
+ const entry$23 = {
132
+ detect: dependsOn(["laravel/framework"]),
133
+ exclusive: true,
134
+ load: () => import("./presets/laravel.mjs")
135
+ };
136
+ //#endregion
137
+ //#region src/presets/lingui/entry.ts
138
+ const entry$22 = {
139
+ detect: dependsOn([
140
+ "@lingui/core",
141
+ "@lingui/react",
142
+ "@lingui/macro"
143
+ ]),
144
+ load: () => import("./presets/lingui.mjs")
145
+ };
146
+ //#endregion
147
+ //#region src/presets/next-international/entry.ts
148
+ const entry$21 = {
149
+ detect: dependsOn(["next-international"]),
150
+ load: () => import("./presets/next-international.mjs")
151
+ };
152
+ //#endregion
153
+ //#region src/presets/next-intl/entry.ts
154
+ const entry$20 = {
155
+ detect: dependsOn(["next-intl", "use-intl"]),
156
+ load: () => import("./presets/next-intl.mjs")
157
+ };
158
+ //#endregion
159
+ //#region src/presets/next-translate/entry.ts
160
+ const entry$19 = {
161
+ detect: dependsOn(["next-translate"]),
162
+ load: () => import("./presets/next-translate.mjs")
163
+ };
164
+ //#endregion
165
+ //#region src/presets/ngx-translate/entry.ts
166
+ const entry$18 = {
167
+ detect: dependsOn(["@ngx-translate/core"]),
168
+ load: () => import("./presets/ngx-translate.mjs")
169
+ };
170
+ //#endregion
171
+ //#region src/presets/nuxt-i18n-micro/entry.ts
172
+ const entry$17 = {
173
+ detect: dependsOn(["nuxt-i18n-micro"]),
174
+ load: () => import("./presets/nuxt-i18n-micro.mjs")
175
+ };
176
+ //#endregion
177
+ //#region src/presets/nuxt-i18n/entry.ts
178
+ const entry$16 = {
179
+ detect: dependsOn(["@nuxtjs/i18n", "nuxt-i18n"]),
180
+ load: () => import("./presets/nuxt-i18n.mjs")
181
+ };
182
+ //#endregion
183
+ //#region src/presets/paraglide/entry.ts
184
+ const entry$15 = {
185
+ detect: dependsOn([
186
+ "@inlang/paraglide-js",
187
+ "@inlang/paraglide-sveltekit",
188
+ "@inlang/paraglide-next",
189
+ "@inlang/paraglide-astro",
190
+ "@inlang/paraglide-vite"
191
+ ]),
192
+ load: () => import("./presets/paraglide.mjs")
193
+ };
194
+ //#endregion
195
+ //#region src/presets/php-gettext/entry.ts
196
+ const entry$14 = {
197
+ exclusive: true,
198
+ load: () => import("./presets/php-gettext.mjs")
199
+ };
200
+ //#endregion
201
+ //#region src/presets/php-joomla/entry.ts
202
+ const entry$13 = {
203
+ detect: dependsOn(["joomla/application", "joomla/cms"]),
204
+ load: () => import("./presets/php-joomla.mjs")
205
+ };
206
+ //#endregion
207
+ //#region src/presets/polyglot/entry.ts
208
+ const entry$12 = {
209
+ detect: dependsOn(["node-polyglot"]),
210
+ load: () => import("./presets/polyglot.mjs")
211
+ };
212
+ //#endregion
213
+ //#region src/presets/python-gettext/entry.ts
214
+ const entry$11 = {
215
+ detect: dependsOn(["django", "flask-babel"]),
216
+ load: () => import("./presets/python-gettext.mjs")
217
+ };
218
+ //#endregion
219
+ //#region src/presets/react-i18next/entry.ts
220
+ const entry$10 = {
221
+ detect: dependsOn(["react-i18next", "next-i18next"]),
222
+ load: () => import("./presets/react-i18next.mjs")
223
+ };
224
+ //#endregion
225
+ //#region src/presets/react-intl/entry.ts
226
+ const entry$9 = {
227
+ detect: dependsOn(["react-intl"], ["@formatjs/"]),
228
+ load: () => import("./presets/react-intl.mjs")
229
+ };
230
+ //#endregion
231
+ //#region src/presets/ruby-rails/entry.ts
232
+ const entry$8 = {
233
+ detect: dependsOn([
234
+ "rails",
235
+ "rails-i18n",
236
+ "railties"
237
+ ]),
238
+ load: () => import("./presets/ruby-rails.mjs")
239
+ };
240
+ //#endregion
241
+ //#region src/presets/solid-primitives-i18n/entry.ts
242
+ const entry$7 = {
243
+ detect: dependsOn(["@solid-primitives/i18n"]),
244
+ load: () => import("./presets/solid-primitives-i18n.mjs")
245
+ };
246
+ //#endregion
247
+ //#region src/presets/svelte-i18n/entry.ts
248
+ const entry$6 = {
249
+ detect: dependsOn([
250
+ "svelte-i18n",
251
+ "sveltekit-i18n",
252
+ "@sveltekit-i18n/base"
253
+ ]),
254
+ load: () => import("./presets/svelte-i18n.mjs")
255
+ };
256
+ //#endregion
257
+ //#region src/presets/svelte-i18next/entry.ts
258
+ const entry$5 = {
259
+ detect: dependsOn(["svelte-i18next"]),
260
+ load: () => import("./presets/svelte-i18next.mjs")
261
+ };
262
+ //#endregion
263
+ //#region src/presets/transloco/entry.ts
264
+ const entry$4 = {
265
+ detect: dependsOn(["@jsverse/transloco", "@ngneat/transloco"]),
266
+ load: () => import("./presets/transloco.mjs")
267
+ };
268
+ //#endregion
269
+ //#region src/presets/typesafe-i18n/entry.ts
270
+ const entry$3 = {
271
+ detect: dependsOn(["typesafe-i18n"]),
272
+ load: () => import("./presets/typesafe-i18n.mjs")
273
+ };
274
+ //#endregion
275
+ //#region src/presets/ui5/entry.ts
276
+ const entry$2 = {
277
+ detect: dependsOn(["@ui5/cli"]),
278
+ load: () => import("./presets/ui5.mjs")
279
+ };
280
+ //#endregion
281
+ //#region src/presets/index.ts
282
+ /**
283
+ * Built-in presets by name, in detection order: every i18n-ally framework has one.
284
+ * A preset is a folder. `<name>/entry.ts` holds its detection and a `load` for `<name>/index.ts`,
285
+ * the preset itself; it is cheap and always loaded, while the preset is imported only when detection passes
286
+ * or the config lists it.
287
+ * Presets that share plugins (react-i18next, svelte-i18next and i18next) apply them once.
288
+ */
289
+ const presets = {
290
+ "nuxt-i18n": entry$16,
291
+ "nuxt-i18n-micro": entry$17,
292
+ "vue-i18n": {
293
+ detect: dependsOn([
294
+ "vue-i18n",
295
+ "vuex-i18n",
296
+ "petite-vue-i18n",
297
+ "vue-i18n-bridge"
298
+ ], ["@intlify/"]),
299
+ load: () => import("./presets/vue-i18n.mjs")
300
+ },
301
+ "fluent-vue": entry$36,
302
+ "fluent-react": entry$37,
303
+ "i18next-shopify": entry$28,
304
+ "react-i18next": entry$10,
305
+ "svelte-i18next": entry$5,
306
+ "next-translate": entry$19,
307
+ "next-international": entry$21,
308
+ "i18next": entry$27,
309
+ "next-intl": entry$20,
310
+ "react-intl": entry$9,
311
+ "svelte-i18n": entry$6,
312
+ "solid-primitives-i18n": entry$7,
313
+ "paraglide": entry$15,
314
+ "gravity-ui-i18n": entry$31,
315
+ "typesafe-i18n": entry$3,
316
+ "ngx-translate": entry$18,
317
+ "transloco": entry$4,
318
+ "lingui": entry$22,
319
+ "ember-intl": entry$38,
320
+ "polyglot": entry$12,
321
+ "globalize": entry$32,
322
+ "i18n-tag": entry$29,
323
+ "i18n-js": entry$30,
324
+ "ui5": entry$2,
325
+ "chrome-extension": entry$41,
326
+ "vscode-extension": {
327
+ detect: (ctx) => ctx.hasAnyDependency(["vscode", "@types/vscode"]),
328
+ load: () => import("./presets/vscode-extension.mjs")
329
+ },
330
+ "laravel-vue-i18n": entry$24,
331
+ "laravel": entry$23,
332
+ "php-joomla": entry$13,
333
+ "php-gettext": entry$14,
334
+ "ruby-rails": entry$8,
335
+ "jekyll": entry$25,
336
+ "flutter": entry$34,
337
+ "easy-localization": entry$39,
338
+ "flutter-translate": entry$35,
339
+ "python-gettext": entry$11,
340
+ "i18nice": entry$26,
341
+ "cargo-i18n": entry$42,
342
+ "dotnet-resx": entry$40,
343
+ "general": entry$33
344
+ };
345
+ //#endregion
346
+ export { presets };
@@ -0,0 +1,6 @@
1
+ import { Reporter } from "@x18n/core";
2
+ //#region src/reporters/github.d.ts
3
+ /** GitHub Actions workflow commands, which become annotations on the PR. */
4
+ export declare const githubReporter: Reporter;
5
+ //#endregion
6
+ export { githubReporter as default };
@@ -0,0 +1,27 @@
1
+ import { toWireDiagnostic } from "@x18n/core";
2
+ //#region src/reporters/github.ts
3
+ function escapeProperty(text) {
4
+ return text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C");
5
+ }
6
+ function escapeData(text) {
7
+ return text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
8
+ }
9
+ /** GitHub Actions workflow commands, which become annotations on the PR. */
10
+ const githubReporter = {
11
+ id: "github",
12
+ report(inputs, ctx) {
13
+ const out = [];
14
+ for (const input of inputs) for (const d of input.diagnostics) {
15
+ const level = d.severity === "error" ? "error" : d.severity === "warning" ? "warning" : "notice";
16
+ const props = [`title=${escapeProperty(`x18n ${d.code}`)}`];
17
+ if (d.location) {
18
+ const wire = toWireDiagnostic(input.project, d, input.text).range;
19
+ props.unshift(`file=${escapeProperty(ctx.displayPath(d.location.path, input.project))}`, `line=${wire.line}`, `col=${wire.column}`, `endLine=${wire.endLine}`, `endColumn=${wire.endColumn}`);
20
+ }
21
+ out.push(`::${level} ${props.join(",")}::${escapeData(d.message)}`);
22
+ }
23
+ return out.length ? `${out.join("\n")}\n` : "";
24
+ }
25
+ };
26
+ //#endregion
27
+ export { githubReporter as default, githubReporter };
@@ -0,0 +1,6 @@
1
+ import { Reporter } from "@x18n/core";
2
+ //#region src/reporters/json.d.ts
3
+ /** The versioned JSON contract of `x18n check --json`. */
4
+ export declare const jsonReporter: Reporter;
5
+ //#endregion
6
+ export { jsonReporter as default };
@@ -0,0 +1,24 @@
1
+ import { envelope, toWireDiagnostic } from "@x18n/core";
2
+ //#region src/reporters/json.ts
3
+ /** The versioned JSON contract of `x18n check --json`. */
4
+ const jsonReporter = {
5
+ id: "json",
6
+ report(inputs) {
7
+ const diagnostics = inputs.flatMap((input) => input.diagnostics.map((d) => toWireDiagnostic(input.project, d, input.text)));
8
+ const data = { projects: inputs.map((input) => ({
9
+ name: input.project,
10
+ summary: input.summary,
11
+ coverage: input.coverage.map((c) => ({
12
+ locale: c.locale,
13
+ total: c.total,
14
+ translated: c.translated,
15
+ missing: c.missing.length,
16
+ empty: c.empty.length,
17
+ outdated: c.outdated.length
18
+ }))
19
+ })) };
20
+ return `${JSON.stringify(envelope("check", data, diagnostics), null, 2)}\n`;
21
+ }
22
+ };
23
+ //#endregion
24
+ export { jsonReporter as default, jsonReporter };
@@ -0,0 +1,6 @@
1
+ import { Reporter } from "@x18n/core";
2
+ //#region src/reporters/markdown.d.ts
3
+ /** Summary and tables for PR comments and agent context. */
4
+ export declare const markdownReporter: Reporter;
5
+ //#endregion
6
+ export { markdownReporter as default };
@@ -0,0 +1,37 @@
1
+ import { i as totals, r as plural } from "../shared-D-tbsYmc.mjs";
2
+ import { createLineIndex } from "@x18n/core";
3
+ //#region src/reporters/markdown.ts
4
+ function escapeCell(text) {
5
+ return text.replace(/\|/g, "\\|").replace(/\n/g, " ");
6
+ }
7
+ /** Summary and tables for PR comments and agent context. */
8
+ const markdownReporter = {
9
+ id: "markdown",
10
+ report(inputs, ctx) {
11
+ const sum = totals(inputs);
12
+ const out = [
13
+ "## x18n check",
14
+ "",
15
+ `**${plural(sum.errors, "error")}**, ${plural(sum.warnings, "warning")} in ${plural(sum.files, "file")}.`,
16
+ ""
17
+ ];
18
+ for (const input of inputs) {
19
+ if (inputs.length > 1) out.push(`### ${input.project}`, "");
20
+ out.push("| Locale | Translated | Missing | Empty |", "| --- | --- | --- | --- |");
21
+ for (const c of input.coverage) out.push(`| ${c.locale} | ${c.translated}/${c.total} | ${c.missing.length} | ${c.empty.length} |`);
22
+ out.push("");
23
+ if (input.diagnostics.length === 0) continue;
24
+ out.push("| Severity | Check | Location | Message |", "| --- | --- | --- | --- |");
25
+ for (const d of input.diagnostics.slice(0, 200)) {
26
+ const line = d.location ? createLineIndex(input.text(d.location.path) ?? "").position(d.location.range.start).line + 1 : void 0;
27
+ const where = d.location ? `\`${ctx.displayPath(d.location.path, input.project)}:${line}\`` : "";
28
+ out.push(`| ${d.severity} | \`${d.code}\` | ${where} | ${escapeCell(d.message)} |`);
29
+ }
30
+ if (input.diagnostics.length > 200) out.push("", `_${input.diagnostics.length - 200} more not shown._`);
31
+ out.push("");
32
+ }
33
+ return `${out.join("\n")}\n`;
34
+ }
35
+ };
36
+ //#endregion
37
+ export { markdownReporter as default, markdownReporter };
@@ -0,0 +1,6 @@
1
+ import { Reporter } from "@x18n/core";
2
+ //#region src/reporters/pretty.d.ts
3
+ /** `path:line:col`, then the severity, message and check, a code frame, and a summary. */
4
+ export declare const prettyReporter: Reporter;
5
+ //#endregion
6
+ export { prettyReporter as default };