File tree Expand file tree Collapse file tree 6 files changed +30
-14
lines changed
size-check-petite-vue-i18n Expand file tree Collapse file tree 6 files changed +30
-14
lines changed Original file line number Diff line number Diff line change 8
8
"serve" : " vite preview"
9
9
},
10
10
"dependencies" : {
11
- "@intlify/core" : " 9.2.0-alpha.6 "
11
+ "@intlify/core" : " 9.2.0-alpha.7 "
12
12
},
13
13
"devDependencies" : {
14
14
"vite" : " ^2.4.2"
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <h1 >{{ t('hello') }}</h1 >
3
+ </template >
4
+
5
+ <script lang="ts">
6
+ import { defineComponent } from ' vue'
7
+ import { useI18n } from ' vue-i18n'
8
+
9
+ export default defineComponent ({
10
+ setup() {
11
+ const { t } = useI18n ()
12
+ return { t }
13
+ }
14
+ })
15
+ </script >
Original file line number Diff line number Diff line change 1
- import { h , createApp } from '@vue/runtime-dom'
2
- import { createI18n , useI18n } from 'petite-vue-i18n'
1
+ import { createApp } from '@vue/runtime-dom'
2
+ import { createI18n } from 'vue-i18n'
3
+ import App from './App.vue'
3
4
4
5
const i18n = createI18n ( {
5
- legacy : false ,
6
+ // legacy: false,
6
7
locale : 'en' ,
7
8
messages : {
8
9
en : {
9
- hello : ( ) => 'hello!'
10
+ // hello: () => 'hello!'
11
+ hello : 'hello!'
10
12
}
11
13
}
12
14
} )
13
15
14
- const app = createApp ( {
15
- setup ( ) {
16
- const { t } = useI18n ( { useScope : 'global' } )
17
- return ( ) => h ( 'div' , t ( 'hello world!' ) )
18
- }
19
- } )
16
+ const app = createApp ( App )
20
17
app . use ( i18n , { globalInstall : false } )
21
18
console . log ( 't' , i18n . global . t ( 'hello' ) )
22
19
app . mount ( '#app' )
Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ export default defineConfig({
23
23
} ,
24
24
resolve : {
25
25
alias : {
26
- 'petite-vue-i18n' :
27
- '../petite-vue-i18n/dist/petite-vue-i18n.runtime.esm-bundler.js'
26
+ 'vue-i18n' : 'petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js'
28
27
}
29
28
} ,
30
29
plugins : [ vue ( ) ]
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const i18n = createI18n({
14
14
const app = createApp ( {
15
15
setup ( ) {
16
16
const { t } = useI18n ( { useScope : 'global' } )
17
- return ( ) => h ( 'div' , t ( 'hello world! ' ) )
17
+ return ( ) => h ( 'div' , t ( 'hello' ) )
18
18
}
19
19
} )
20
20
app . use ( i18n , { globalInstall : false } )
Original file line number Diff line number Diff line change @@ -21,5 +21,10 @@ export default defineConfig({
21
21
__INTLIFY_PROD_DEVTOOLS__ : false ,
22
22
'process.env.NODE_ENV' : JSON . stringify ( 'production' )
23
23
} ,
24
+ resolve : {
25
+ alias : {
26
+ 'vue-i18n' : 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
27
+ }
28
+ } ,
24
29
plugins : [ vue ( ) ]
25
30
} )
You can’t perform that action at this time.
0 commit comments