The processing of the Separate button was missing and has been added. Dynamic update logic centralized

This commit is contained in:
Mingyu
2025-11-26 21:46:59 +08:00
committed by GitHub
parent 691586ce2f
commit f38bddec62
6 changed files with 66 additions and 46 deletions
+23 -1
View File
@@ -105,7 +105,8 @@ import {
setupMobileTabs,
removeMobileTabs,
setupMobileKeyboardHandling,
setupContentEditableScrolling
setupContentEditableScrolling,
updateMobileTabLabels
} from './src/systems/ui/mobile.js';
import {
setupDesktopTabs,
@@ -153,6 +154,24 @@ import {
// (setupMobileToggle, constrainFabToViewport, setupMobileTabs, removeMobileTabs,
// setupMobileKeyboardHandling, setupContentEditableScrolling)
/**
* Updates UI elements that are dynamically generated and not covered by data-i18n-key.
*/
function updateDynamicLabels() {
// Update "Refresh RPG Info" button, but only if it's not disabled
const refreshBtn = document.getElementById('rpg-manual-update');
if (refreshBtn && !refreshBtn.disabled) {
const refreshText = i18n.getTranslation('template.mainPanel.refreshRpgInfo') || 'Refresh RPG Info';
refreshBtn.innerHTML = `<i class="fa-solid fa-sync"></i> ${refreshText}`;
}
// Update "Last Roll" label
updateDiceDisplay();
// Update mobile tab labels
updateMobileTabLabels();
}
/**
* Adds the extension settings to the Extensions tab.
*/
@@ -596,6 +615,9 @@ jQuery(async () => {
// Initialize i18n early for the settings panel
await i18n.init();
// Set up a central listener for language changes to update dynamic UI parts
i18n.addEventListener('languageChanged', updateDynamicLabels);
// Add extension settings to Extensions tab
try {
await addExtensionSettings();