-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor VueI18n creation to own module
This refactors the creation of the VueI18n instance by encapsulating in an own ES module. So the i18n instance can be imported to other pure ES modules and will allow internationalization.
- Loading branch information
1 parent
cda4d70
commit 61b03a4
Showing
2 changed files
with
24 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Creates the VueI18n object used for internationalization. | ||
*/ | ||
import Vue from 'vue'; | ||
import VueI18n from 'vue-i18n'; | ||
import LocaleUtil from '@/util/Locale'; | ||
|
||
Vue.use(VueI18n); | ||
|
||
const appConfig = Vue.prototype.$appConfig; | ||
|
||
const preset = { | ||
locale: LocaleUtil.getPreferredLanguage(appConfig), | ||
fallbackLocale: LocaleUtil.getFallbackLanguage(appConfig), | ||
messages: LocaleUtil.importVueI18nLocales() | ||
}; | ||
|
||
export const i18n = new VueI18n(preset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters