Skip to content

Commit

Permalink
fix: Require loadLanguageAsync only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgv committed Feb 21, 2018
1 parent b066266 commit 2b8cd9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/templates/i18n.plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import { loadLanguageAsync } from './i18n.utils'

Vue.use(VueI18n)

Expand All @@ -24,6 +23,7 @@ export default ({ app, route, error }) => {
}
app.i18n.locale = locale
if (<%= options.loadLanguagesAsync %>) {
const { loadLanguageAsync } = require('./i18n.utils')
loadLanguageAsync(app.i18n, app.i18n.locale)
}
}
2 changes: 1 addition & 1 deletion lib/templates/i18n.routing.middleware.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import middleware from './middleware'
import { loadLanguageAsync } from './i18n.utils'

middleware['i18n'] = function ({ app, route, redirect, error, hotReload }) {
const locales = <%= JSON.stringify(options.locales) %>
Expand Down Expand Up @@ -28,6 +27,7 @@ middleware['i18n'] = function ({ app, route, redirect, error, hotReload }) {
}
if (locale === app.i18n.locale) return
if (<%= options.loadLanguagesAsync %>) {
const { loadLanguageAsync } = require('./i18n.utils')
loadLanguageAsync(app.i18n, locale)
.then(() => {
app.i18n.locale = locale
Expand Down

0 comments on commit 2b8cd9e

Please sign in to comment.