poly-lexis 0.1.0 → 0.2.1
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 +24 -24
- package/dist/cli/translations.js +353 -80
- package/dist/cli/translations.js.map +1 -1
- package/dist/index.d.ts +211 -108
- package/dist/index.js +632 -355
- package/dist/index.js.map +1 -1
- package/dist/translations/core/translations-config.schema.json +252 -32
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# poly-lexis
|
|
2
2
|
|
|
3
3
|
A powerful CLI and library for managing i18n translations with validation, auto-translation, and TypeScript type generation.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
poly-lexis provides a complete solution for managing internationalization (i18n) in your applications. It offers smart translation management with automatic validation, Google Translate integration for auto-filling missing translations, and TypeScript type generation for type-safe translations.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install lexis
|
|
12
|
+
npm install poly-lexis
|
|
13
13
|
# or
|
|
14
|
-
yarn add lexis
|
|
14
|
+
yarn add poly-lexis
|
|
15
15
|
# or
|
|
16
|
-
pnpm add lexis
|
|
16
|
+
pnpm add poly-lexis
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Initialize translations in your project
|
|
23
|
-
npx lexis
|
|
23
|
+
npx poly-lexis
|
|
24
24
|
|
|
25
25
|
# Add a new translation key
|
|
26
|
-
npx lexis add
|
|
26
|
+
npx poly-lexis add
|
|
27
27
|
|
|
28
28
|
# Auto-fill missing translations
|
|
29
29
|
export GOOGLE_TRANSLATE_API_KEY=your_key
|
|
30
|
-
npx lexis --auto-fill
|
|
30
|
+
npx poly-lexis --auto-fill
|
|
31
31
|
|
|
32
32
|
# Validate and generate types
|
|
33
|
-
npx lexis
|
|
33
|
+
npx poly-lexis
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Features
|
|
@@ -51,32 +51,32 @@ Run without any command to validate, auto-fill (optional), and generate types:
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
# Basic validation and type generation
|
|
54
|
-
lexis
|
|
54
|
+
poly-lexis
|
|
55
55
|
|
|
56
56
|
# With auto-translation
|
|
57
|
-
lexis --auto-fill
|
|
57
|
+
poly-lexis --auto-fill
|
|
58
58
|
|
|
59
59
|
# Auto-fill only specific language
|
|
60
|
-
lexis --auto-fill --language fr
|
|
60
|
+
poly-lexis --auto-fill --language fr
|
|
61
61
|
|
|
62
62
|
# Dry run to preview changes
|
|
63
|
-
lexis --auto-fill --dry-run
|
|
63
|
+
poly-lexis --auto-fill --dry-run
|
|
64
64
|
|
|
65
65
|
# Skip type generation
|
|
66
|
-
lexis --skip-types
|
|
66
|
+
poly-lexis --skip-types
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
### Add Translation Keys
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
# Interactive mode
|
|
73
|
-
lexis add
|
|
73
|
+
poly-lexis add
|
|
74
74
|
|
|
75
75
|
# With flags
|
|
76
|
-
lexis add --namespace common --key HELLO --value "Hello"
|
|
76
|
+
poly-lexis add --namespace common --key HELLO --value "Hello"
|
|
77
77
|
|
|
78
78
|
# With auto-translation
|
|
79
|
-
lexis add -n common -k WELCOME -v "Welcome" --auto-fill
|
|
79
|
+
poly-lexis add -n common -k WELCOME -v "Welcome" --auto-fill
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
### CLI Options
|
|
@@ -97,7 +97,7 @@ lexis add -n common -k WELCOME -v "Welcome" --auto-fill
|
|
|
97
97
|
|
|
98
98
|
## Configuration
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
poly-lexis uses a `.translationsrc.json` file in your project root for configuration:
|
|
101
101
|
|
|
102
102
|
```json
|
|
103
103
|
{
|
|
@@ -157,12 +157,12 @@ Translation files are organized by namespace and language:
|
|
|
157
157
|
|
|
158
158
|
## Programmatic API
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
poly-lexis can be used as a library in your Node.js code:
|
|
161
161
|
|
|
162
162
|
### Initialize Translations
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
|
-
import { initTranslationsInteractive } from 'lexis';
|
|
165
|
+
import { initTranslationsInteractive } from 'poly-lexis';
|
|
166
166
|
|
|
167
167
|
await initTranslationsInteractive(process.cwd());
|
|
168
168
|
```
|
|
@@ -170,7 +170,7 @@ await initTranslationsInteractive(process.cwd());
|
|
|
170
170
|
### Add Translation Key
|
|
171
171
|
|
|
172
172
|
```typescript
|
|
173
|
-
import { addTranslationKey } from 'lexis';
|
|
173
|
+
import { addTranslationKey } from 'poly-lexis';
|
|
174
174
|
|
|
175
175
|
await addTranslationKey(process.cwd(), {
|
|
176
176
|
namespace: 'common',
|
|
@@ -184,7 +184,7 @@ await addTranslationKey(process.cwd(), {
|
|
|
184
184
|
### Validate Translations
|
|
185
185
|
|
|
186
186
|
```typescript
|
|
187
|
-
import { validateTranslations } from 'lexis';
|
|
187
|
+
import { validateTranslations } from 'poly-lexis';
|
|
188
188
|
|
|
189
189
|
const result = await validateTranslations(
|
|
190
190
|
'/path/to/translations',
|
|
@@ -200,7 +200,7 @@ if (!result.valid) {
|
|
|
200
200
|
### Generate TypeScript Types
|
|
201
201
|
|
|
202
202
|
```typescript
|
|
203
|
-
import { generateTranslationTypes } from 'lexis';
|
|
203
|
+
import { generateTranslationTypes } from 'poly-lexis';
|
|
204
204
|
|
|
205
205
|
generateTranslationTypes(process.cwd());
|
|
206
206
|
```
|
|
@@ -208,7 +208,7 @@ generateTranslationTypes(process.cwd());
|
|
|
208
208
|
### Auto-fill Missing Translations
|
|
209
209
|
|
|
210
210
|
```typescript
|
|
211
|
-
import { autoFillTranslations } from 'lexis';
|
|
211
|
+
import { autoFillTranslations } from 'poly-lexis';
|
|
212
212
|
|
|
213
213
|
await autoFillTranslations({
|
|
214
214
|
translationsPath: '/path/to/translations',
|