Implement internationalization (i18n) system for LoRA Manager

- Added i18n support with automatic language detection based on browser settings.
- Implemented translations for English (en) and Simplified Chinese (zh-CN).
- Created utility functions for text replacement in HTML templates and JavaScript.
- Developed a comprehensive translation key structure for various application components.
- Added formatting functions for numbers, dates, and file sizes according to locale.
- Included RTL language support and dynamic updates for DOM elements.
- Created tests to verify the functionality of the i18n system.
This commit is contained in:
Will Miao
2025-08-28 22:22:26 +08:00
parent 4246908f2e
commit f82908221c
18 changed files with 1786 additions and 121 deletions

View File

@@ -5,6 +5,7 @@ import { modalManager } from './ModalManager.js';
import { moveManager } from './MoveManager.js';
import { getModelApiClient } from '../api/modelApiFactory.js';
import { MODEL_TYPES, MODEL_CONFIG } from '../api/apiConfig.js';
import { updateBulkSelectionCount } from '../utils/i18nHelpers.js';
export class BulkManager {
constructor() {
@@ -182,11 +183,10 @@ export class BulkManager {
updateSelectedCount() {
const countElement = document.getElementById('selectedCount');
const currentConfig = MODEL_CONFIG[state.currentPageType];
const displayName = currentConfig?.displayName || 'Models';
if (countElement) {
countElement.textContent = `${state.selectedModels.size} ${displayName.toLowerCase()}(s) selected `;
// Use i18n helper to update the count text
updateBulkSelectionCount(state.selectedModels.size);
const existingCaret = countElement.querySelector('.dropdown-caret');
if (existingCaret) {