This repository was archived by the owner on Dec 31, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export default {
2929 // component local i18n
3030 if ( this . $root && this . $root . $i18n && this . $root . $i18n instanceof VueI18n ) {
3131 options . i18n . root = this . $root . $i18n
32+ options . i18n . fallbackLocale = this . $root . $i18n . fallbackLocale
3233 options . i18n . silentTranslationWarn = this . $root . $i18n . silentTranslationWarn
3334 }
3435
Original file line number Diff line number Diff line change @@ -132,4 +132,44 @@ describe('issues', () => {
132132 } ) . then ( done )
133133 } )
134134 } )
135+
136+ describe ( '#174' , ( ) => {
137+ it ( 'should be fallback' , done => {
138+ vm = new Vue ( {
139+ i18n : new VueI18n ( {
140+ locale : 'en' ,
141+ fallbackLocale : 'ja' ,
142+ messages : {
143+ en : { } ,
144+ ja : { msg : 'メッセージ' }
145+ }
146+ } ) ,
147+ components : {
148+ comp : {
149+ i18n : {
150+ messages : {
151+ en : { } ,
152+ ja : { hello : 'こんにちは' }
153+ }
154+ } ,
155+ render ( h ) {
156+ return h ( 'div' , [
157+ h ( 'p' , { ref : 'el1' } , [ this . $t ( 'hello' ) ] ) ,
158+ h ( 'p' , { ref : 'el2' } , [ this . $t ( 'msg' ) ] )
159+ ] )
160+ }
161+ }
162+ } ,
163+ render ( h ) {
164+ return h ( 'div' , [ h ( 'comp' , { ref : 'comp' } ) ] )
165+ }
166+ } ) . $mount ( )
167+ const el1 = vm . $refs . comp . $refs . el1
168+ const el2 = vm . $refs . comp . $refs . el2
169+ nextTick ( ( ) => {
170+ assert . equal ( el1 . textContent , 'こんにちは' )
171+ assert . equal ( el2 . textContent , 'メッセージ' )
172+ } ) . then ( done )
173+ } )
174+ } )
135175} )
You can’t perform that action at this time.
0 commit comments