mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 05:32:12 -03:00
- 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.
56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
import { appCore } from './core.js';
|
|
import { confirmDelete, closeDeleteModal, confirmExclude, closeExcludeModal } from './utils/modalUtils.js';
|
|
import { createPageControls } from './components/controls/index.js';
|
|
import { EmbeddingContextMenu } from './components/ContextMenu/index.js';
|
|
import { ModelDuplicatesManager } from './components/ModelDuplicatesManager.js';
|
|
import { MODEL_TYPES } from './api/apiConfig.js';
|
|
import { initializePageI18n } from './utils/i18nHelpers.js';
|
|
|
|
// Initialize the Embeddings page
|
|
class EmbeddingsPageManager {
|
|
constructor() {
|
|
// Initialize page controls
|
|
this.pageControls = createPageControls(MODEL_TYPES.EMBEDDING);
|
|
|
|
// Initialize the ModelDuplicatesManager
|
|
this.duplicatesManager = new ModelDuplicatesManager(this, MODEL_TYPES.EMBEDDING);
|
|
|
|
// Expose only necessary functions to global scope
|
|
this._exposeRequiredGlobalFunctions();
|
|
}
|
|
|
|
_exposeRequiredGlobalFunctions() {
|
|
// Minimal set of functions that need to remain global
|
|
window.confirmDelete = confirmDelete;
|
|
window.closeDeleteModal = closeDeleteModal;
|
|
window.confirmExclude = confirmExclude;
|
|
window.closeExcludeModal = closeExcludeModal;
|
|
|
|
// Expose duplicates manager
|
|
window.modelDuplicatesManager = this.duplicatesManager;
|
|
}
|
|
|
|
async initialize() {
|
|
// Initialize context menu
|
|
new EmbeddingContextMenu();
|
|
|
|
// Initialize common page features
|
|
appCore.initializePageFeatures();
|
|
|
|
// Initialize i18n for the page
|
|
initializePageI18n();
|
|
|
|
console.log('Embeddings Manager initialized');
|
|
}
|
|
}
|
|
|
|
// Initialize everything when DOM is ready
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
// Initialize core application
|
|
await appCore.initialize();
|
|
|
|
// Initialize embeddings page
|
|
const embeddingsPage = new EmbeddingsPageManager();
|
|
await embeddingsPage.initialize();
|
|
});
|