lingo.dev 0.92.18 → 0.93.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.
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
+ > [!Note] > **Introducing: Lingo.dev Compiler** - Make any React app multilingual at build time without changing your components. [Read the docs](https://lingo.dev/compiler).
2
+
1
3
  <p align="center">
2
- <a href="https://lingo.dev">
3
- <img src="https://raw.githubusercontent.com/lingodotdev/lingo.dev/main/content/banner.launch.png" width="100%" alt="Lingo.dev" />
4
+ <a href="https://lingo.dev/compiler">
5
+ <img src="https://raw.githubusercontent.com/lingodotdev/lingo.dev/main/content/banner.compiler.png" width="100%" alt="Lingo.dev" />
4
6
  </a>
5
7
  </p>
6
8
 
7
9
  <p align="center">
8
- <strong>⚡️ AI-powered open-source CLI for web & mobile localization.</strong>
10
+ <strong>⚡️ AI-powered open-source tools for web & mobile localization.</strong>
9
11
  </p>
10
12
 
11
13
  <br />
12
14
 
13
15
  <p align="center">
14
- <a href="https://docs.lingo.dev">Docs</a> •
15
- <a href="https://github.com/lingodotdev/lingo.dev/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22">Contribute</a> •
16
- <a href="#-github-action">GitHub Action</a>
17
- <a href="#">Star the repo</a>
16
+ <a href="https://lingo.dev/cli">Lingo.dev CLI</a> •
17
+ <a href="https://lingo.dev/ci">Lingo.dev CI/CD</a> •
18
+ <a href="https://lingo.dev/compiler">Lingo.dev Compiler 🆕</a>
18
19
  </p>
19
20
 
20
21
  <p align="center">
@@ -31,125 +32,15 @@
31
32
 
32
33
  <br />
33
34
 
34
- Lingo.dev is a community-driven, open-source CLI for AI-powered web and mobile app localization.
35
-
36
- Lingo.dev is designed to produce authentic translations instantly, eliminating manual work and management overhead. As a result, teams do accurate localization 100x faster, shipping features to more happy users worldwide. It can be used with your own LLM or with Lingo.dev-managed Localization Engine.
37
-
38
- > **Little-known fact:** Lingo.dev began as a small project at a student hackathon back in 2023! Many iterations later, we got accepted into Y Combinator in 2024, and we're now hiring! Interested in building the next-gen localization tools? Send your CV to careers@lingo.dev! 🚀
39
-
40
- ## 📑 In This Guide
41
-
42
- - [Quickstart](#-quickstart) - Get started in minutes
43
- - [Caching](#-caching-with-i18nlock) - Optimize translation updates
44
- - [GitHub Action](#-github-action) - Automate localization in CI/CD
45
- - [Features](#-supercharged-features) - What makes Lingo.dev powerful
46
- - [Documentation](#-documentation) - Detailed guides and references
47
- - [Contribute](#-contribute) - Join our community
48
-
49
- ## 💫 Quickstart
50
-
51
- Lingo.dev CLI is designed to work with both your own LLM, and Lingo.dev-managed Localization Engine built on top of latest SOTA (state-of-the-art) LLMs.
52
-
53
- ### Using Your Own LLM (BYOK or Bring Your Own Key)
54
-
55
- 1. Create an `i18n.json` configuration file:
56
-
57
- ```json
58
- {
59
- "version": 1.5,
60
- "provider": {
61
- "id": "anthropic",
62
- "model": "claude-3-7-sonnet-latest",
63
- "prompt": "You're translating text from {source} to {target}."
64
- },
65
- "locale": {
66
- "source": "en",
67
- "targets": ["es", "fr", "de"]
68
- }
69
- }
70
- ```
71
-
72
- 2. Set your API key as an environment variable:
73
-
74
- ```bash
75
- export ANTHROPIC_API_KEY=your_anthropic_api_key
76
- # or for OpenAI
77
- export OPENAI_API_KEY=your_openai_api_key
78
- ```
79
-
80
- 3. Run the localization:
81
-
82
- ```bash
83
- npx lingo.dev@latest i18n
84
- ```
85
-
86
- ### Using Lingo.dev Cloud
87
-
88
- Oftentimes, production-grade apps require features like translation memory, glossary support, and localization quality assurance. Also, sometimes, you want an expert to decide for you which LLM provider and model to use, and to update the model automatically when new ones are released. Lingo.dev is a managed Localization Engine that provides these features:
89
-
90
- 1. Create an `i18n.json` configuration file (without provider node):
35
+ Lingo.dev is an open-source, i18n toolkit designed to help use LLMs for localization and translation of web, mobile apps and markdown content.
91
36
 
92
- ```json
93
- {
94
- "version": 1.5,
95
- "locale": {
96
- "source": "en",
97
- "targets": ["es", "fr", "de"]
98
- }
99
- }
100
- ```
37
+ Lingo.dev includes:
101
38
 
102
- 2. Authenticate with Lingo.dev:
39
+ - **Lingo.dev CLI** - a CLI tool built to help translate apps and markdown content with lightning speed and accuracy. [Docs](https://lingo.dev/cli)
40
+ - **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)
41
+ - **Lingo.dev Compiler 🆕** - makes React app multilingual at build time without requiring changes to your existing components. [Docs](https://lingo.dev/compiler)
103
42
 
104
- ```bash
105
- npx lingo.dev@latest auth --login
106
- ```
107
-
108
- 3. Run localization:
109
-
110
- ```bash
111
- npx lingo.dev@latest i18n
112
- ```
113
-
114
- ## 📖 Documentation
115
-
116
- For detailed guides and API references, visit the [documentation](https://lingo.dev/go/docs).
117
-
118
- ## 🔒 Caching with `i18n.lock`
119
-
120
- Lingo.dev uses an `i18n.lock` file to track content checksums, ensuring only changed text gets translated. This improves:
121
-
122
- - ⚡️ **Speed**: Skip already translated content
123
- - 🔄 **Consistency**: Prevent unnecessary retranslations
124
- - 💰 **Cost**: No billing for repeated translations
125
-
126
- ## 🤖 GitHub Action
127
-
128
- Lingo.dev offers a GitHub Action to automate localization in your CI/CD pipeline. Here's a basic setup:
129
-
130
- ```yaml
131
- - uses: lingodotdev/lingo.dev@main
132
- with:
133
- api-key: ${{ secrets.LINGODOTDEV_API_KEY }}
134
- ```
135
-
136
- This action runs `lingo.dev i18n` on every push, keeping your translations up-to-date automatically.
137
-
138
- For pull request mode and other configuration options, visit our [GitHub Action documentation](https://docs.lingo.dev/ci-action/gha).
139
-
140
- ## ⚡️ Lingo.dev's Superpowers
141
-
142
- - 🔥 **Instant integration**: Works with your codebase in minutes
143
- - 🔄 **CI/CD Automation**: Set it and forget it
144
- - 🌍 **Global reach**: Ship to users everywhere
145
- - 🧠 **AI-powered**: Uses latest language models for natural translations
146
- - 📊 **Format-agnostic**: JSON, YAML, CSV, Markdown, Android, iOS, and many more
147
- - 🔍 **Clean diffs**: Preserves your file structure exactly
148
- - ⚡️ **Lightning-fast**: Translations in seconds, not days
149
- - 🔄 **Always synced**: Automatically updates when content changes
150
- - 🌟 **Human quality**: Translations that don't sound robotic
151
- - 👨‍💻 **Built by devs, for devs**: We use it ourselves daily
152
- - 📈 **Grows with you**: From side project to enterprise scale
43
+ All tools are designed to help use LLM models for precise translation and localization, and to eliminate manual work.
153
44
 
154
45
  ## 🤝 Contribute
155
46
 
@@ -175,3 +66,7 @@ Want to contribute? Create a pull request!
175
66
  - [Bengali](/readme/bn.md)
176
67
 
177
68
  Don't see your language? Just add a new language code to the [`i18n.json`](./i18n.json) file and open a PR!
69
+
70
+ ## 💬 Talk to us
71
+
72
+ Have feedback, feature requests, bug reports or other suggestions? [Talk to us on Discord!](https://lingo.dev/go/discord)
package/build/cli.cjs CHANGED
@@ -2311,10 +2311,11 @@ function createPoDataLoader(params) {
2311
2311
  }
2312
2312
  }
2313
2313
  });
2314
- return _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
2314
+ const updatedSection = _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
2315
2315
  [`msgid ""`, `msgstr "Content-Type: text/plain\\n"`].join("\n"),
2316
2316
  ""
2317
2317
  ).trim();
2318
+ return preserveCommentOrder(updatedSection, section);
2318
2319
  }
2319
2320
  return section.trim();
2320
2321
  }).filter(Boolean).join("\n\n");
@@ -2354,6 +2355,35 @@ function createPoContentLoader() {
2354
2355
  }
2355
2356
  });
2356
2357
  }
2358
+ function preserveCommentOrder(section, originalSection) {
2359
+ const sectionLines = section.split(/\r?\n/);
2360
+ const originalLines = originalSection.split(/\r?\n/);
2361
+ const isComment = (line) => line.trim().startsWith("#");
2362
+ const sectionComments = sectionLines.filter(isComment);
2363
+ const nonCommentLines = sectionLines.filter((line) => !isComment(line));
2364
+ if (sectionComments.length <= 1) {
2365
+ return section;
2366
+ }
2367
+ const originalCommentOrder = originalLines.filter(isComment);
2368
+ const commentMap = /* @__PURE__ */ new Map();
2369
+ for (const line of sectionComments) {
2370
+ commentMap.set(line.trim(), line);
2371
+ }
2372
+ const reorderedComments = [];
2373
+ for (const orig of originalCommentOrder) {
2374
+ const trimmed = orig.trim();
2375
+ if (commentMap.has(trimmed)) {
2376
+ reorderedComments.push(commentMap.get(trimmed));
2377
+ commentMap.delete(trimmed);
2378
+ }
2379
+ }
2380
+ for (const line of sectionComments) {
2381
+ if (!originalCommentOrder.some((orig) => orig.trim() === line.trim())) {
2382
+ reorderedComments.push(line);
2383
+ }
2384
+ }
2385
+ return [...reorderedComments, ...nonCommentLines].join("\n").replace(/\n{3,}/g, "\n\n").trim();
2386
+ }
2357
2387
 
2358
2388
  // src/cli/loaders/xliff.ts
2359
2389
  var _xliff = require('xliff'); var _xliff2 = _interopRequireDefault(_xliff);
@@ -6550,7 +6580,7 @@ async function renderHero() {
6550
6580
  // package.json
6551
6581
  var package_default = {
6552
6582
  name: "lingo.dev",
6553
- version: "0.92.18",
6583
+ version: "0.93.0",
6554
6584
  description: "Lingo.dev CLI",
6555
6585
  private: false,
6556
6586
  publishConfig: {
@@ -6573,6 +6603,31 @@ var package_default = {
6573
6603
  types: "./build/spec.d.ts",
6574
6604
  import: "./build/spec.mjs",
6575
6605
  require: "./build/spec.cjs"
6606
+ },
6607
+ "./compiler": {
6608
+ types: "./build/compiler.d.ts",
6609
+ import: "./build/compiler.mjs",
6610
+ require: "./build/compiler.cjs"
6611
+ },
6612
+ "./react": {
6613
+ types: "./build/react.d.ts",
6614
+ import: "./build/react.mjs",
6615
+ require: "./build/react.cjs"
6616
+ },
6617
+ "./react/client": {
6618
+ types: "./build/react/client.d.ts",
6619
+ import: "./build/react/client.mjs",
6620
+ require: "./build/react/client.cjs"
6621
+ },
6622
+ "./react/rsc": {
6623
+ types: "./build/react/rsc.d.ts",
6624
+ import: "./build/react/rsc.mjs",
6625
+ require: "./build/react/rsc.cjs"
6626
+ },
6627
+ "./react/react-router": {
6628
+ types: "./build/react/react-router.d.ts",
6629
+ import: "./build/react/react-router.mjs",
6630
+ require: "./build/react/react-router.cjs"
6576
6631
  }
6577
6632
  },
6578
6633
  typesVersions: {
@@ -6585,6 +6640,21 @@ var package_default = {
6585
6640
  ],
6586
6641
  spec: [
6587
6642
  "./build/spec.d.ts"
6643
+ ],
6644
+ compiler: [
6645
+ "./build/compiler.d.ts"
6646
+ ],
6647
+ react: [
6648
+ "./build/react.d.ts"
6649
+ ],
6650
+ "react/client": [
6651
+ "./build/react/client.d.ts"
6652
+ ],
6653
+ "react/rsc": [
6654
+ "./build/react/rsc.d.ts"
6655
+ ],
6656
+ "react/react-router": [
6657
+ "./build/react/react-router.d.ts"
6588
6658
  ]
6589
6659
  }
6590
6660
  },
@@ -6619,6 +6689,8 @@ var package_default = {
6619
6689
  "@inquirer/prompts": "^7.4.1",
6620
6690
  "@lingo.dev/_sdk": "workspace:*",
6621
6691
  "@lingo.dev/_spec": "workspace:*",
6692
+ "@lingo.dev/_react": "workspace:*",
6693
+ "@lingo.dev/_compiler": "workspace:*",
6622
6694
  "@modelcontextprotocol/sdk": "^1.5.0",
6623
6695
  "@paralleldrive/cuid2": "^2.2.2",
6624
6696
  ai: "^4.3.15",