mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
support get current language info
This commit is contained in:
@@ -201,6 +201,16 @@ registerComponents(app);
|
|||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.use(i18n);
|
app.use(i18n);
|
||||||
|
|
||||||
|
function getCurrentLanguageInfo() {
|
||||||
|
const locale = getLanguageInfo(i18n.global.locale);
|
||||||
|
|
||||||
|
if (locale) {
|
||||||
|
return locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDefaultLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
function setLanguage(locale, force) {
|
function setLanguage(locale, force) {
|
||||||
if (!locale) {
|
if (!locale) {
|
||||||
locale = getDefaultLanguage();
|
locale = getDefaultLanguage();
|
||||||
@@ -335,6 +345,7 @@ app.config.globalProperties.$locale = {
|
|||||||
formatTimeToShortYearMonth: (userStore, dateTime) => formatTime(dateTime, getI18nShortYearMonthFormat(i18n.global.t, userStore.currentUserShortDateFormat)),
|
formatTimeToShortYearMonth: (userStore, dateTime) => formatTime(dateTime, getI18nShortYearMonthFormat(i18n.global.t, userStore.currentUserShortDateFormat)),
|
||||||
isLongTime24HourFormat: (userStore) => isLongTime24HourFormat(i18n.global.t, userStore.currentUserLongTimeFormat),
|
isLongTime24HourFormat: (userStore) => isLongTime24HourFormat(i18n.global.t, userStore.currentUserLongTimeFormat),
|
||||||
isShortTime24HourFormat: (userStore) => isShortTime24HourFormat(i18n.global.t, userStore.currentUserShortTimeFormat),
|
isShortTime24HourFormat: (userStore) => isShortTime24HourFormat(i18n.global.t, userStore.currentUserShortTimeFormat),
|
||||||
|
getCurrentLanguageInfo: getCurrentLanguageInfo,
|
||||||
setLanguage: setLanguage,
|
setLanguage: setLanguage,
|
||||||
getTimezone: settings.getTimezone,
|
getTimezone: settings.getTimezone,
|
||||||
setTimezone: setTimezone,
|
setTimezone: setTimezone,
|
||||||
|
|||||||
Reference in New Issue
Block a user