Vue repro
Base fiddle to create a Vue reproduction
HTML
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-router"></script>
<script src="https://unpkg.com/vue-i18n@6.0.0-alpha.3/dist/vue-i18n.min.js"></script>
<div id="app">
<p>{{ $t('root')}}</p>
<router-link to="/">Go to Sync Component</router-link>
<router-link to="/async">Go to Async Component</router-link>
<router-view></router-view>
</div>
JavaScript
const SyncComponent = {
name: 'sync',
template: '<p>{{ $t("sync")}}</p>'
}
const AsyncComponent = {
name: 'async',
template: '<p>{{ $t("async")}}</p>'
}
const router = new VueRouter({
routes: [
{
path: '/',
name: 'Sync',
component: SyncComponent
},
{
path: '/async',
name: 'Async',
component: function (resolve) {
setTimeout(function () {
resolve(AsyncComponent)
}, 2000)
}
},
{
path: '*',
redirect: '/'
}
]
})
const i18n = new VueI18n({
locale: 'en-US',
messages: {
'en-US': {
root: 'root locale',
sync: 'sync locale',
async: 'async locale'
}
}
})
const vm = new Vue({
el: '#app',
i18n: i18n,
router: router,
data: {
}
})