(() => {
return {
role: 'button',
key: 'language',
eventKey: 'LanguageSettings',
- onClick: () => {
- setOpen(true);
- },
label: (
- enabledLanguages.includes(lang))
+ .map((lang) => {
+ return {
+ label: locale[lang].label,
+ value: lang,
+ };
+ })}
+ defaultValue={i18n.language}
+ onChange={async (lang) => {
+ await api.resource('users').updateProfile({
+ values: {
+ appLang: lang,
+ },
+ });
+ api.auth.setLocale(lang);
+ await i18n.changeLanguage(lang);
+ window.location.reload();
}}
- >
- {t('Language')}{' '}
-
+ />
),
};
- }, [enabledLanguages, i18n, open]);
+ }, [api, enabledLanguages, i18n, t]);
if (enabledLanguages.length < 2) {
return null;
diff --git a/packages/plugins/@nocobase/plugin-theme-editor/src/client/hooks/useThemeSettings.tsx b/packages/plugins/@nocobase/plugin-theme-editor/src/client/hooks/useThemeSettings.tsx
index f4fb2d26ee..034d5324c4 100644
--- a/packages/plugins/@nocobase/plugin-theme-editor/src/client/hooks/useThemeSettings.tsx
+++ b/packages/plugins/@nocobase/plugin-theme-editor/src/client/hooks/useThemeSettings.tsx
@@ -1,6 +1,6 @@
-import { useAPIClient, useCurrentUserContext, useSystemSettings } from '@nocobase/client';
+import { SelectWithTitle, useAPIClient, useCurrentUserContext, useSystemSettings } from '@nocobase/client';
import { error } from '@nocobase/utils/client';
-import { MenuProps, Select } from 'antd';
+import { MenuProps } from 'antd';
import React, { useEffect, useMemo } from 'react';
import { useCurrentThemeId } from '../components/InitializeTheme';
import { useThemeListContext } from '../components/ThemeListProvider';
@@ -77,24 +77,13 @@ function Label() {
}
return (
- {
+ updateUserThemeSettings(value);
}}
- >
- {t('Theme')}
-
+ />
);
}