Skip to content

Commit f7d43e0

Browse files
committed
chore: rename modules to have more reasonable names
1 parent 1c1ed5a commit f7d43e0

19 files changed

Lines changed: 70 additions & 71 deletions

cmp/compiler/src/plugin/next-dev-config-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { LingoConfig } from "../types";
2-
import { generateDevConfigModule } from "./locale-code-generator";
2+
import { generateDevConfigModule } from "./virtual-modules-code-generator";
33

44
/**
55
* Loader for dev-config module

cmp/compiler/src/plugin/next-locale-client-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import type { LingoConfig } from "../types";
7-
import { generateClientLocaleModule } from "./locale-code-generator";
7+
import { generateClientLocaleModule } from "./virtual-modules-code-generator";
88

99
export default function nextLocaleClientLoader(
1010
this: any,

cmp/compiler/src/plugin/next-locale-server-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import type { LingoConfig } from "../types";
7-
import { generateServerLocaleModule } from "./locale-code-generator";
7+
import { generateServerLocaleModule } from "./virtual-modules-code-generator";
88

99
export default function nextLocaleServerLoader(
1010
this: any,

cmp/compiler/src/plugin/unplugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
generateClientLocaleModule,
2222
generateDevConfigModule,
2323
generateServerLocaleModule,
24-
} from "./locale-code-generator";
24+
} from "./virtual-modules-code-generator";
2525
import { processBuildTranslations } from "./build-translator";
2626
import { registerCleanupOnCurrentProcess } from "./cleanup";
2727
import path from "path";
File renamed without changes.

cmp/compiler/src/react/shared/TranslationContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function TranslationProvider__Dev({
512512
if (devWidget?.enabled !== false) {
513513
// Dynamic import ensures this only runs on the client
514514
import("../../widget/lingo-dev-widget").catch((err) => {
515-
logger.error("Failed to load dev widget:", err);
515+
logger.error("Failed to load dev widget:", err, err.message);
516516
});
517517
}
518518
}, [devWidget?.enabled]);

cmp/compiler/src/translators/USAGE.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ const batch = await translator.translate("fr", {
4343
// Output: { hash1: "fr/Ḍáśĥḅóáŕḍ ", hash2: "fr/Śéţţíñĝś " }
4444
```
4545

46-
### 2. LCPTranslator (Production)
46+
### 2. lingoTranslator (Production)
4747

4848
For real AI-powered translations:
4949

5050
```typescript
51-
import { LCPTranslator } from "@lingo.dev/compiler-beta/translate";
51+
import { lingoTranslator } from "@lingo.dev/compiler-beta/translate";
5252

5353
// Using Lingo.dev Engine
54-
const translator = new LCPTranslator({
54+
const translator = new lingoTranslator({
5555
models: "lingo.dev",
5656
sourceLocale: "en",
5757
});
5858

5959
// Using custom LLM providers
60-
const customTranslator = new LCPTranslator({
60+
const customTranslator = new lingoTranslator({
6161
models: {
6262
"en:es": "google:gemini-2.0-flash",
6363
"en:fr": "groq:llama3-70b-8192",
@@ -80,11 +80,11 @@ Wrap any translator with caching:
8080

8181
```typescript
8282
import {
83-
LCPTranslator,
83+
lingoTranslator,
8484
createCachedTranslator,
8585
} from "@lingo.dev/compiler-beta/translate";
8686

87-
const translator = new LCPTranslator({
87+
const translator = new lingoTranslator({
8888
models: "lingo.dev",
8989
sourceLocale: "en",
9090
});
@@ -126,11 +126,11 @@ export default async function Page() {
126126

127127
```typescript
128128
import { getServerTranslations } from "@lingo.dev/compiler-beta/react/server";
129-
import { LCPTranslator, createCachedTranslator } from "@lingo.dev/compiler-beta/translate";
129+
import { lingoTranslator, createCachedTranslator } from "@lingo.dev/compiler-beta/translate";
130130
import metadata from "./.lingo/metadata.json";
131131

132132
const translator = createCachedTranslator(
133-
new LCPTranslator({
133+
new lingoTranslator({
134134
models: "lingo.dev",
135135
sourceLocale: "en",
136136
}),
@@ -224,7 +224,7 @@ const cached = createCachedTranslator(translateFn, cacheConfig);
224224
### After (Translator Interface)
225225

226226
```typescript
227-
const translator = new LCPTranslator({
227+
const translator = new lingoTranslator({
228228
models,
229229
sourceLocale,
230230
prompt,
@@ -244,7 +244,7 @@ const cached = createCachedTranslator(translator, cacheConfig);
244244

245245
## Environment Variables
246246

247-
For LCP translator, set your API keys:
247+
For lingo translator, set your API keys:
248248

249249
```env
250250
# Recommended
@@ -262,12 +262,12 @@ MISTRAL_API_KEY=your_key_here
262262
```typescript
263263
// translator.ts
264264
import {
265-
LCPTranslator,
265+
LingoTranslator,
266266
createCachedTranslator,
267267
} from "@lingo.dev/compiler-beta/translate";
268268

269269
export const translator = createCachedTranslator(
270-
new LCPTranslator({
270+
new LingoTranslator({
271271
models: "lingo.dev",
272272
sourceLocale: "en",
273273
}),

cmp/compiler/src/translators/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export type { Translator, TranslatableEntry } from "./api";
99

1010
// Translators
1111
export { PseudoTranslator } from "./pseudotranslator";
12-
export { Service } from "./lcp";
13-
export type { LCPTranslatorConfig } from "./lcp";
12+
export { Service } from "./lingo";
13+
export type { LingoTranslatorConfig } from "./lingo";
1414
export { createTranslator } from "./translator-factory";
1515
export type { TranslatorFactoryConfig } from "./translator-factory";
1616

cmp/compiler/src/translators/lcp/README.md renamed to cmp/compiler/src/translators/lingo/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# LCP (Lingo Compiler Protocol) Translator
1+
# Lingo Translator
22

33
Real AI-powered translation using various LLM providers for compiler-beta.
44

55
## Overview
66

7-
The LCP Translator implements the `Translator` interface and provides real translation capabilities using:
7+
The lingo Translator implements the `Translator` interface and provides real translation capabilities using:
88

99
- **Lingo.dev Engine** (recommended) - Optimized for localization
1010
- **Direct LLM providers** - Google, Groq, OpenRouter, Ollama, Mistral
@@ -36,9 +36,9 @@ The required dependencies are already included in compiler-beta:
3636
### Basic Usage with Lingo.dev Engine (Recommended)
3737

3838
```typescript
39-
import { LCPTranslator } from "@lingo.dev/compiler-beta/translate";
39+
import { lingoTranslator } from "@lingo.dev/compiler-beta/translate";
4040

41-
const translator = new LCPTranslator({
41+
const translator = new lingoTranslator({
4242
models: "lingo.dev",
4343
sourceLocale: "en",
4444
});
@@ -61,7 +61,7 @@ console.log(batch);
6161
### Using Direct LLM Providers
6262

6363
```typescript
64-
const translator = new LCPTranslator({
64+
const translator = new lingoTranslator({
6565
models: {
6666
"en:es": "google:gemini-2.0-flash",
6767
"en:fr": "groq:llama3-8b-8192",
@@ -79,7 +79,7 @@ await translator.translate("es", {
7979
### With Custom Prompts
8080

8181
```typescript
82-
const translator = new LCPTranslator({
82+
const translator = new lingoTranslator({
8383
models: "lingo.dev",
8484
sourceLocale: "en",
8585
prompt: `
@@ -94,11 +94,11 @@ const translator = new LCPTranslator({
9494

9595
```typescript
9696
import {
97-
LCPTranslator,
97+
lingoTranslator,
9898
createCachedTranslator,
9999
} from "@lingo.dev/compiler-beta/translate";
100100

101-
const translator = new LCPTranslator({
101+
const translator = new lingoTranslator({
102102
models: "lingo.dev",
103103
sourceLocale: "en",
104104
});
@@ -112,10 +112,10 @@ const cachedTranslator = createCachedTranslator(translator, {
112112

113113
## Configuration
114114

115-
### LCPTranslatorConfig
115+
### lingoTranslatorConfig
116116

117117
```typescript
118-
interface LCPTranslatorConfig {
118+
interface lingoTranslatorConfig {
119119
// Model configuration
120120
models: "lingo.dev" | Record<string, string>;
121121

@@ -258,11 +258,11 @@ Translation data is serialized to XML for better LLM understanding:
258258

259259
## API Reference
260260

261-
### `LCPTranslator` class
261+
### `lingoTranslator` class
262262

263263
```typescript
264-
class LCPTranslator implements Translator<LCPTranslatorConfig> {
265-
constructor(config: LCPTranslatorConfig);
264+
class lingoTranslator implements Translator<lingoTranslatorConfig> {
265+
constructor(config: lingoTranslatorConfig);
266266

267267
// Translate one or more entries
268268
translate(
@@ -283,13 +283,13 @@ interface TranslatableEntry {
283283

284284
## Comparison with PseudoTranslator
285285

286-
| Feature | LCPTranslator | PseudoTranslator |
287-
| ----------------- | ------------- | ------------------- |
288-
| Real translations | ✅ Yes | ❌ No (fake) |
289-
| Requires API key | ✅ Yes | ❌ No |
290-
| Cost | 💰 Varies | 🆓 Free |
291-
| Use case | Production | Testing/development |
292-
| Accuracy | 🎯 High | 🎪 N/A |
286+
| Feature | lingoTranslator | PseudoTranslator |
287+
| ----------------- | --------------- | ------------------- |
288+
| Real translations | ✅ Yes | ❌ No (fake) |
289+
| Requires API key | ✅ Yes | ❌ No |
290+
| Cost | 💰 Varies | 🆓 Free |
291+
| Use case | Production | Testing/development |
292+
| Accuracy | 🎯 High | 🎪 N/A |
293293

294294
## Error Handling
295295

@@ -315,7 +315,7 @@ try {
315315

316316
## Examples
317317

318-
See `lcp-translator.test.ts` for working examples.
318+
See `lingo-translator.test.ts` for working examples.
319319

320320
## Related
321321

File renamed without changes.

0 commit comments

Comments
 (0)