@lobehub/chat 1.141.1 → 1.141.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.141.2](https://github.com/lobehub/lobe-chat/compare/v1.141.1...v1.141.2)
6
+
7
+ <sup>Released on **2025-10-21**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **settings**: Broadcast locale changes and update switchLocale action.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **settings**: Broadcast locale changes and update switchLocale action, closes [#9620](https://github.com/lobehub/lobe-chat/issues/9620) ([0eb02ca](https://github.com/lobehub/lobe-chat/commit/0eb02ca))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.141.1](https://github.com/lobehub/lobe-chat/compare/v1.141.0...v1.141.1)
6
31
 
7
32
  <sup>Released on **2025-10-21**</sup>
@@ -77,6 +77,7 @@ export default class SystemController extends ControllerModule {
77
77
 
78
78
  // æ›´æ–°i18n实例的语言
79
79
  await this.app.i18n.changeLanguage(locale === 'auto' ? app.getLocale() : locale);
80
+ this.app.browserManager.broadcastToAllWindows('localeChanged', { locale });
80
81
 
81
82
  return { success: true };
82
83
  }
package/changelog/v1.json CHANGED
@@ -1,4 +1,9 @@
1
1
  [
2
+ {
3
+ "children": {},
4
+ "date": "2025-10-21",
5
+ "version": "1.141.2"
6
+ },
2
7
  {
3
8
  "children": {
4
9
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.141.1",
3
+ "version": "1.141.2",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -252,7 +252,7 @@
252
252
  "pino": "^9.13.1",
253
253
  "plaiceholder": "^3.0.0",
254
254
  "polished": "^4.3.1",
255
- "posthog-js": "^1.275.1",
255
+ "posthog-js": "~1.278.0",
256
256
  "pure-rand": "^7.0.1",
257
257
  "pwa-install-handler": "^2.6.3",
258
258
  "query-string": "^9.3.1",
@@ -324,7 +324,6 @@
324
324
  "@types/json-schema": "^7.0.15",
325
325
  "@types/lodash": "^4.17.20",
326
326
  "@types/lodash-es": "^4.17.12",
327
- "@types/marked": "^6.0.0",
328
327
  "@types/node": "^22.18.9",
329
328
  "@types/numeral": "^2.0.5",
330
329
  "@types/oidc-provider": "^9.5.0",
@@ -18,6 +18,7 @@ export interface SystemDispatchEvents {
18
18
  }
19
19
 
20
20
  export interface SystemBroadcastEvents {
21
+ localeChanged: (data: { locale: string }) => void;
21
22
  systemThemeChanged: (data: { themeMode: ThemeAppearance }) => void;
22
23
  themeChanged: (data: { themeMode: ThemeMode }) => void;
23
24
  }
@@ -17,6 +17,7 @@ import { useServerConfigStore } from '@/store/serverConfig';
17
17
  import { serverConfigSelectors } from '@/store/serverConfig/selectors';
18
18
  import { useUserStore } from '@/store/user';
19
19
  import { settingsSelectors } from '@/store/user/selectors';
20
+ import { LocaleMode } from '@/types/locale';
20
21
 
21
22
  const Common = memo(() => {
22
23
  const { t } = useTranslation('setting');
@@ -33,6 +34,10 @@ const Common = memo(() => {
33
34
  ]);
34
35
  const [loading, setLoading] = useState(false);
35
36
 
37
+ const handleLangChange = (value: LocaleMode) => {
38
+ switchLocale(value);
39
+ };
40
+
36
41
  if (!(isStatusInit && isUserStateInit))
37
42
  return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
38
43
 
@@ -75,7 +80,7 @@ const Common = memo(() => {
75
80
  children: (
76
81
  <Select
77
82
  defaultValue={language}
78
- onChange={switchLocale}
83
+ onChange={handleLangChange}
79
84
  options={[{ label: t('settingCommon.lang.autoMode'), value: 'auto' }, ...localeOptions]}
80
85
  />
81
86
  ),
@@ -142,4 +147,4 @@ const Common = memo(() => {
142
147
  );
143
148
  });
144
149
 
145
- export default Common;
150
+ export default Common;
@@ -15,7 +15,10 @@ export const useWatchThemeUpdate = () => {
15
15
  s.appState.isMac,
16
16
  ],
17
17
  );
18
- const switchThemeMode = useGlobalStore((s) => s.switchThemeMode);
18
+ const [switchThemeMode, switchLocale] = useGlobalStore((s) => [
19
+ s.switchThemeMode,
20
+ s.switchLocale,
21
+ ]);
19
22
 
20
23
  const theme = useTheme();
21
24
 
@@ -23,6 +26,10 @@ export const useWatchThemeUpdate = () => {
23
26
  switchThemeMode(themeMode, { skipBroadcast: true });
24
27
  });
25
28
 
29
+ useWatchBroadcast('localeChanged', ({ locale }) => {
30
+ switchLocale(locale as any, { skipBroadcast: true });
31
+ });
32
+
26
33
  useWatchBroadcast('systemThemeChanged', ({ themeMode }) => {
27
34
  updateElectronAppState({ systemAppearance: themeMode });
28
35
  });
@@ -22,7 +22,7 @@ const n = setNamespace('g');
22
22
  export interface GlobalGeneralAction {
23
23
  openSessionInNewWindow: (sessionId: string) => Promise<void>;
24
24
  openTopicInNewWindow: (sessionId: string, topicId: string) => Promise<void>;
25
- switchLocale: (locale: LocaleMode) => void;
25
+ switchLocale: (locale: LocaleMode, params?: { skipBroadcast?: boolean }) => void;
26
26
  switchThemeMode: (themeMode: ThemeMode, params?: { skipBroadcast?: boolean }) => void;
27
27
  updateSystemStatus: (status: Partial<SystemStatus>, action?: any) => void;
28
28
  useCheckLatestVersion: (enabledCheck?: boolean) => SWRResponse<string>;
@@ -79,12 +79,12 @@ export const generalActionSlice: StateCreator<
79
79
  }
80
80
  },
81
81
 
82
- switchLocale: (locale) => {
82
+ switchLocale: (locale, { skipBroadcast } = {}) => {
83
83
  get().updateSystemStatus({ language: locale });
84
84
 
85
85
  switchLang(locale);
86
86
 
87
- if (isDesktop) {
87
+ if (isDesktop && !skipBroadcast) {
88
88
  (async () => {
89
89
  try {
90
90
  const { dispatch } = await import('@lobechat/electron-client-ipc');