anylang-dev 0.2.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 +12 -0
- package/package.json +9 -2
- package/src/jsx-runtime.d.ts +7 -0
- package/src/vite.d.ts +8 -0
- package/src/vite.js +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,18 @@ export default defineConfig({
|
|
|
72
72
|
});
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
If you use `tr="false"`, add the JSX type augmentation once in `src/vite-env.d.ts`:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import "anylang-dev/jsx-runtime";
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That makes this TypeScript-safe:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<p tr="false">BrandName</p>
|
|
85
|
+
```
|
|
86
|
+
|
|
75
87
|
`anylang scan` creates locale files without calling a translation provider. To translate for real with Gemini, add your own API key to `.env` in the project where you run `anylang`:
|
|
76
88
|
|
|
77
89
|
```env
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anylang-dev",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Bring-your-own-key website translation JSON generator.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,14 @@
|
|
|
18
18
|
"types": "./src/runtime.d.ts",
|
|
19
19
|
"default": "./src/runtime.js"
|
|
20
20
|
},
|
|
21
|
-
"./vite":
|
|
21
|
+
"./vite": {
|
|
22
|
+
"types": "./src/vite.d.ts",
|
|
23
|
+
"default": "./src/vite.js"
|
|
24
|
+
},
|
|
25
|
+
"./jsx-runtime": {
|
|
26
|
+
"types": "./src/jsx-runtime.d.ts",
|
|
27
|
+
"default": "./src/runtime.js"
|
|
28
|
+
}
|
|
22
29
|
},
|
|
23
30
|
"scripts": {
|
|
24
31
|
"test": "node --test"
|
package/src/vite.d.ts
ADDED
package/src/vite.js
CHANGED
|
@@ -12,7 +12,7 @@ export default function anylang(options = {}) {
|
|
|
12
12
|
|
|
13
13
|
const result = transformAutoJsx(code, id, {
|
|
14
14
|
keyPrefix: options.keyPrefix,
|
|
15
|
-
runtimeImport: options.runtimeImport || "
|
|
15
|
+
runtimeImport: options.runtimeImport || "@/anylang"
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
if (!result.changed) return null;
|