mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-11-02 17:53:17 -05:00
i18n
This commit is contained in:
27
src/store/language.js
Normal file
27
src/store/language.js
Normal file
@ -0,0 +1,27 @@
|
||||
import app from '../main';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lang: null,
|
||||
all: [
|
||||
{ name: 'English', code: 'en' },
|
||||
{ name: 'Estonian', code: 'est' },
|
||||
],
|
||||
},
|
||||
mutations: {
|
||||
lang(state, lang) {
|
||||
state.lang = lang;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
changeLanguage({ commit }, lang) {
|
||||
app.$i18n.i18next.changeLanguage(lang.code);
|
||||
app.$router.push({ query: { ...app.$route.query, lang: lang.code } });
|
||||
commit('lang', lang);
|
||||
},
|
||||
initLanguage({ commit, state }, code) {
|
||||
commit('lang', state.all.find(lang => lang.code === code));
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -19,6 +19,7 @@ import teamFields from '@/store/team-fields';
|
||||
import themes from '@/store/themes';
|
||||
import taxes from '@/store/taxes';
|
||||
import data from '@/store/data';
|
||||
import language from '@/store/language';
|
||||
import ClientField from '@/store/models/client-field';
|
||||
import TeamField from '@/store/models/team-field';
|
||||
import InvoiceClientField from '@/store/models/invoice-client-field';
|
||||
@ -58,6 +59,7 @@ export default new Vuex.Store({
|
||||
themes,
|
||||
taxes,
|
||||
data,
|
||||
language,
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
|
||||
Reference in New Issue
Block a user