Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 导入json以后, 语言没有生效. #4985

Closed
lovitus opened this issue Dec 12, 2024 · 3 comments
Closed

[Bug] 导入json以后, 语言没有生效. #4985

lovitus opened this issue Dec 12, 2024 · 3 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@lovitus
Copy link

lovitus commented Dec 12, 2024

📦 部署环境

Docker

📌 软件版本

latest

💻 系统环境

Ubuntu

🌐 浏览器

Edge, Firefox

🐛 问题描述

系统语言是英文, 默认lobechat也是英文, 在会话里设置为中文以后.
导出数据为json时候,选的全部.
在另一个浏览器导入这个json, 界面依旧是英文, 设置里已经是中文, 刷新也不行. 需要切到其他语言在切回中文才会生效.

是否语言设置不跟随json配置,而且当用户切换才会触发这个事件?

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

@lovitus lovitus added the 🐛 Bug Something isn't working | 缺陷 label Dec 12, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Dec 12, 2024
@lobehubbot
Copy link
Member

👀 @lovitus

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Docker

📌 Software version

latest

💻 System environment

Ubuntu

🌐 Browser

Edge, Firefox

🐛 Problem description

The system language is English, and the default lobechat is also in English. After setting it to Chinese in the session.
When exporting data to json, select all.
Import this json in another browser, the interface is still in English, the settings are already in Chinese, and refreshing does not work. You need to switch to other languages ​​and then switch back to Chinese for it to take effect.

Does the language setting not follow the json configuration, and will this event be triggered only when the user switches?

📷 Steps to reproduce

No response

🚦 Expected results

No response

📝 Supplementary information

No response

Copy link

dosubot bot commented Dec 12, 2024

@lovitus 你好!我是Dosu,一个能够帮助你解决bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的过程中为你提供帮助。

I found a similar open issue titled "[Bug] 导入配置后,语言选项不生效" which might be related to your problem [1]. However, there is no solution found in the comments of that issue.

Regarding your question about whether the language setting follows the JSON configuration, the language change in Lobe Chat is triggered by the languageChanged event in the i18n instance. This event adjusts the text direction of the page whenever the language is changed [2]. When importing a JSON configuration, the setSettings function is triggered, which merges the new settings with the existing ones. To ensure language settings are applied, the switchLocale function should be triggered, which updates the general configuration with the new language and calls switchLang(locale) to apply the language settings [3][4].

It seems that the language setting might not be applied immediately after importing the JSON configuration, and switching to another language and back might be necessary to trigger the language change event.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Copy link

dosubot bot commented Dec 12, 2024

I found some relevant information regarding language settings in Lobe Chat. The switchLocale function is responsible for updating the UI language after importing a JSON file. It updates the general configuration with the new language setting and then calls switchLang(locale) to apply the language change [1].

Additionally, Lobe Chat uses the i18next library with a LanguageDetector to determine which language to display. It checks for a language setting in a cookie (LOBE_LOCALE_COOKIE) and falls back to a default language if none is specified [2].

There are also similar issues that have been reported:

  • An open issue titled "[Bug] 导入配置后,语言选项不生效" discusses a similar problem with language settings not being applied after importing a configuration [3].
  • Another open issue titled "[Bug] 切换语言后,必须重新刷新页面" mentions the need to refresh the page for language changes to take effect [4].

These issues suggest that the language setting might not automatically follow the JSON configuration and may require user interaction to trigger the language change event.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@arvinxx
Copy link
Contributor

arvinxx commented Dec 12, 2024

语言目前应该是没有跟随设置

@arvinxx arvinxx closed this as completed Dec 12, 2024
@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Dec 12, 2024
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The language should currently not follow the setting

@lobehubbot
Copy link
Member

@lovitus

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Done
Development

No branches or pull requests

3 participants