✨ Implements localisation
This commit is contained in:
4
src/assets/locales/en-GB.json
Normal file
4
src/assets/locales/en-GB.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"test": "Hello World!",
|
||||||
|
"test2": "Im a fallback"
|
||||||
|
}
|
||||||
29
src/main.js
29
src/main.js
@@ -1,18 +1,25 @@
|
|||||||
|
// Import core framework and essential utils
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import VueI18n from 'vue-i18n'; // i18n for localization
|
||||||
|
|
||||||
/* Import component Vue plugins, used throughout the app */
|
// Import component Vue plugins, used throughout the app
|
||||||
import VTooltip from 'v-tooltip'; // A Vue directive for Popper.js, tooltip component
|
import VTooltip from 'v-tooltip'; // A Vue directive for Popper.js, tooltip component
|
||||||
import VModal from 'vue-js-modal'; // Modal component
|
import VModal from 'vue-js-modal'; // Modal component
|
||||||
import VSelect from 'vue-select'; // Select dropdown component
|
import VSelect from 'vue-select'; // Select dropdown component
|
||||||
import VTabs from 'vue-material-tabs'; // Tab view component, used on the config page
|
import VTabs from 'vue-material-tabs'; // Tab view component, used on the config page
|
||||||
import Toasted from 'vue-toasted'; // Toast component, used to show confirmation notifications
|
import Toasted from 'vue-toasted'; // Toast component, used to show confirmation notifications
|
||||||
|
|
||||||
import { toastedOptions } from '@/utils/defaults';
|
// Import base Dashy components and utils
|
||||||
import Dashy from '@/App.vue';
|
import Dashy from '@/App.vue';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import registerServiceWorker from '@/registerServiceWorker';
|
import registerServiceWorker from '@/registerServiceWorker';
|
||||||
import clickOutside from '@/utils/ClickOutside';
|
import clickOutside from '@/utils/ClickOutside';
|
||||||
|
import { toastedOptions } from '@/utils/defaults';
|
||||||
|
|
||||||
|
// Locales - Import translation files here!
|
||||||
|
import en from '@/assets/locales/en-GB.json';
|
||||||
|
|
||||||
|
Vue.use(VueI18n);
|
||||||
Vue.use(VTooltip);
|
Vue.use(VTooltip);
|
||||||
Vue.use(VModal);
|
Vue.use(VModal);
|
||||||
Vue.use(VTabs);
|
Vue.use(VTabs);
|
||||||
@@ -22,10 +29,20 @@ Vue.directive('clickOutside', clickOutside);
|
|||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
// Setup translations
|
||||||
|
const messages = { en }; // <-- Add new language files here!
|
||||||
|
|
||||||
|
const i18n = new VueI18n({
|
||||||
|
locale: 'en',
|
||||||
|
fallbackLocale: 'en',
|
||||||
|
messages,
|
||||||
|
});
|
||||||
|
|
||||||
// Register Service Worker
|
// Register Service Worker
|
||||||
registerServiceWorker();
|
registerServiceWorker();
|
||||||
|
|
||||||
new Vue({
|
// Render function
|
||||||
router,
|
const render = (awesome) => awesome(Dashy);
|
||||||
render: (awesome) => awesome(Dashy),
|
|
||||||
}).$mount('#app');
|
// All done, now just initialize main Vue app!
|
||||||
|
new Vue({ router, render, i18n }).$mount('#app');
|
||||||
|
|||||||
Reference in New Issue
Block a user