lingo.dev 0.93.6 → 0.93.8

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.
package/README.md CHANGED
@@ -1,22 +1,20 @@
1
- > [!NOTE]
2
- > **Introducing Lingo.dev Compiler** - Make any React app multilingual at build time without changing your components. [Read the docs](https://lingo.dev/compiler).
3
-
4
1
  <p align="center">
5
- <a href="https://lingo.dev/compiler">
2
+ <a href="https://lingo.dev">
6
3
  <img src="https://raw.githubusercontent.com/lingodotdev/lingo.dev/main/content/banner.compiler.png" width="100%" alt="Lingo.dev" />
7
4
  </a>
8
5
  </p>
9
6
 
10
7
  <p align="center">
11
- <strong>⚡️ AI-powered open-source tools for web & mobile localization.</strong>
8
+ <strong>⚡ Lingo.dev - open-source, AI-powered i18n toolkit for instant localization with LLMs.</strong>
12
9
  </p>
13
10
 
14
11
  <br />
15
12
 
16
13
  <p align="center">
14
+ <a href="https://lingo.dev/compiler">Lingo.dev Compiler</a> •
17
15
  <a href="https://lingo.dev/cli">Lingo.dev CLI</a> •
18
16
  <a href="https://lingo.dev/ci">Lingo.dev CI/CD</a> •
19
- <a href="https://lingo.dev/compiler">Lingo.dev Compiler 🆕</a>
17
+ <a href="https://lingo.dev/sdk">Lingo.dev SDK</a>
20
18
  </p>
21
19
 
22
20
  <p align="center">
@@ -31,61 +29,136 @@
31
29
  </a>
32
30
  </p>
33
31
 
34
- <br />
32
+ ---
35
33
 
36
- Lingo.dev is an open-source, i18n toolkit designed to help use LLMs for localization and translation of web, mobile apps and markdown content.
34
+ ## Meet the Compiler 🆕
37
35
 
38
- Lingo.dev includes:
36
+ **Lingo.dev Compiler** is a free, open-source compiler middleware, designed to make any React app multilingual at build time without requiring any changes to the existing React components.
39
37
 
40
- 1. **Lingo.dev CLI** - a CLI tool built to help translate apps and markdown content with lightning speed and accuracy. [Docs](https://lingo.dev/cli)
41
- 1. **Lingo.dev CI/CD** - a CI/CD integration for GitHub, GitLab, and Bitbucket built to keep translations up-to-date automatically as soon as new content is added. [Docs](https://lingo.dev/ci)
42
- 1. **Lingo.dev Compiler 🆕** - makes React app multilingual at build time without requiring changes to your existing components. [Docs](https://lingo.dev/compiler)
38
+ Install once:
43
39
 
44
- All tools are designed to help use LLM models for precise translation and localization, and to eliminate manual work.
40
+ ```bash
41
+ npm install lingo.dev
42
+ ```
45
43
 
46
- ## Lingo.dev Compiler Demo
44
+ Enable in your build config:
47
45
 
48
- See Lingo.dev Compiler in action:
46
+ ```js
47
+ import lingoCompiler from "lingo.dev/compiler";
49
48
 
50
- [![Lingo.dev Compiler Demo](https://img.youtube.com/vi/sSo2ERxAvB4/0.jpg)](https://youtu.be/sSo2ERxAvB4)
49
+ const existingNextConfig = {};
51
50
 
52
- The Lingo.dev Compiler makes React apps multilingual at build time without requiring changes to your existing components.
51
+ export default lingoCompiler.next({
52
+ sourceLocale: "en",
53
+ targetLocales: ["es", "fr"],
54
+ })(existingNextConfig);
55
+ ```
53
56
 
54
- Simply run the compiler and your app will support multiple languages automatically, using your existing LLM API key.
57
+ Run `next build` and watch Spanish and French bundles pop out
55
58
 
56
- After watching the demo, check out the [docs](https://lingo.dev/compiler) to learn more.
59
+ [Read the docs →](https://lingo.dev/compiler) for the full guide, and [Join our Discord](https://lingo.dev/go/discord) to get help with your setup.
57
60
 
58
- ## 🤝 Community
61
+ ---
59
62
 
60
- Lingo.dev is community-driven, so we welcome all contributions!
63
+ ### What's inside this repo?
61
64
 
62
- Have an idea for a new feature? Create a GitHub issue!
65
+ | Tool | TL;DR | Docs |
66
+ | ------------ | ------------------------------------------------------------------------------ | --------------------------------------- |
67
+ | **Compiler** | Build-time React localization | [/compiler](https://lingo.dev/compiler) |
68
+ | **CLI** | One-command localization for web and mobile apps, JSON, YAML, markdown, + more | [/cli](https://lingo.dev/cli) |
69
+ | **CI/CD** | Auto-commit translations on every push + create pull requests if needed | [/ci](https://lingo.dev/ci) |
70
+ | **SDK** | Realtime translation for user-generated content | [/sdk](https://lingo.dev/sdk) |
63
71
 
64
- Want to contribute? Create a pull request!
72
+ Below are the quick hits for each 👇
65
73
 
66
- Want to discuss your idea or get help? [Join us on Discord!](https://lingo.dev/go/discord)
74
+ ---
67
75
 
68
- ## Star History
76
+ ### ⚡️ Lingo.dev CLI
69
77
 
70
- If you like the work we're doing, consider giving us a ⭐️ to help us reach 3,000 stars! 🌟
78
+ Translate code & content straight from your terminal.
71
79
 
72
- [![Star History Chart](https://api.star-history.com/svg?repos=lingodotdev/lingo.dev&type=Date)](https://www.star-history.com/#lingodotdev/lingo.dev&Date)
80
+ ```bash
81
+ npx lingo.dev@latest run
82
+ ```
83
+
84
+ It fingerprints every string, caches results, and only re-translates what changed.
85
+
86
+ [Follow the docs →](https://lingo.dev/cli) to learn how to set it up.
87
+
88
+ ---
89
+
90
+ ### 🔄 Lingo.dev CI/CD
91
+
92
+ Ship perfect translations automatically.
93
+
94
+ ```yaml
95
+ # .github/workflows/i18n.yml
96
+ name: Lingo.dev i18n
97
+ on: [push]
98
+
99
+ jobs:
100
+ i18n:
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - uses: lingodotdev/lingo.dev@main
105
+ with:
106
+ api-key: ${{ secrets.LINGODOTDEV_API_KEY }}
107
+ ```
108
+
109
+ Keeps your repo green and your product multilingual without the manual steps.
110
+
111
+ [Read the docs →](https://lingo.dev/ci)
112
+
113
+ ---
114
+
115
+ ### 🧩 Lingo.dev SDK
116
+
117
+ Instant per-request translation for dynamic content.
73
118
 
119
+ ```ts
120
+ import { LingoDotDevEngine } from "lingo.dev/sdk";
121
+
122
+ const lingoDotDev = new LingoDotDevEngine({
123
+ apiKey: "your-api-key-here",
124
+ });
125
+
126
+ const content = {
127
+ greeting: "Hello",
128
+ farewell: "Goodbye",
129
+ message: "Welcome to our platform",
130
+ };
131
+
132
+ const translated = await lingoDotDev.localizeObject(content, {
133
+ sourceLocale: "en",
134
+ targetLocale: "es",
135
+ });
136
+ // Returns: { greeting: "Hola", farewell: "Adiós", message: "Bienvenido a nuestra plataforma" }
137
+
138
+ ```
139
+
140
+ Perfect for chat, user comments, and other real-time flows.
141
+
142
+ [Read the docs →](https://lingo.dev/sdk)
143
+
144
+ ---
145
+
146
+ ## 🤝 Community
147
+
148
+ We're community-driven and love contributions!
149
+
150
+ - Got an idea? [Open an issue](https://github.com/lingodotdev/lingo.dev/issues)
151
+ - Want to fix something? [Send a PR](https://github.com/lingodotdev/lingo.dev/pulls)
152
+ - Need help? [Join our Discord](https://lingo.dev/go/discord)
153
+
154
+ ## ⭐ Star History
155
+
156
+ If you like what we're doing, give us a ⭐ and help us reach 3,000 stars! 🌟
157
+
158
+ [![Star History Chart](https://api.star-history.com/svg?repos=lingodotdev/lingo.dev&type=Date)](https://www.star-history.com/#lingodotdev/lingo.dev&Date)
74
159
 
75
160
  ## 🌐 Readme in other languages
76
161
 
77
- - [English](https://github.com/lingodotdev/lingo.dev)
78
- - [Chinese](/readme/zh-Hans.md)
79
- - [Japanese](/readme/ja.md)
80
- - [Korean](/readme/ko.md)
81
- - [Spanish](/readme/es.md)
82
- - [French](/readme/fr.md)
83
- - [Russian](/readme/ru.md)
84
- - [German](/readme/de.md)
85
- - [Italian](/readme/it.md)
86
- - [Arabic](/readme/ar.md)
87
- - [Hindi](/readme/hi.md)
88
- - [Bengali](/readme/bn.md)
89
- - [Farsi](/readme/fa.md)
90
-
91
- Don't see your language? Just add a new language code to the [`i18n.json`](./i18n.json) file and open a PR!
162
+ [English](https://github.com/lingodotdev/lingo.dev) • [中文](/readme/zh-Hans.md) • [日本語](/readme/ja.md) • [한국어](/readme/ko.md) • [Español](/readme/es.md) • [Français](/readme/fr.md) • [Русский](/readme/ru.md) • [Deutsch](/readme/de.md) • [Italiano](/readme/it.md) • [العربية](/readme/ar.md) • [हिन्दी](/readme/hi.md) • [বাংলা](/readme/bn.md) • [فارسی](/readme/fa.md)
163
+
164
+ Don't see your language? Add it to [`i18n.json`](./i18n.json) and open a PR!
package/build/cli.cjs CHANGED
@@ -6828,12 +6828,14 @@ var getPlatformKit = () => {
6828
6828
  };
6829
6829
 
6830
6830
  // src/cli/cmd/ci/index.ts
6831
- var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--parallel", "Run in parallel mode", (val) => {
6832
- if (typeof val === "boolean") return val;
6833
- return _optionalChain([val, 'optionalAccess', _210 => _210.toLowerCase, 'call', _211 => _211()]) === "true";
6834
- }).option("--api-key <key>", "API key").option("--pull-request [boolean]", "Create a pull request with the changes").option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option(
6831
+ var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--parallel [boolean]", "Run in parallel mode", parseBooleanArg).option("--api-key <key>", "API key").option(
6832
+ "--pull-request [boolean]",
6833
+ "Create a pull request with the changes",
6834
+ parseBooleanArg
6835
+ ).option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option(
6835
6836
  "--process-own-commits [boolean]",
6836
- "Process commits made by this action"
6837
+ "Process commits made by this action",
6838
+ parseBooleanArg
6837
6839
  ).action(async (options) => {
6838
6840
  const settings = getSettings(options.apiKey);
6839
6841
  console.log(options);
@@ -6852,7 +6854,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6852
6854
  }
6853
6855
  const env = {
6854
6856
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
6855
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _212 => _212.pullRequest, 'optionalAccess', _213 => _213.toString, 'call', _214 => _214()]) || "false",
6857
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _210 => _210.pullRequest, 'optionalAccess', _211 => _211.toString, 'call', _212 => _212()]) || "false",
6856
6858
  ...options.commitMessage && {
6857
6859
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
6858
6860
  },
@@ -6872,7 +6874,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6872
6874
  const { isPullRequestMode } = platformKit.config;
6873
6875
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
6874
6876
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
6875
- const canRun = await _optionalChain([flow, 'access', _215 => _215.preRun, 'optionalCall', _216 => _216()]);
6877
+ const canRun = await _optionalChain([flow, 'access', _213 => _213.preRun, 'optionalCall', _214 => _214()]);
6876
6878
  if (canRun === false) {
6877
6879
  return;
6878
6880
  }
@@ -6882,8 +6884,15 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6882
6884
  if (!hasChanges) {
6883
6885
  return;
6884
6886
  }
6885
- await _optionalChain([flow, 'access', _217 => _217.postRun, 'optionalCall', _218 => _218()]);
6887
+ await _optionalChain([flow, 'access', _215 => _215.postRun, 'optionalCall', _216 => _216()]);
6886
6888
  });
6889
+ function parseBooleanArg(val) {
6890
+ if (val === true) return true;
6891
+ if (typeof val === "string") {
6892
+ return val.toLowerCase() === "true";
6893
+ }
6894
+ return false;
6895
+ }
6887
6896
 
6888
6897
  // src/cli/cmd/status.ts
6889
6898
 
@@ -6926,13 +6935,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
6926
6935
  flags
6927
6936
  });
6928
6937
  let buckets = getBuckets(i18nConfig);
6929
- if (_optionalChain([flags, 'access', _219 => _219.bucket, 'optionalAccess', _220 => _220.length])) {
6938
+ if (_optionalChain([flags, 'access', _217 => _217.bucket, 'optionalAccess', _218 => _218.length])) {
6930
6939
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
6931
6940
  }
6932
6941
  ora.succeed("Buckets retrieved");
6933
- if (_optionalChain([flags, 'access', _221 => _221.file, 'optionalAccess', _222 => _222.length])) {
6942
+ if (_optionalChain([flags, 'access', _219 => _219.file, 'optionalAccess', _220 => _220.length])) {
6934
6943
  buckets = buckets.map((bucket) => {
6935
- const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _223 => _223.pathPattern, 'optionalAccess', _224 => _224.match, 'call', _225 => _225(file)])));
6944
+ const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _221 => _221.pathPattern, 'optionalAccess', _222 => _222.match, 'call', _223 => _223(file)])));
6936
6945
  return { ...bucket, paths };
6937
6946
  }).filter((bucket) => bucket.paths.length > 0);
6938
6947
  if (buckets.length === 0) {
@@ -6948,7 +6957,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
6948
6957
  });
6949
6958
  }
6950
6959
  }
6951
- const targetLocales = _optionalChain([flags, 'access', _226 => _226.locale, 'optionalAccess', _227 => _227.length]) ? flags.locale : i18nConfig.locale.targets;
6960
+ const targetLocales = _optionalChain([flags, 'access', _224 => _224.locale, 'optionalAccess', _225 => _225.length]) ? flags.locale : i18nConfig.locale.targets;
6952
6961
  let totalSourceKeyCount = 0;
6953
6962
  let uniqueKeysToTranslate = 0;
6954
6963
  let totalExistingTranslations = 0;
@@ -7289,12 +7298,12 @@ function validateParams2(i18nConfig, flags) {
7289
7298
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
7290
7299
  docUrl: "bucketNotFound"
7291
7300
  });
7292
- } else if (_optionalChain([flags, 'access', _228 => _228.locale, 'optionalAccess', _229 => _229.some, 'call', _230 => _230((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7301
+ } else if (_optionalChain([flags, 'access', _226 => _226.locale, 'optionalAccess', _227 => _227.some, 'call', _228 => _228((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7293
7302
  throw new CLIError({
7294
7303
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
7295
7304
  docUrl: "localeTargetNotFound"
7296
7305
  });
7297
- } else if (_optionalChain([flags, 'access', _231 => _231.bucket, 'optionalAccess', _232 => _232.some, 'call', _233 => _233((bucket) => !i18nConfig.buckets[bucket])])) {
7306
+ } else if (_optionalChain([flags, 'access', _229 => _229.bucket, 'optionalAccess', _230 => _230.some, 'call', _231 => _231((bucket) => !i18nConfig.buckets[bucket])])) {
7298
7307
  throw new CLIError({
7299
7308
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
7300
7309
  docUrl: "bucketNotFound"
@@ -7377,7 +7386,7 @@ async function renderHero2() {
7377
7386
  // package.json
7378
7387
  var package_default = {
7379
7388
  name: "lingo.dev",
7380
- version: "0.93.6",
7389
+ version: "0.93.8",
7381
7390
  description: "Lingo.dev CLI",
7382
7391
  private: false,
7383
7392
  publishConfig: {