Add i18n support (#7)

This commit is contained in:
AceDataCloud committed 2024-03-24 11:49:35 +08:00
1 parent 7d5dc8965e
commit 7b292b104c
368 files changed
+19351 -1420

No files matched your search

+6
View File
@@ -2,6 +2,7 @@ import { ActionContext } from 'vuex';
import { IRootState } from '../common/models';
import { userOperator, oauthOperator } from '@/operators';
import { log } from '@/utils/log';
import { IToken, IUser } from '@/models';
export const resetAll = ({ commit }: ActionContext<IRootState, IRootState>) => {
commit('resetToken');
@@ -24,6 +25,10 @@ export const setToken = ({ commit }: ActionContext<IRootState, IRootState>, payl
commit('setToken', payload);
};
export const setLocale = ({ commit }: ActionContext<IRootState, IRootState>, payload: string) => {
commit('setLocale', payload);
};
export const setUser = ({ commit }: ActionContext<IRootState, IRootState>, payload: IUser) => {
commit('setUser', payload);
};
@@ -52,6 +57,7 @@ export const getToken = async ({ commit }: ActionContext<IRootState, IRootState>
};
export default {
setLocale,
resetToken,
resetAll,
resetUser,
+5
View File
@@ -8,6 +8,10 @@ export const user = (state: IRootState): any => {
return state.user;
};
export const locale = (state: IRootState): string => {
return state.locale;
};
export const token = (state: IRootState): any => {
return state.token;
};
@@ -17,6 +21,7 @@ export const setting = (state: IRootState): any => {
};
export default {
locale,
authenticated,
user,
token,
+1
View File
@@ -11,6 +11,7 @@ export interface ICommonState {
token: IToken;
user: IUser;
setting?: ISetting;
locale: string;
}
export interface IRootState extends ICommonState {
+5
View File
@@ -8,6 +8,10 @@ export const setUser = (state: IRootState, payload: IUser): void => {
};
};
export const setLocale = (state: IRootState, payload: string): void => {
state.locale = payload;
};
export const setToken = (state: IRootState, payload: any): void => {
state.token = {
...state.token,
@@ -35,6 +39,7 @@ export const setSetting = (state: IRootState, payload: any): void => {
};
export default {
setLocale,
setUser,
resetUser,
setToken,