Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Add Preferences tab to account settings and move language preferences there
Murtaza Nasirbe4c3d614f29
diff --git a/docs/user-guide/settings.md b/docs/user-guide/settings.mdindex 5dd199d5..36cfad5a 100644--- a/docs/user-guide/settings.md+++ b/docs/user-guide/settings.md@@ -12,9 +12,7 @@ The Account Information tab presents a comprehensive view of your profile, statiOn the left side, you'll find fields to update your full name, job title, and company or organization. These details help identify you in collaborative environments and provide context for your recordings. Keeping these current ensures colleagues can recognize your contributions and administrators can manage users effectively.-### Language Preferences--Three distinct language settings shape your entire Speakr experience. The interface language dropdown immediately transforms all menus, buttons, and messages to your chosen language - English, Spanish, French, Chinese, or German. The transcription language field accepts ISO language codes like "en" or "es" to optimize recognition accuracy, though leaving it blank enables automatic detection for multilingual content. The preferred chatbot and summarization language ensures all AI-generated content appears in your chosen language, regardless of the source audio's language.+Language preferences (interface language, default transcription language, and preferred output language) live on the **Preferences** tab. See the [Preferences Tab](#preferences-tab) section below.### Account Statistics@@ -93,6 +91,24 @@ Craft prompts based on how you actually use summaries. Do you extract action iteThe expandable tips section provides guidance on crafting better instructions. Focus on clarity, structure your requests with sections or bullet points, and be specific about the level of detail you need. Remember that your prompt applies to all recordings without tag-specific prompts, so design for versatility.+## Preferences Tab++The Preferences tab is the home for display and editor behaviour settings that should follow you across devices.++### Language Preferences++Three language settings shape your Speakr experience. The interface language dropdown immediately transforms all menus, buttons, and messages to your chosen language; the transcription language field sets a default ISO 639-1 code that the recognition service uses to optimise accuracy when auto-detect is too slow or ambiguous; and the preferred output language controls the language of titles, summaries, and chat responses regardless of the source audio's language. Leaving the transcription language on **Auto-detect** is the right default for multilingual content.++These settings used to live on the Account Information tab. They moved here so all preferences that affect your day-to-day Speakr experience live in one place.++### Transcript Display++**Show timestamps in simple view.** When enabled, a compact `mm:ss` (or `h:mm:ss` for long recordings) timestamp appears next to each speaker label in the simple transcript view, making it easier to navigate long meetings. The bubble view is unaffected. Off by default to keep the existing aesthetic for users who prefer a clean read.++### Transcript Editor++**Auto-save edits in the transcript editor.** When enabled, edits made in the transcript editor are saved automatically a couple of seconds after you stop typing, with a small `Saved` indicator to confirm. When disabled (the default), saves are explicit via the Save buttons or the `Ctrl+S` keyboard shortcut. Auto-save is useful for long editing sessions where the risk of losing work outweighs the predictability of explicit writes.+## Shared Transcripts Tabdiff --git a/src/api/auth.py b/src/api/auth.pyindex 887a9d6e..30c42767 100644--- a/src/api/auth.py+++ b/src/api/auth.py@@ -565,17 +565,24 @@ def account():# Check if this is the account information form (has user_name field)if 'user_name' in request.form:- # Handle personal information updates+ # Handle personal information updates only -- language preferences+ # have moved to the Preferences tab and are handled below.user_name = request.form.get('user_name')user_job_title = request.form.get('user_job_title')user_company = request.form.get('user_company')- ui_lang = request.form.get('ui_language')- transcription_lang = request.form.get('transcription_language')- output_lang = request.form.get('output_language')current_user.name = user_name if user_name else Nonecurrent_user.job_title = user_job_title if user_job_title else Nonecurrent_user.company = user_company if user_company else None++ # Check if this is the preferences form (UI/display + language settings)+ elif 'preferences_form' in request.form:+ current_user.show_timestamps_simple_view = 'show_timestamps_simple_view' in request.form+ current_user.editor_autosave = 'editor_autosave' in request.form++ ui_lang = request.form.get('ui_language')+ transcription_lang = request.form.get('transcription_language')+ output_lang = request.form.get('output_language')current_user.ui_language = ui_lang if ui_lang else 'en'# Normalize transcription_language so legacy display-name values# ("Français", "Deutsch", ...) can't reach the ASR call (issue #256).diff --git a/static/locales/en.json b/static/locales/en.jsonindex 0057d5e3..1b815095 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -112,6 +112,7 @@"customPrompts": "Custom Prompts","folderManagement": "Folder Management","namingTemplates": "Naming",+ "preferences": "Preferences","promptOptions": "Prompt Options","sharedTranscripts": "Shared Transcripts","speakersManagement": "Speakers Management",@@ -1148,6 +1149,15 @@"saveNotes": "Save Notes","title": "Notes"},+ "preferences": {+ "description": "Display and editor behaviour preferences. These settings are saved to your account and apply across devices.",+ "editorAutosave": "Auto-save edits in the transcript editor",+ "editorAutosaveHelp": "When enabled, edits in the transcript editor are saved automatically a couple of seconds after you stop typing. When disabled (default), you save explicitly via the Save buttons or Ctrl+S.",+ "showTimestampsSimpleView": "Show timestamps in simple view",+ "showTimestampsSimpleViewHelp": "Display a compact mm:ss timestamp next to each speaker label in the simple transcript view. The bubble view is unaffected.",+ "transcriptDisplay": "Transcript display",+ "transcriptEditor": "Transcript editor"+ },"pwa": {"installApp": "Install App","installed": "Installed successfully",diff --git a/templates/account.html b/templates/account.htmlindex 80dd7db4..21ae04dd 100644--- a/templates/account.html+++ b/templates/account.html@@ -453,6 +453,9 @@<a href="#" id="tab-prompts" class="inline-flex items-center whitespace-nowrap py-1 px-1.5 sm:py-3 sm:px-3 border-b-2 font-medium text-xs sm:text-sm border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)] rounded-t-md sm:rounded-t-lg hover:bg-[var(--bg-tertiary)]"><i class="fas fa-cog mr-0.5 sm:mr-2 text-xs sm:text-sm"></i><span data-i18n="accountTabs.promptOptions">Prompts</span></a>+ <a href="#" id="tab-preferences" class="inline-flex items-center whitespace-nowrap py-1 px-1.5 sm:py-3 sm:px-3 border-b-2 font-medium text-xs sm:text-sm border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)] rounded-t-md sm:rounded-t-lg hover:bg-[var(--bg-tertiary)]">+ <i class="fas fa-sliders-h mr-0.5 sm:mr-2 text-xs sm:text-sm"></i><span data-i18n="accountTabs.preferences">Preferences</span>+ </a><a href="#" id="tab-shares" class="inline-flex items-center whitespace-nowrap py-1 px-1.5 sm:py-3 sm:px-3 border-b-2 font-medium text-xs sm:text-sm border-transparent text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:border-[var(--border-secondary)] rounded-t-md sm:rounded-t-lg hover:bg-[var(--bg-tertiary)]"><i class="fas fa-share-alt mr-0.5 sm:mr-2 text-xs sm:text-sm"></i><span data-i18n="accountTabs.sharedTranscripts">Shares</span></a>@@ -515,56 +518,6 @@</div></div>- <div class="mb-6">- <h3 class="text-lg font-medium text-[var(--text-secondary)] mb-2" data-i18n="account.languagePreferences">Language Preferences</h3>- <div class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)] space-y-4">- <div>- <label for="ui_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.interfaceLanguage">Interface Language</label>- <select name="ui_language" id="ui_language" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">- <option value="en" {% if current_user.ui_language == 'en' or not current_user.ui_language %}selected{% endif %}>English</option>- <option value="zh" {% if current_user.ui_language == 'zh' %}selected{% endif %}>中文 (Chinese)</option>- <option value="de" {% if current_user.ui_language == 'de' %}selected{% endif %}>Deutsch (German)</option>- <option value="es" {% if current_user.ui_language == 'es' %}selected{% endif %}>Español (Spanish)</option>- <option value="fr" {% if current_user.ui_language == 'fr' %}selected{% endif %}>Français (French)</option>- <option value="ru" {% if current_user.ui_language == 'ru' %}selected{% endif %}>Русский (Russian)</option>- </select>- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.chooseLanguageForInterface">Choose the language for the application interface.</p>- </div>- <div>- <label for="transcription_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.transcriptionLanguage">Transcription Language</label>- <select name="transcription_language" id="transcription_language" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">- <option value="" {% if not current_user.transcription_language %}selected{% endif %}>Auto-detect</option>- <option value="en" {% if current_user.transcription_language == 'en' %}selected{% endif %}>English</option>- <option value="es" {% if current_user.transcription_language == 'es' %}selected{% endif %}>Spanish</option>- <option value="fr" {% if current_user.transcription_language == 'fr' %}selected{% endif %}>French</option>- <option value="de" {% if current_user.transcription_language == 'de' %}selected{% endif %}>German</option>- <option value="it" {% if current_user.transcription_language == 'it' %}selected{% endif %}>Italian</option>- <option value="pt" {% if current_user.transcription_language == 'pt' %}selected{% endif %}>Portuguese</option>- <option value="nl" {% if current_user.transcription_language == 'nl' %}selected{% endif %}>Dutch</option>- <option value="ru" {% if current_user.transcription_language == 'ru' %}selected{% endif %}>Russian</option>- <option value="zh" {% if current_user.transcription_language == 'zh' %}selected{% endif %}>Chinese</option>- <option value="ja" {% if current_user.transcription_language == 'ja' %}selected{% endif %}>Japanese</option>- <option value="ko" {% if current_user.transcription_language == 'ko' %}selected{% endif %}>Korean</option>- <option value="ar" {% if current_user.transcription_language == 'ar' %}selected{% endif %}>Arabic</option>- <option value="hi" {% if current_user.transcription_language == 'hi' %}selected{% endif %}>Hindi</option>- <option value="pl" {% if current_user.transcription_language == 'pl' %}selected{% endif %}>Polish</option>- <option value="uk" {% if current_user.transcription_language == 'uk' %}selected{% endif %}>Ukrainian</option>- <option value="vi" {% if current_user.transcription_language == 'vi' %}selected{% endif %}>Vietnamese</option>- <option value="th" {% if current_user.transcription_language == 'th' %}selected{% endif %}>Thai</option>- <option value="tr" {% if current_user.transcription_language == 'tr' %}selected{% endif %}>Turkish</option>- <option value="id" {% if current_user.transcription_language == 'id' %}selected{% endif %}>Indonesian</option>- <option value="sv" {% if current_user.transcription_language == 'sv' %}selected{% endif %}>Swedish</option>- </select>- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.leaveBlankForAutoDetect">Select auto-detect to let the transcription service determine the language.</p>- </div>- <div>- <label for="output_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.preferredOutputLanguage">Preferred Output Language</label>- <input type="text" name="output_language" id="output_language" value="{{ current_user.output_language or '' }}" placeholder="e.g., English, Spanish, Chinese" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">- <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.languageForSummaries">Language for titles, summaries, and chat. Leave blank for default (default behavior of your chosen model).</p>- </div>- </div>- </div>-<button type="submit" class="w-full inline-flex items-center justify-center px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200"><i class="fas fa-save mr-2"></i> <span data-i18n="account.saveAllPreferences">Save All Preferences</span></button>@@ -831,6 +784,87 @@</form></div>+ <div id="content-preferences" class="hidden tab-content pt-6">+ <h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-2" data-i18n="accountTabs.preferences">Preferences</h2>+ <p class="text-sm text-[var(--text-muted)] mb-6" data-i18n="preferences.description">Display and editor behaviour preferences. These settings are saved to your account and apply across devices.</p>++ <form id="preferencesForm" class="space-y-4 max-w-2xl">+ <input type="hidden" name="preferences_form" value="1">++ <h3 class="text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wide" data-i18n="account.languagePreferences">Language Preferences</h3>+ <div class="space-y-4 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md">+ <div>+ <label for="ui_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.interfaceLanguage">Interface Language</label>+ <select name="ui_language" id="ui_language" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">+ <option value="en" {% if current_user.ui_language == 'en' or not current_user.ui_language %}selected{% endif %}>English</option>+ <option value="zh" {% if current_user.ui_language == 'zh' %}selected{% endif %}>中文 (Chinese)</option>+ <option value="de" {% if current_user.ui_language == 'de' %}selected{% endif %}>Deutsch (German)</option>+ <option value="es" {% if current_user.ui_language == 'es' %}selected{% endif %}>Español (Spanish)</option>+ <option value="fr" {% if current_user.ui_language == 'fr' %}selected{% endif %}>Français (French)</option>+ <option value="ru" {% if current_user.ui_language == 'ru' %}selected{% endif %}>Русский (Russian)</option>+ </select>+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.chooseLanguageForInterface">Choose the language for the application interface.</p>+ </div>+ <div>+ <label for="transcription_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.transcriptionLanguage">Transcription Language</label>+ <select name="transcription_language" id="transcription_language" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">+ <option value="" {% if not current_user.transcription_language %}selected{% endif %}>Auto-detect</option>+ <option value="en" {% if current_user.transcription_language == 'en' %}selected{% endif %}>English</option>+ <option value="es" {% if current_user.transcription_language == 'es' %}selected{% endif %}>Spanish</option>+ <option value="fr" {% if current_user.transcription_language == 'fr' %}selected{% endif %}>French</option>+ <option value="de" {% if current_user.transcription_language == 'de' %}selected{% endif %}>German</option>+ <option value="it" {% if current_user.transcription_language == 'it' %}selected{% endif %}>Italian</option>+ <option value="pt" {% if current_user.transcription_language == 'pt' %}selected{% endif %}>Portuguese</option>+ <option value="nl" {% if current_user.transcription_language == 'nl' %}selected{% endif %}>Dutch</option>+ <option value="ru" {% if current_user.transcription_language == 'ru' %}selected{% endif %}>Russian</option>+ <option value="zh" {% if current_user.transcription_language == 'zh' %}selected{% endif %}>Chinese</option>+ <option value="ja" {% if current_user.transcription_language == 'ja' %}selected{% endif %}>Japanese</option>+ <option value="ko" {% if current_user.transcription_language == 'ko' %}selected{% endif %}>Korean</option>+ <option value="ar" {% if current_user.transcription_language == 'ar' %}selected{% endif %}>Arabic</option>+ <option value="hi" {% if current_user.transcription_language == 'hi' %}selected{% endif %}>Hindi</option>+ <option value="pl" {% if current_user.transcription_language == 'pl' %}selected{% endif %}>Polish</option>+ <option value="uk" {% if current_user.transcription_language == 'uk' %}selected{% endif %}>Ukrainian</option>+ <option value="vi" {% if current_user.transcription_language == 'vi' %}selected{% endif %}>Vietnamese</option>+ <option value="th" {% if current_user.transcription_language == 'th' %}selected{% endif %}>Thai</option>+ <option value="tr" {% if current_user.transcription_language == 'tr' %}selected{% endif %}>Turkish</option>+ <option value="id" {% if current_user.transcription_language == 'id' %}selected{% endif %}>Indonesian</option>+ <option value="sv" {% if current_user.transcription_language == 'sv' %}selected{% endif %}>Swedish</option>+ </select>+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.leaveBlankForAutoDetect">Select auto-detect to let the transcription service determine the language.</p>+ </div>+ <div>+ <label for="output_language" class="block text-sm font-medium text-[var(--text-muted)]" data-i18n="account.preferredOutputLanguage">Preferred Output Language</label>+ <input type="text" name="output_language" id="output_language" value="{{ current_user.output_language or '' }}" placeholder="e.g., English, Spanish, Chinese" class="mt-1 block w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)]">+ <p class="text-xs text-[var(--text-light)] mt-1" data-i18n="account.languageForSummaries">Language for titles, summaries, and chat. Leave blank for default (default behavior of your chosen model).</p>+ </div>+ </div>++ <h3 class="text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wide pt-4" data-i18n="preferences.transcriptDisplay">Transcript display</h3>+ <label class="flex items-start gap-3 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]">+ <input type="checkbox" id="prefShowTimestampsSimpleView" name="show_timestamps_simple_view" {% if current_user.show_timestamps_simple_view %}checked{% endif %} class="mt-1 h-4 w-4 text-[var(--text-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)] bg-[var(--bg-input)]">+ <span class="flex-1">+ <span class="block text-sm font-medium text-[var(--text-primary)]" data-i18n="preferences.showTimestampsSimpleView">Show timestamps in simple view</span>+ <span class="block text-xs text-[var(--text-muted)] mt-0.5" data-i18n="preferences.showTimestampsSimpleViewHelp">Display a compact <code>mm:ss</code> timestamp next to each speaker label in the simple transcript view. The bubble view is unaffected.</span>+ </span>+ </label>++ <h3 class="text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wide pt-4" data-i18n="preferences.transcriptEditor">Transcript editor</h3>+ <label class="flex items-start gap-3 p-3 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md cursor-pointer hover:bg-[var(--bg-accent-hover)]">+ <input type="checkbox" id="prefEditorAutosave" name="editor_autosave" {% if current_user.editor_autosave %}checked{% endif %} class="mt-1 h-4 w-4 text-[var(--text-accent)] border-[var(--border-secondary)] rounded focus:ring-[var(--border-focus)] bg-[var(--bg-input)]">+ <span class="flex-1">+ <span class="block text-sm font-medium text-[var(--text-primary)]" data-i18n="preferences.editorAutosave">Auto-save edits in the transcript editor</span>+ <span class="block text-xs text-[var(--text-muted)] mt-0.5" data-i18n="preferences.editorAutosaveHelp">When enabled, edits in the transcript editor are saved automatically a couple of seconds after you stop typing. When disabled (default), you save explicitly via the Save buttons or <code>Ctrl+S</code>.</span>+ </span>+ </label>++ <div class="flex justify-end pt-2">+ <button type="submit" class="inline-flex items-center px-4 py-2 bg-[var(--bg-button)] text-[var(--text-button)] rounded-md hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)] transition-colors duration-200">+ <i class="fas fa-save mr-2"></i> <span data-i18n="buttons.saveSettings">Save Settings</span>+ </button>+ </div>+ </form>+ </div>+<div id="content-shares" class="hidden tab-content pt-6"><h2 class="text-2xl font-semibold text-[var(--text-primary)] mb-6" data-i18n="accountTabs.sharedTranscripts">Shared Transcripts</h2><div id="shares-container" class="space-y-4">@@ -2800,8 +2834,10 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coconst tabTemplates = document.getElementById('tab-templates');const tabTokens = document.getElementById('tab-tokens');const tabAbout = document.getElementById('tab-about');+ const tabPreferences = document.getElementById('tab-preferences');const contentAccount = document.getElementById('content-account');const contentPrompts = document.getElementById('content-prompts');+ const contentPreferences = document.getElementById('content-preferences');const contentShares = document.getElementById('content-shares');const contentSpeakers = document.getElementById('content-speakers');const contentFolders = document.getElementById('content-folders');@@ -2818,6 +2854,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coconst tabs = [{ tab: tabAccount, content: contentAccount, name: 'account' },{ tab: tabPrompts, content: contentPrompts, name: 'prompts' },+ { tab: tabPreferences, content: contentPreferences, name: 'preferences' },{ tab: tabShares, content: contentShares, name: 'shares' },{ tab: tabSpeakers, content: contentSpeakers, name: 'speakers' },{ tab: tabFolders, content: contentFolders, name: 'folders' },@@ -5823,6 +5860,29 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co});}+ // AJAX form submission for Preferences+ const preferencesForm = document.getElementById('preferencesForm');+ if (preferencesForm) {+ preferencesForm.addEventListener('submit', async (e) => {+ e.preventDefault();+ const formData = new FormData(preferencesForm);+ try {+ const response = await fetch('/account', {+ method: 'POST',+ headers: { 'X-Requested-With': 'XMLHttpRequest' },+ body: formData,+ });+ if (response.ok) {+ showToast('Preferences saved', 'success');+ } else {+ showToast('Failed to save preferences', 'error');+ }+ } catch (error) {+ showToast('Network error: ' + error.message, 'error');+ }+ });+ }+// AJAX form submission for Custom Promptsconst customPromptsForm = document.getElementById('customPromptsForm');if (customPromptsForm) {