anylang-dev 0.1.1 → 0.1.3
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 +4 -4
- package/package.json +1 -1
- package/src/config.js +1 -1
- package/src/pipeline.js +1 -1
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ anylang translate
|
|
|
86
86
|
"exclude": ["node_modules", ".git", "dist", "build", ".next"],
|
|
87
87
|
"outDir": "locales",
|
|
88
88
|
"runtime": {
|
|
89
|
-
"output": "src/anylang.
|
|
89
|
+
"output": "src/anylang.ts",
|
|
90
90
|
"importFrom": "anylang-dev/runtime"
|
|
91
91
|
},
|
|
92
92
|
"functionName": "$tr",
|
|
@@ -152,7 +152,7 @@ locales/
|
|
|
152
152
|
hi.json
|
|
153
153
|
anylang.lock.json
|
|
154
154
|
src/
|
|
155
|
-
anylang.
|
|
155
|
+
anylang.ts
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
The lock file stores SHA-256 fingerprints so unchanged strings are skipped on later runs.
|
|
@@ -172,7 +172,7 @@ anylang scan
|
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
This writes keyed source entries to `locales/en.json` and creates placeholder entries in each target locale.
|
|
175
|
-
It also generates `src/anylang.
|
|
175
|
+
It also generates `src/anylang.ts`, which imports all locale JSON files and exports runtime helpers.
|
|
176
176
|
|
|
177
177
|
3. Translate with Gemini:
|
|
178
178
|
|
|
@@ -221,7 +221,7 @@ import {
|
|
|
221
221
|
useLanguage,
|
|
222
222
|
useTr,
|
|
223
223
|
type LanguageCode
|
|
224
|
-
} from "
|
|
224
|
+
} from "@/anylang";
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
You do not manually import `en.json`, `hi.json`, `ja.json`, etc. The generated file does that for you based on `sourceLocale` and `targetLocales`.
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -8,7 +8,7 @@ export const DEFAULT_CONFIG = {
|
|
|
8
8
|
exclude: ["node_modules", ".git", "dist", "build", ".next"],
|
|
9
9
|
outDir: "locales",
|
|
10
10
|
runtime: {
|
|
11
|
-
output: "src/anylang.
|
|
11
|
+
output: "src/anylang.ts",
|
|
12
12
|
importFrom: "anylang-dev/runtime"
|
|
13
13
|
},
|
|
14
14
|
functionName: "$tr",
|
package/src/pipeline.js
CHANGED
|
@@ -131,7 +131,7 @@ function normalizeTargetEntry(entry) {
|
|
|
131
131
|
async function writeGeneratedRuntime(config) {
|
|
132
132
|
if (config.runtime === false) return;
|
|
133
133
|
|
|
134
|
-
const output = path.resolve(config.runtime?.output || "src/anylang.
|
|
134
|
+
const output = path.resolve(config.runtime?.output || "src/anylang.ts");
|
|
135
135
|
const outDir = path.resolve(config.outDir);
|
|
136
136
|
const locales = [config.sourceLocale, ...config.targetLocales.filter((locale) => locale !== config.sourceLocale)];
|
|
137
137
|
const importFrom = config.runtime?.importFrom || "anylang-dev/runtime";
|