mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
fix(web): validate stored language against supported locales
Drop the dead zh-CN/zh-TW Element locale imports, resolve any stored language only when it is in supportedLanguages (else fall back to en), and generalize the language-code tooltip example from zh-CN to en-US.
This commit is contained in:
parent
e786e948ec
commit
302ed23055
2 changed files with 12 additions and 13 deletions
|
|
@ -6,7 +6,7 @@ export default {
|
|||
'login.requiredMobile': 'Please enter a valid mobile phone number',
|
||||
'login.loginSuccess': 'Login successful!',
|
||||
|
||||
// HeaderBar组件文本
|
||||
// HeaderBar component text
|
||||
'header.smartManagement': 'Agents',
|
||||
'header.modelConfig': 'Models',
|
||||
'header.knowledgeBase': 'Knowledge',
|
||||
|
|
@ -17,7 +17,7 @@ export default {
|
|||
'header.paramDictionary': 'More',
|
||||
'header.paramManagement': 'Params Management',
|
||||
'header.dictManagement': 'Dict Management',
|
||||
'header.agentTemplate': 'Default Role Templates', // 添加这一行
|
||||
'header.agentTemplate': 'Default Role Templates', // Add this line
|
||||
'header.searchHistory': 'Search History',
|
||||
'header.clearHistory': 'Clear History',
|
||||
'header.providerManagement': 'Provider Management',
|
||||
|
|
@ -31,10 +31,10 @@ export default {
|
|||
// McpToolCallDialog component text
|
||||
'mcpToolCall.title': 'Tool Call',
|
||||
'mcpToolCall.execute': 'Execute',
|
||||
'mcpToolCall.chooseFunction': '1、Choose Function',
|
||||
'mcpToolCall.chooseFunction': '1,Choose Function',
|
||||
'mcpToolCall.searchFunction': 'Search Function',
|
||||
'mcpToolCall.noResults': 'No matching functions found',
|
||||
'mcpToolCall.settings': '2、Parameter Settings',
|
||||
'mcpToolCall.settings': '2,Parameter Settings',
|
||||
'mcpToolCall.inputPlaceholder': 'Please enter {label}',
|
||||
'mcpToolCall.valueRange': 'Value range: {min} - {max}',
|
||||
'mcpToolCall.selectPlaceholder': 'Please select {label}',
|
||||
|
|
@ -46,7 +46,7 @@ export default {
|
|||
'mcpToolCall.minValue': 'Minimum value is {value}',
|
||||
'mcpToolCall.maxValue': 'Maximum value is {value}',
|
||||
'mcpToolCall.selectTool': 'Please select a tool to execute',
|
||||
'mcpToolCall.executionResult': '3、Execution Result',
|
||||
'mcpToolCall.executionResult': '3,Execution Result',
|
||||
'mcpToolCall.copyResult': 'Copy Result',
|
||||
'mcpToolCall.noResultYet': 'No result yet',
|
||||
'mcpToolCall.loadingToolList': 'Loading tool list...',
|
||||
|
|
@ -714,8 +714,8 @@ export default {
|
|||
'common.copyAddress': 'Copy address',
|
||||
|
||||
// Language switch
|
||||
'language.zhCN': '中文简体',
|
||||
'language.zhTW': '中文繁體',
|
||||
'language.zhCN': 'Simplified Chinese',
|
||||
'language.zhTW': 'Traditional Chinese',
|
||||
'language.en': 'English',
|
||||
'language.de': 'Deutsch',
|
||||
'language.vi': 'Tiếng Việt',
|
||||
|
|
@ -1011,7 +1011,7 @@ export default {
|
|||
'roleConfig.tooltip.contextProvider': 'When XiaoZhi is awakened, fetch external system data and dynamically inject it into the LLM system prompt',
|
||||
'roleConfig.tooltip.roleIntroduction': 'Define the AI agent\'s role positioning, personality traits, behavioral norms, and professional knowledge background',
|
||||
'roleConfig.tooltip.memoryHis': 'Summarize chat record content',
|
||||
'roleConfig.tooltip.languageCode': 'Set language code such as zh-CN, en-US, etc., used for specific feature recognition',
|
||||
'roleConfig.tooltip.languageCode': 'Set a BCP-47 language code such as en-US, used for specific feature recognition',
|
||||
'roleConfig.tooltip.interactionLanguage': 'Set the interaction language, specifying the primary language the AI agent uses for communication',
|
||||
'roleConfig.tooltip.vad': 'Voice Activity Detection: Detects when the user starts or stops speaking, used to determine conversation start and end, enabling interrupt functionality',
|
||||
'roleConfig.tooltip.asr': 'Automatic Speech Recognition: Converts user speech to text, the first step in human-computer dialogue, supporting multilingual recognition',
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import vi from './vi';
|
|||
import ptBR from './pt_BR';
|
||||
|
||||
import enLocale from 'element-ui/lib/locale/lang/en'
|
||||
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
||||
import twLocale from 'element-ui/lib/locale/lang/zh-TW'
|
||||
import deLocale from 'element-ui/lib/locale/lang/de'
|
||||
import viLocale from 'element-ui/lib/locale/lang/vi'
|
||||
import ptBRLocale from 'element-ui/lib/locale/lang/pt-br'
|
||||
|
|
@ -31,10 +29,11 @@ export const getLanguageLabelKey = (lang) => {
|
|||
const getDefaultLanguage = () => {
|
||||
const savedLang = localStorage.getItem('userLanguage');
|
||||
if (savedLang) {
|
||||
if (savedLang === 'zh_CN' || savedLang === 'zh_TW') {
|
||||
return 'en';
|
||||
// Legacy installs may have stored a language this fork no longer ships.
|
||||
if (supportedLanguages.some((item) => item.code === savedLang)) {
|
||||
return savedLang;
|
||||
}
|
||||
return savedLang;
|
||||
return 'en';
|
||||
}
|
||||
const browserLang = navigator.language || navigator.userLanguage;
|
||||
if (browserLang.indexOf('de') === 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue