Add Korean, Russian, and Traditional Chinese translations for LoRA Manager

This commit is contained in:
Will Miao
2025-08-30 11:32:39 +08:00
parent ff4d0f0208
commit 3c9e402bc0
18 changed files with 3141 additions and 26 deletions

View File

@@ -4,6 +4,7 @@ import { state } from '../state/index.js';
import { resetAndReload } from '../api/modelApiFactory.js';
import { setStorageItem, getStorageItem } from '../utils/storageHelpers.js';
import { DOWNLOAD_PATH_TEMPLATES, MAPPABLE_BASE_MODELS, PATH_TEMPLATE_PLACEHOLDERS, DEFAULT_PATH_TEMPLATES } from '../utils/constants.js';
import { switchLanguage } from '../utils/i18nHelpers.js';
export class SettingsManager {
constructor() {
@@ -270,6 +271,13 @@ export class SettingsManager {
// Load default embedding root
await this.loadEmbeddingRoots();
// Load language setting
const languageSelect = document.getElementById('languageSelect');
if (languageSelect) {
const currentLanguage = state.global.settings.language || 'en';
languageSelect.value = currentLanguage;
}
}
async loadLoraRoots() {
@@ -945,6 +953,44 @@ export class SettingsManager {
}
}
async saveLanguageSetting() {
const element = document.getElementById('languageSelect');
if (!element) return;
const selectedLanguage = element.value;
try {
// Update local state
state.global.settings.language = selectedLanguage;
// Save to localStorage
setStorageItem('settings', state.global.settings);
// 保存到后端
const response = await fetch('/api/settings', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
language: selectedLanguage
})
});
if (!response.ok) {
throw new Error('Failed to save language setting to backend');
}
// Switch language immediately
switchLanguage(selectedLanguage);
showToast('Language changed successfully.', 'success');
} catch (error) {
showToast('Failed to change language: ' + error.message, 'error');
}
}
toggleInputVisibility(button) {
const input = button.parentElement.querySelector('input');
const icon = button.querySelector('i');