@intlify/unplugin-vue-i18n 7.0.0-beta.1 → 11.0.0-beta.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 +35 -64
- package/lib/index.cjs +244 -349
- package/lib/index.d.cts +4 -2
- package/lib/index.d.mts +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.mjs +242 -347
- package/lib/types.d.cts +2 -0
- package/lib/types.d.mts +2 -0
- package/lib/types.d.ts +2 -0
- package/lib/vite.cjs +3 -4
- package/lib/vite.mjs +3 -4
- package/lib/webpack.cjs +3 -4
- package/lib/webpack.mjs +3 -4
- package/package.json +22 -23
- package/lib/rspack.cjs +0 -22
- package/lib/rspack.d.cts +0 -6
- package/lib/rspack.d.mts +0 -6
- package/lib/rspack.d.ts +0 -6
- package/lib/rspack.mjs +0 -20
- package/rspack.d.ts +0 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
unplugin for Vue I18n
|
|
8
8
|
|
|
9
|
+
<!-- eslint-disable markdown/no-missing-label-refs -->
|
|
10
|
+
|
|
9
11
|
## 🌟 Features
|
|
10
12
|
|
|
11
13
|
- i18n resource pre-compilation
|
|
@@ -59,25 +61,6 @@ module.exports = {
|
|
|
59
61
|
|
|
60
62
|
<br></details>
|
|
61
63
|
|
|
62
|
-
<details>
|
|
63
|
-
<summary>Rspack</summary><br>
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/rspack')
|
|
67
|
-
|
|
68
|
-
// rspack.config.js
|
|
69
|
-
module.exports = {
|
|
70
|
-
/* ... */
|
|
71
|
-
plugins: [
|
|
72
|
-
VueI18nPlugin({
|
|
73
|
-
/* options */
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
<br></details>
|
|
80
|
-
|
|
81
64
|
<details>
|
|
82
65
|
<summary>Nuxt</summary><br>
|
|
83
66
|
|
|
@@ -288,7 +271,7 @@ About details, See the [here](https://vue-i18n.intlify.dev/guide/advanced/optimi
|
|
|
288
271
|
|
|
289
272
|
A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, you can specify a path to pre-compile i18n resources files. The extensions of i18n resources to be precompiled are as follows:
|
|
290
273
|
|
|
291
|
-
```
|
|
274
|
+
```md
|
|
292
275
|
- json
|
|
293
276
|
- json5
|
|
294
277
|
- yaml
|
|
@@ -299,17 +282,11 @@ About details, See the [here](https://vue-i18n.intlify.dev/guide/advanced/optimi
|
|
|
299
282
|
|
|
300
283
|
If nothing is specified for this option, i.e. `undefined`, nothing is done to the resource in the above format.
|
|
301
284
|
|
|
302
|
-
> [!WARNING]
|
|
303
|
-
>
|
|
304
|
-
> `json` resources matches this option, it will be handled **before the internal json plugin of bundler, and will not be processed afterwards**, else the option doesn't match, the bundler side will handle.
|
|
285
|
+
> [!WARNING] > `json` resources matches this option, it will be handled **before the internal json plugin of bundler, and will not be processed afterwards**, else the option doesn't match, the bundler side will handle.
|
|
305
286
|
|
|
306
|
-
> [!WARNING]
|
|
307
|
-
>
|
|
308
|
-
> `yaml` resources don't support multi documentation with `|`, alias with `&` and `*`, tags with `! `, `@`, etc. Only simple data structures.
|
|
287
|
+
> [!WARNING] > `yaml` resources don't support multi documentation with `|`, alias with `&` and `*`, tags with `! `, `@`, etc. Only simple data structures.
|
|
309
288
|
|
|
310
|
-
> [!WARNING]
|
|
311
|
-
>
|
|
312
|
-
> `js` and `ts` resources are set **simple export (`export default`) as locale messages object, as default**.
|
|
289
|
+
> [!WARNING] > `js` and `ts` resources are set **simple export (`export default`) as locale messages object, as default**.
|
|
313
290
|
|
|
314
291
|
```js
|
|
315
292
|
export default {
|
|
@@ -328,22 +305,22 @@ If you need to use programmatically dynamic resource construction, you would be
|
|
|
328
305
|
- **Type:** `string`
|
|
329
306
|
- **Default:** `'vue-i18n'`
|
|
330
307
|
|
|
331
|
-
> [!NOTE]
|
|
332
|
-
> This options is supported from v5.1.0, and works with vue-i18n v10 and later.
|
|
308
|
+
> [!NOTE]
|
|
309
|
+
> This options is supported from v5.1.0, and works with vue-i18n v10 and later.
|
|
333
310
|
|
|
334
|
-
Bundle target vue-i18n module. You can specify either `‘vue-i18n’` or `‘petite-vue-i18n’`.
|
|
311
|
+
Bundle target vue-i18n module. You can specify either `‘vue-i18n’` or `‘petite-vue-i18n’`.
|
|
335
312
|
|
|
336
|
-
The default is `'vue-i18n'`, and the following installed in node_modules will be bundled.
|
|
313
|
+
The default is `'vue-i18n'`, and the following installed in node_modules will be bundled.
|
|
337
314
|
|
|
338
|
-
- development: `vue-i18n.esm-bundler.js`
|
|
339
|
-
- production: `vue-i18n.runtime.esm-bundler.js`
|
|
315
|
+
- development: `vue-i18n.esm-bundler.js`
|
|
316
|
+
- production: `vue-i18n.runtime.esm-bundler.js`
|
|
340
317
|
|
|
341
|
-
In the case of `‘petite-vue-i18n’`, the following installed in node_modules will be bundled.
|
|
318
|
+
In the case of `‘petite-vue-i18n’`, the following installed in node_modules will be bundled.
|
|
342
319
|
|
|
343
|
-
- development: `petite-vue-i18n.esm-bundler.js`
|
|
344
|
-
- production: `petite-vue-i18n.runtime.esm-bundler.js`
|
|
320
|
+
- development: `petite-vue-i18n.esm-bundler.js`
|
|
321
|
+
- production: `petite-vue-i18n.runtime.esm-bundler.js`
|
|
345
322
|
|
|
346
|
-
If you are using petite-vue-i18n, you will need to set this value.
|
|
323
|
+
If you are using petite-vue-i18n, you will need to set this value.
|
|
347
324
|
|
|
348
325
|
### `strictMessage`
|
|
349
326
|
|
|
@@ -385,7 +362,7 @@ If you are using petite-vue-i18n, you will need to set this value.
|
|
|
385
362
|
}
|
|
386
363
|
```
|
|
387
364
|
|
|
388
|
-
If you fetch some resources from the backend, the data **must be pre-compiled** for production.
|
|
365
|
+
If you fetch some resources from the backend, the data **must be pre-compiled** for production. exmaple is [here](https://github.com/intlify/vue-i18n-next/tree/master/examples/backend).
|
|
389
366
|
|
|
390
367
|
### `jitCompilation`
|
|
391
368
|
|
|
@@ -393,15 +370,15 @@ If you are using petite-vue-i18n, you will need to set this value.
|
|
|
393
370
|
- **Default:** `true`
|
|
394
371
|
|
|
395
372
|
> [!IMPORTANT]
|
|
396
|
-
> 'jitCompilation' option is
|
|
373
|
+
> 'jitCompilation' option is deprected in v5.
|
|
397
374
|
> This option will be supported with vue-i18n until v9 latest version.
|
|
398
375
|
|
|
399
|
-
Whether locale
|
|
376
|
+
Whether locale mesages should be compiled by JIT (Just in Time) compilation with vue-i18n's message compiler.
|
|
400
377
|
|
|
401
|
-
JIT compilation has been supported since vue-i18n v9.3. This means that since v9 was released until now, the message compiler compiles to executable JavaScript code, however it did not work in the CSP environment. Also, since this was an AOT (Ahead of Time) compilation, it was not possible to dynamically retrieve locale messages from the back-end Database and compose locale
|
|
378
|
+
JIT compilation has been supported since vue-i18n v9.3. This means that since v9 was released until now, the message compiler compiles to executable JavaScript code, however it did not work in the CSP environment. Also, since this was an AOT (Ahead of Time) compilation, it was not possible to dynamically retrieve locale messages from the back-end Database and compose locale mesages with programatic.
|
|
402
379
|
|
|
403
380
|
> [!WARNING]
|
|
404
|
-
> Enabling JIT compilation causes the message compiler to generate AST objects for locale
|
|
381
|
+
> Enabling JIT compilation causes the message compiler to generate AST objects for locale mesages instead of JavaScript code. If you pre-compile locale messages with a tool such as the [Intlify CLI](https://github.com/intlify/cli) and import them dynamically, you need to rebuild that resource.
|
|
405
382
|
|
|
406
383
|
About JIT compilation, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation)
|
|
407
384
|
|
|
@@ -440,10 +417,9 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
440
417
|
|
|
441
418
|
Whether or not to automatically use Vue I18n **runtime-only** in production build, set `vue-i18n.runtime.esm-bundler.js` in the `vue-i18n` field of bundler config, the below:
|
|
442
419
|
|
|
443
|
-
```
|
|
420
|
+
```md
|
|
444
421
|
- vite config: `resolve.alias`
|
|
445
422
|
- webpack config: `resolve.alias`
|
|
446
|
-
- rspack config: `resolve.alias`
|
|
447
423
|
```
|
|
448
424
|
|
|
449
425
|
If `false` is specified, Vue I18n (vue-i18n) package.json `module` field will be used.
|
|
@@ -459,9 +435,6 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
459
435
|
|
|
460
436
|
For more details, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
|
|
461
437
|
|
|
462
|
-
> [!CAUTION]
|
|
463
|
-
> This option will be removed in v7
|
|
464
|
-
|
|
465
438
|
### `fullInstall`
|
|
466
439
|
|
|
467
440
|
- **Type:** `boolean`
|
|
@@ -469,7 +442,7 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
469
442
|
|
|
470
443
|
Whether to install the full set of APIs, components, etc. provided by Vue I18n. By default, all of them will be installed.
|
|
471
444
|
|
|
472
|
-
If `false` is specified, **
|
|
445
|
+
If `false` is specified, **buld-in components and directive will not be installed in vue and will be tree-shaken.**
|
|
473
446
|
|
|
474
447
|
For more details, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
|
|
475
448
|
|
|
@@ -539,7 +512,7 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
539
512
|
|
|
540
513
|
`defaultSFCLang` must have one of the following values:
|
|
541
514
|
|
|
542
|
-
```
|
|
515
|
+
```md
|
|
543
516
|
- json
|
|
544
517
|
- json5
|
|
545
518
|
- yaml
|
|
@@ -626,10 +599,8 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
626
599
|
|
|
627
600
|
This option that to use i18n custom blocks in `vue-class-component`.
|
|
628
601
|
|
|
629
|
-
> [!IMPORTANT]
|
|
630
|
-
>
|
|
631
|
-
> `useClassComponent` option is deprecated in v5.
|
|
632
|
-
> This option will be supported with vue-i18n until v9 latest version.
|
|
602
|
+
> [!IMPORTANT] > `useClassComponent` option is deprecated in v5.
|
|
603
|
+
> This option will be supported with vue-i18n until v9 latest version.
|
|
633
604
|
|
|
634
605
|
### `onlyLocales`
|
|
635
606
|
|
|
@@ -645,12 +616,10 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
645
616
|
|
|
646
617
|
Whether to use the import name of `petite-vue-i18n` with the same import name as vue-i18n (`import { xxx } from 'vue-i18n'`).
|
|
647
618
|
|
|
648
|
-
This option allows a smooth migration from `petite-vue-i18n` to `vue-i18n` and allows progressive
|
|
619
|
+
This option allows a smooth migration from `petite-vue-i18n` to `vue-i18n` and allows progressive enhacement.
|
|
649
620
|
|
|
650
|
-
> [!IMPORTANT]
|
|
651
|
-
>
|
|
652
|
-
> `useVueI18nImportName` option is deprecated in v5.
|
|
653
|
-
> This option will be supported with vue-i18n until v9 latest version.
|
|
621
|
+
> [!IMPORTANT] > `useVueI18nImportName` option is deprecated in v5.
|
|
622
|
+
> This option will be supported with vue-i18n until v9 latest version.
|
|
654
623
|
|
|
655
624
|
### `optimizeTranslationDirective`
|
|
656
625
|
|
|
@@ -661,8 +630,8 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
661
630
|
|
|
662
631
|
If you want to put it manually, you can specify the signature of the translation function as a string or a string array.
|
|
663
632
|
|
|
664
|
-
> [!WARNING]
|
|
665
|
-
> About for manually signature, see the details [vue-i18n-extensions API docs](https://github.com/intlify/vue-i18n-extensions/blob/next/docs/%40intlify/vue-i18n-extensions-api.md#translationsignatures) and [usecase from vue-i18n-extensions PR](https://github.com/intlify/vue-i18n-extensions/pull/217/files#diff-3fb9543f91e011d4b0dc9beff44082fe1a99c9eab70c1afab23c3c34352b7c38R121-R200)
|
|
633
|
+
> [!WARNING]
|
|
634
|
+
> About for manually signature, see the details [vue-i18n-extensions API docs](https://github.com/intlify/vue-i18n-extensions/blob/next/docs/%40intlify/vue-i18n-extensions-api.md#translationsignatures) and [usecase from vue-i18n-extensions PR](https://github.com/intlify/vue-i18n-extensions/pull/217/files#diff-3fb9543f91e011d4b0dc9beff44082fe1a99c9eab70c1afab23c3c34352b7c38R121-R200)
|
|
666
635
|
|
|
667
636
|
### `transformI18nBlock`
|
|
668
637
|
|
|
@@ -714,8 +683,8 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
714
683
|
</i18n>
|
|
715
684
|
```
|
|
716
685
|
|
|
717
|
-
> [!IMPORTANT]
|
|
718
|
-
> The function **must** return a string or the build will fail.
|
|
686
|
+
> [!IMPORTANT]
|
|
687
|
+
> The function **must** return a string or the build will fail.
|
|
719
688
|
|
|
720
689
|
## 📜 Changelog
|
|
721
690
|
|
|
@@ -724,3 +693,5 @@ Details changes for each release are documented in the [CHANGELOG.md](https://gi
|
|
|
724
693
|
## ©️ License
|
|
725
694
|
|
|
726
695
|
[MIT](http://opensource.org/licenses/MIT)
|
|
696
|
+
|
|
697
|
+
<!-- eslint-enable markdown/no-missing-label-refs -->
|