Skip to content

Commit

Permalink
feat(loadLanguageAsync): Support promises return in lang files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezypeeze committed May 28, 2018
1 parent 2f22ab4 commit 9b220c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/templates/utils.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function loadLanguageAsync (i18n, locale) {
try {
const module = await import(/* webpackChunkName: "lang-[request]" */ '~/<%= options.langDir %>' + file)
const messages = module.default ? module.default : module
i18n.setLocaleMessage(locale, messages)
i18n.setLocaleMessage(locale, typeof messages === 'function' ? await Promise.resolve(messages()) : messages)
i18n.loadedLanguages.push(locale)
return messages
} catch (error) {
Expand Down

0 comments on commit 9b220c3

Please sign in to comment.