You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 12, 2023. It is now read-only.
vue-i18n rollup plugin for i18n resource pre-compilation and custom blocks
7
7
8
8
**NOTE:**:warning: This `next` branch is development branch for Vue 3! The stable version is now in [`master`](https://github.com/intlify/rollup-plugin-vue-i18n/tree/master) branch!
the below example that `examples/composable/App.vue` have `i18n` custom block:
38
+
### i18n resource pre-compilation
39
+
40
+
Since [email protected], The locale messages are handled with message compiler, which converts them to javascript functions after compiling. After compiling, message compiler converts them into javascript functions, which can improve the performance of the application.
41
+
42
+
However, with the message compiler, the javascript function conversion will not work in some environments (e.g. CSP). For this reason, [email protected] and later offer a full version that includes compiler and runtime, and a runtime only version.
43
+
44
+
If you are using the runtime version, you will need to compile before importing locale messages by managing them in a file such as `.json`.
#### Notes on using with other i18n resource loading plugins
80
+
81
+
If you use the plugin like `@rollup/plugin-json`, make sure that the i18n resource to be precompiled with `rollup-plugin-vue-i18n` is not loaded. you need to filter with the plugin options.
82
+
83
+
84
+
### `i18n` custom block
85
+
86
+
the below example that `examples/composition/App.vue` have `i18n` custom block:
39
87
40
88
```vue
41
89
<template>
@@ -47,18 +95,23 @@ the below example that `examples/composable/App.vue` have `i18n` custom block:
47
95
</select>
48
96
</form>
49
97
<p>{{ t('hello') }}</p>
98
+
<Banana />
50
99
</template>
51
100
52
101
<script>
53
102
import { useI18n } from 'vue-i18n'
103
+
import Banana from './Banana.vue'
54
104
55
105
export default {
56
106
name: 'App',
107
+
components: {
108
+
Banana
109
+
},
57
110
setup() {
58
111
const { t, locale } = useI18n({
59
-
inheritLocale: true
112
+
inheritLocale: true,
113
+
useScope: 'local'
60
114
})
61
-
62
115
return { t, locale }
63
116
}
64
117
}
@@ -79,37 +132,6 @@ export default {
79
132
80
133
```
81
134
82
-
If you would like to bundle as common library with rollup, you can configure the following for ES Module:
0 commit comments