i18next-cli 1.61.1 → 1.63.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 (53) hide show
  1. package/README.md +147 -0
  2. package/dist/cjs/cli.js +37 -5
  3. package/dist/cjs/config.js +5 -1
  4. package/dist/cjs/index.js +6 -0
  5. package/dist/cjs/init.js +25 -75
  6. package/dist/cjs/instrumenter/core/instrumenter.js +33 -11
  7. package/dist/cjs/instrumenter/core/transformer.js +5 -1
  8. package/dist/cjs/localize/agent-prompt.js +49 -0
  9. package/dist/cjs/localize/detect.js +88 -0
  10. package/dist/cjs/localize/localize.js +475 -0
  11. package/dist/cjs/locize.js +84 -11
  12. package/dist/cjs/status.js +5 -1
  13. package/dist/cjs/types-generator.js +8 -3
  14. package/dist/cjs/utils/file-utils.js +6 -2
  15. package/dist/cjs/utils/inlang-scaffold.js +184 -0
  16. package/dist/cjs/utils/locize-onboarding.js +91 -0
  17. package/dist/cjs/utils/wrap-ora.js +9 -5
  18. package/dist/esm/cli.js +30 -2
  19. package/dist/esm/index.js +4 -0
  20. package/dist/esm/init.js +19 -73
  21. package/dist/esm/instrumenter/core/instrumenter.js +22 -8
  22. package/dist/esm/localize/agent-prompt.js +47 -0
  23. package/dist/esm/localize/detect.js +85 -0
  24. package/dist/esm/localize/localize.js +469 -0
  25. package/dist/esm/locize.js +75 -9
  26. package/dist/esm/utils/inlang-scaffold.js +182 -0
  27. package/dist/esm/utils/locize-onboarding.js +83 -0
  28. package/package.json +10 -10
  29. package/types/cli.d.ts.map +1 -1
  30. package/types/index.d.ts +2 -0
  31. package/types/index.d.ts.map +1 -1
  32. package/types/init.d.ts +1 -0
  33. package/types/init.d.ts.map +1 -1
  34. package/types/instrumenter/core/instrumenter.d.ts +28 -0
  35. package/types/instrumenter/core/instrumenter.d.ts.map +1 -1
  36. package/types/instrumenter/index.d.ts +2 -1
  37. package/types/instrumenter/index.d.ts.map +1 -1
  38. package/types/localize/agent-prompt.d.ts +11 -0
  39. package/types/localize/agent-prompt.d.ts.map +1 -0
  40. package/types/localize/detect.d.ts +37 -0
  41. package/types/localize/detect.d.ts.map +1 -0
  42. package/types/localize/index.d.ts +6 -0
  43. package/types/localize/index.d.ts.map +1 -0
  44. package/types/localize/localize.d.ts +20 -0
  45. package/types/localize/localize.d.ts.map +1 -0
  46. package/types/locize.d.ts +20 -0
  47. package/types/locize.d.ts.map +1 -1
  48. package/types/types.d.ts +12 -0
  49. package/types/types.d.ts.map +1 -1
  50. package/types/utils/inlang-scaffold.d.ts +28 -0
  51. package/types/utils/inlang-scaffold.d.ts.map +1 -0
  52. package/types/utils/locize-onboarding.d.ts +19 -0
  53. package/types/utils/locize-onboarding.d.ts.map +1 -0
@@ -0,0 +1,28 @@
1
+ export interface InlangScaffoldOptions {
2
+ /** All project locales (the first one is used as `baseLocale` unless `primaryLanguage` is set). */
3
+ locales: string[];
4
+ /** The base/source locale. Defaults to the first entry of `locales`. */
5
+ primaryLanguage?: string;
6
+ /** The `extract.output` template, e.g. `public/locales/{{language}}/{{namespace}}.json`. */
7
+ output: string | ((language: string, namespace?: string) => string);
8
+ /** Default namespace used as fallback when no resource files exist yet (default: 'translation'). */
9
+ defaultNS?: string | false;
10
+ }
11
+ /**
12
+ * Scaffolds an inlang project (`project.inlang/settings.json`) next to the
13
+ * i18next configuration so that inlang tooling (Sherlock VS Code extension,
14
+ * Fink editor, Paraglide compiler) operates on the EXISTING i18next JSON
15
+ * files. The i18next files remain the single source of truth — the scaffold
16
+ * is just the adapter.
17
+ *
18
+ * Behavior:
19
+ * - Derives `plugin.inlang.i18next.pathPattern` from the `extract.output`
20
+ * template: the namespaced object form when the template contains a
21
+ * `{{namespace}}` placeholder (namespaces are discovered from the files of
22
+ * the primary language), the plain string form otherwise.
23
+ * - Never overwrites an existing `project.inlang/settings.json`.
24
+ * - Adds the Sherlock extension to `.vscode/extensions.json` recommendations
25
+ * (creating or comment-preservingly merging the file).
26
+ */
27
+ export declare function scaffoldInlangProject(options: InlangScaffoldOptions): Promise<void>;
28
+ //# sourceMappingURL=inlang-scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlang-scaffold.d.ts","sourceRoot":"","sources":["../../src/utils/inlang-scaffold.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,mGAAmG;IACnG,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4FAA4F;IAC5F,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;IACnE,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD1F"}
@@ -0,0 +1,19 @@
1
+ /** Rough 8-4-4-4-12 hex UUID shape — not strict (locize project IDs may evolve). */
2
+ export declare const UUID_SHAPE: RegExp;
3
+ /**
4
+ * Opens the given URL in the user's default browser using the platform-native command.
5
+ * Returns true on success, false if there's nowhere to open one (CI, headless Linux)
6
+ * or if spawning the command failed.
7
+ */
8
+ export declare function openBrowser(url: string, opts?: {
9
+ ci?: boolean;
10
+ }): Promise<boolean>;
11
+ /**
12
+ * Prompts for Locize credentials (Project ID + optional API key) and returns them.
13
+ * Warns (but does not block) when the Project ID does not look like a UUID.
14
+ */
15
+ export declare function promptLocizeCredentials(): Promise<{
16
+ projectId: string;
17
+ apiKey?: string;
18
+ }>;
19
+ //# sourceMappingURL=locize-onboarding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locize-onboarding.d.ts","sourceRoot":"","sources":["../../src/utils/locize-onboarding.ts"],"names":[],"mappings":"AAGA,oFAAoF;AACpF,eAAO,MAAM,UAAU,QAAoE,CAAA;AAE3F;;;;GAIG;AACH,wBAAsB,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,EAAE,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAoC7F;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAK,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BhG"}