- `;
-
+async function addExtensionSettings() {
+ // Load the HTML template for the settings
+ const settingsHtml = await renderExtensionTemplateAsync(extensionName, 'settings');
$('#extensions_settings2').append(settingsHtml);
// Set up the enable/disable toggle
@@ -210,12 +207,27 @@ function addExtensionSettings() {
// Update Memory Recollection button visibility
updateMemoryRecollectionButton();
});
+
+ // Set up language selector
+ const langSelect = $('#rpg-companion-language-select');
+ if (langSelect.length) {
+ langSelect.val(i18n.currentLanguage);
+ langSelect.on('change', async function() {
+ const selectedLanguage = $(this).val();
+ await i18n.setLanguage(selectedLanguage);
+ // We need to re-apply translations to the settings panel specifically
+ i18n.applyTranslations(document.getElementById('extensions_settings2'));
+ });
+ }
}
/**
* Initializes the UI for the extension.
*/
async function initUI() {
+ // Initialize i18n
+ await i18n.init();
+
// Only initialize UI if extension is enabled
if (!extensionSettings.enabled) {
console.log('[RPG Companion] Extension disabled - skipping UI initialization');
@@ -249,6 +261,9 @@ async function initUI() {
setInventoryContainer($('#rpg-inventory'));
setQuestsContainer($('#rpg-quests'));
+ // Re-apply translations to the entire body to catch all new elements from the template
+ i18n.applyTranslations(document.body);
+
// Set up event listeners (enable/disable is handled in Extensions tab)
$('#rpg-toggle-auto-update').on('change', function() {
extensionSettings.autoUpdate = $(this).prop('checked');
@@ -597,9 +612,15 @@ jQuery(async () => {
console.error('[RPG Companion] Settings load failed, continuing with defaults:', error);
}
+ // 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 {
- addExtensionSettings();
+ await addExtensionSettings();
} catch (error) {
console.error('[RPG Companion] Failed to add extension settings tab:', error);
// Don't throw - extension can still work without settings tab
diff --git a/settings.html b/settings.html
index a6d40ea..98fb41b 100644
--- a/settings.html
+++ b/settings.html
@@ -7,9 +7,18 @@
- Toggle to enable/disable the RPG Companion extension. Configure additional settings within the panel itself.
+
+
+
+
+
+
+ Toggle to enable/disable the RPG Companion extension. Configure additional settings within the panel itself.
- Assets include vehicles (cars, motorcycles), property (homes, apartments),
- and major equipment (workshop tools, special items).
+ ${i18n.getTranslation('inventory.assets.description')}
diff --git a/src/systems/rendering/quests.js b/src/systems/rendering/quests.js
index efaa8da..d122835 100644
--- a/src/systems/rendering/quests.js
+++ b/src/systems/rendering/quests.js
@@ -5,6 +5,7 @@
import { extensionSettings, $questsContainer } from '../../core/state.js';
import { saveSettings } from '../../core/persistence.js';
+import { i18n } from '../../core/i18n.js';
/**
* HTML escape helper
@@ -25,11 +26,11 @@ function escapeHtml(text) {
export function renderQuestsSubTabs(activeTab = 'main') {
return `
';
html += ``;
- html += '';
+ html += ``;
html += '
';
- html += 'If disabled, attributes are only sent when a dice roll is active.';
+ html += `${i18n.getTranslation('template.trackerEditorModal.userStatsTab.alwaysIncludeAttributesNote')}`;
html += '
';
@@ -268,34 +268,34 @@ function renderUserStatsTab() {
});
html += '
';
- html += ' Add Attribute';
+ html += ` ${i18n.getTranslation('template.trackerEditorModal.userStatsTab.addAttributeButton')}`;
// Status Section
- html += '
';
html += ``;
- html += '';
+ html += ``;
html += '
';
- html += '';
+ html += ``;
html += ``;
- html += '';
+ html += ``;
const skillFields = config.skillsSection.customFields || [];
html += ``;
@@ -436,12 +436,12 @@ function renderInfoBoxTab() {
const config = extensionSettings.trackerConfig.infoBox;
let html = '
';
html += ``;
- html += '';
+ html += ``;
html += '
@@ -92,184 +92,184 @@
- RPG Companion Settings
+ RPG Companion Settings
×
-
Theme
+
Theme
-
+
-
+
-
+
-
+
-
+
-
+
- Color when stats are at 0%
+ Color when stats are at 0%
-
+
- Color when stats are at 100%
+ Color when stats are at 100%
-
Display Options
-
+
Display Options
+
Use the Extensions tab to enable/disable the RPG Companion extension.
-
+
-
+
Display character thoughts as overlay bubbles next to their messages
-
+
Auto-expand thought bubble without clicking the icon first
-
+
Smooth transitions for stats, content updates, and dice rolls
-
+
Display buttons above chat input for plot progression prompts
-
+
Shows parser logs in a mobile-friendly UI panel. Useful for troubleshooting. Look for the red bug button.
-
Advanced
+
Advanced
-
+
- Together: Adds RPG tracking to main roleplay. Separate: Generates RPG data separately (manual or auto).
+ Together: Adds RPG tracking to main roleplay. Separate: Generates RPG data separately (manual or auto).
-
+
- Number of recent messages to include (Separate mode only)
+ Number of recent messages to include (Separate mode only)
-
+
- Number of messages to process per batch in Memory Recollection
+ Number of messages to process per batch in Memory Recollection
-
+
Separate mode only. When enabled, tracker generation will use the model from the "RPG Companion Trackers" preset instead of your main API model. The preset will be switched automatically during generation and restored afterward. Select the desired model in that preset and make sure the "Bind presets to API connections" toggle is on (next to the import/export preset buttons).
-
+
-
+
When set, the extension will not inject tracker prompts, examples, or HTML instructions according to the selected mode when a guided generation (via `instruct` or `quiet_prompt`) is detected. Useful when using GuidedGenerations or similar extensions.
-
@@ -292,16 +292,16 @@
- Clear Extension Cache
+ Clear Extension Cache
- Reset Button Positions
+ Reset Button Positions
-
+
Resets all floating action buttons (toggle, refresh, debug) to default top-left positions. Useful if buttons are off-screen.
@@ -375,7 +375,7 @@
- Edit Trackers
+ Edit Trackers
×
@@ -383,13 +383,13 @@
- User Stats
+ User Stats
- Info Box
+ Info Box
- Present Characters
+ Present Characters