Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Add complete i18n support for settings screens (shared transcripts, speakers, tags, templates)
Murtaza Nasir94b2f22a6bdc
diff --git a/static/js/app.js b/static/js/app.jsindex 35cf8e25..6cebd506 100644--- a/static/js/app.js+++ b/static/js/app.js@@ -4312,19 +4312,19 @@ document.addEventListener('DOMContentLoaded', async () => {modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';modal.innerHTML = `<div class="bg-[var(--bg-secondary)] rounded-lg p-6 max-w-md w-full mx-4">- <h3 class="text-lg font-semibold mb-4">Select Template</h3>+ <h3 class="text-lg font-semibold mb-4">${t('transcriptTemplates.selectTemplate')}</h3><div class="space-y-2 max-h-60 overflow-y-auto">- ${templates.map(t => `- <button class="template-option w-full text-left p-3 rounded border border-[var(--border-primary)] hover:bg-[var(--bg-tertiary)] ${t.is_default ? 'ring-2 ring-[var(--ring-focus)]' : ''}" data-template-id="${t.id}">- <div class="font-medium">${t.name}</div>- ${t.description ? `<div class="text-sm text-[var(--text-muted)]">${t.description}</div>` : ''}- ${t.is_default ? '<div class="text-xs text-[var(--text-accent)] mt-1"><i class="fas fa-star mr-1"></i>Default</div>' : ''}+ ${templates.map(tmpl => `+ <button class="template-option w-full text-left p-3 rounded border border-[var(--border-primary)] hover:bg-[var(--bg-tertiary)] ${tmpl.is_default ? 'ring-2 ring-[var(--ring-focus)]' : ''}" data-template-id="${tmpl.id}">+ <div class="font-medium">${tmpl.name}</div>+ ${tmpl.description ? `<div class="text-sm text-[var(--text-muted)]">${tmpl.description}</div>` : ''}+ ${tmpl.is_default ? `<div class="text-xs text-[var(--text-accent)] mt-1"><i class="fas fa-star mr-1"></i>${t('transcriptTemplates.default')}</div>` : ''}</button>`).join('')}</div><div class="mt-4 flex gap-2">- <button class="cancel-btn px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded hover:bg-[var(--bg-accent-light)]">Cancel</button>- <button class="download-without-template-btn px-4 py-2 bg-[var(--bg-accent)] text-white rounded hover:bg-[var(--bg-accent-hover)]">Download without template</button>+ <button class="cancel-btn px-4 py-2 bg-[var(--bg-tertiary)] text-[var(--text-secondary)] rounded hover:bg-[var(--bg-accent-light)]">${t('transcriptTemplates.cancel')}</button>+ <button class="download-without-template-btn px-4 py-2 bg-[var(--bg-accent)] text-white rounded hover:bg-[var(--bg-accent-hover)]">${t('transcriptTemplates.downloadWithoutTemplate')}</button></div></div>`;diff --git a/static/locales/de.json b/static/locales/de.jsonindex 06788159..b92fa624 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -110,7 +110,11 @@"save": "Speichern","cancel": "Abbrechen","delete": "Löschen",- "selectOrCreate": "Wählen Sie eine Vorlage zum Bearbeiten oder erstellen Sie eine neue"+ "selectOrCreate": "Wählen Sie eine Vorlage zum Bearbeiten oder erstellen Sie eine neue",+ "viewGuide": "Vorlagen-Leitfaden Anzeigen",+ "selectTemplate": "Vorlage Auswählen",+ "default": "Standard",+ "downloadWithoutTemplate": "Ohne Vorlage Herunterladen"},"admin": {"title": "Administration",@@ -704,8 +708,18 @@"title": "Einstellungen","twoFactorAuth": "Zwei-Faktor-Authentifizierung"},+ "speakersManagement": {+ "used": "Verwendet",+ "time": "Mal",+ "times": "Mal",+ "last": "Zuletzt",+ "added": "Hinzugefügt"+ },"sharedTranscripts": {- "noSharedTranscripts": "Sie haben noch keine Transkripte geteilt."+ "noSharedTranscripts": "Sie haben noch keine Transkripte geteilt.",+ "sharedOn": "Geteilt am",+ "shareSummary": "Zusammenfassung Teilen",+ "shareNotes": "Notizen Teilen"},"sharedTranscriptsPage": {"noSharedTranscripts": "Sie haben noch keine Transkripte geteilt."diff --git a/static/locales/en.json b/static/locales/en.jsonindex 82a32eaf..8866488b 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -117,7 +117,10 @@"cancel": "Cancel","delete": "Delete","selectOrCreate": "Select a template to edit or create a new one",- "viewGuide": "View Template Guide"+ "viewGuide": "View Template Guide",+ "selectTemplate": "Select Template",+ "default": "Default",+ "downloadWithoutTemplate": "Download without template"},"admin": {"title": "Admin",@@ -589,7 +592,12 @@"totalSpeakers": "speakers saved","usedTimes": "Used","lastUsed": "Last used",- "created": "Created"+ "created": "Created",+ "used": "Used",+ "time": "time",+ "times": "times",+ "last": "Last",+ "added": "Added"},"manageSpeakersModal": {"created": "Created",@@ -724,7 +732,10 @@"twoFactorAuth": "Two-Factor Authentication"},"sharedTranscripts": {- "noSharedTranscripts": "You haven't shared any transcripts yet."+ "noSharedTranscripts": "You haven't shared any transcripts yet.",+ "sharedOn": "Shared on",+ "shareSummary": "Share Summary",+ "shareNotes": "Share Notes"},"sharedTranscriptsPage": {"noSharedTranscripts": "You have not shared any transcripts yet."diff --git a/static/locales/es.json b/static/locales/es.jsonindex 6730ae26..d732a970 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -116,7 +116,11 @@"save": "Guardar","cancel": "Cancelar","delete": "Eliminar",- "selectOrCreate": "Selecciona una plantilla para editar o crea una nueva"+ "selectOrCreate": "Selecciona una plantilla para editar o crea una nueva",+ "viewGuide": "Ver Guía de Plantillas",+ "selectTemplate": "Seleccionar Plantilla",+ "default": "Predeterminado",+ "downloadWithoutTemplate": "Descargar sin plantilla"},"admin": {"title": "Administración",@@ -710,8 +714,18 @@"title": "Configuración","twoFactorAuth": "Autenticación de Dos Factores"},+ "speakersManagement": {+ "used": "Usado",+ "time": "vez",+ "times": "veces",+ "last": "Último",+ "added": "Añadido"+ },"sharedTranscripts": {- "noSharedTranscripts": "Aún no has compartido ninguna transcripción."+ "noSharedTranscripts": "Aún no has compartido ninguna transcripción.",+ "sharedOn": "Compartido el",+ "shareSummary": "Compartir Resumen",+ "shareNotes": "Compartir Notas"},"sharedTranscriptsPage": {"noSharedTranscripts": "Aún no has compartido ninguna transcripción."diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex ab54507c..1e4acefa 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -110,7 +110,11 @@"save": "Enregistrer","cancel": "Annuler","delete": "Supprimer",- "selectOrCreate": "Sélectionnez un modèle à éditer ou créez-en un nouveau"+ "selectOrCreate": "Sélectionnez un modèle à éditer ou créez-en un nouveau",+ "viewGuide": "Voir le Guide des Modèles",+ "selectTemplate": "Sélectionner un Modèle",+ "default": "Par Défaut",+ "downloadWithoutTemplate": "Télécharger sans modèle"},"admin": {"title": "Administration",@@ -704,8 +708,18 @@"title": "Paramètres","twoFactorAuth": "Authentification à Deux Facteurs"},+ "speakersManagement": {+ "used": "Utilisé",+ "time": "fois",+ "times": "fois",+ "last": "Dernier",+ "added": "Ajouté"+ },"sharedTranscripts": {- "noSharedTranscripts": "Vous n'avez encore partagé aucune transcription."+ "noSharedTranscripts": "Vous n'avez encore partagé aucune transcription.",+ "sharedOn": "Partagé le",+ "shareSummary": "Partager le Résumé",+ "shareNotes": "Partager les Notes"},"sharedTranscriptsPage": {"noSharedTranscripts": "Vous n'avez pas encore partagé de transcriptions."diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex 6ed4e334..d4e9f264 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -128,7 +128,11 @@"save": "保存","cancel": "取消","delete": "删除",- "selectOrCreate": "选择要编辑的模板或创建新模板"+ "selectOrCreate": "选择要编辑的模板或创建新模板",+ "viewGuide": "查看模板指南",+ "selectTemplate": "选择模板",+ "default": "默认",+ "downloadWithoutTemplate": "不使用模板下载"},"admin": {"title": "管理员",@@ -831,8 +835,27 @@"title": "设置","twoFactorAuth": "双因素认证"},+ "speakersManagement": {+ "description": "管理您保存的发言人。当您在录音中使用发言人姓名时,这些会自动保存。",+ "loadingSpeakers": "加载发言人...",+ "failedToLoad": "加载发言人失败",+ "noSpeakersYet": "尚未保存发言人",+ "speakersWillAppear": "当您在录音中使用发言人姓名时,发言人将出现在这里",+ "totalSpeakers": "个已保存发言人",+ "usedTimes": "已使用",+ "lastUsed": "上次使用",+ "created": "创建时间",+ "used": "已使用",+ "time": "次",+ "times": "次",+ "last": "上次",+ "added": "添加时间"+ },"sharedTranscripts": {- "noSharedTranscripts": "您尚未分享任何转录。"+ "noSharedTranscripts": "您尚未分享任何转录。",+ "sharedOn": "分享于",+ "shareSummary": "分享摘要",+ "shareNotes": "分享笔记"},"sharedTranscriptsPage": {"noSharedTranscripts": "您尚未分享任何转录。"diff --git a/templates/account.html b/templates/account.htmlindex dc01f5e2..5e852d04 100644--- a/templates/account.html+++ b/templates/account.html@@ -1480,15 +1480,15 @@<div class="space-y-1 text-xs text-[var(--text-muted)]"><p class="flex items-center"><i class="fas fa-chart-line mr-1.5 text-xs opacity-60"></i>- <span>Used ${speaker.use_count} time${speaker.use_count !== 1 ? 's' : ''}</span>+ ${t('speakersManagement.used')} ${speaker.use_count} ${t('speakersManagement.' + (speaker.use_count !== 1 ? 'times' : 'time'))}</p><p class="flex items-center"><i class="fas fa-clock mr-1.5 text-xs opacity-60"></i>- <span>Last: ${lastUsedDate}</span>+ ${t('speakersManagement.last')}: ${lastUsedDate}</p><p class="flex items-center"><i class="fas fa-calendar-plus mr-1.5 text-xs opacity-60"></i>- <span>Added: ${createdDate}</span>+ ${t('speakersManagement.added')}: ${createdDate}</p></div></div>@@ -1644,18 +1644,18 @@<div class="flex justify-between items-start"><div><p class="font-semibold">${escapeHtml(share.recording_title)}</p>- <p class="text-sm text-[var(--text-muted)]">Shared on: ${share.created_at}</p>+ <p class="text-sm text-[var(--text-muted)]">${t('sharedTranscripts.sharedOn')}: ${share.created_at}</p></div><button data-share-id="${share.id}" class="delete-share-btn text-red-500 hover:text-red-700 p-1"><i class="fas fa-trash"></i></button></div><div class="mt-4 flex items-center gap-4"><label class="flex items-center text-sm"><input type="checkbox" data-share-id="${share.id}" data-share-prop="share_summary" class="share-checkbox h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" ${share.share_summary ? 'checked' : ''}>- <span class="ml-2">Share Summary</span>+ <span class="ml-2">${t('sharedTranscripts.shareSummary')}</span></label><label class="flex items-center text-sm"><input type="checkbox" data-share-id="${share.id}" data-share-prop="share_notes" class="share-checkbox h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" ${share.share_notes ? 'checked' : ''}>- <span class="ml-2">Share Notes</span>+ <span class="ml-2">${t('sharedTranscripts.shareNotes')}</span></label></div><div class="mt-4">@@ -2225,18 +2225,18 @@<div class="space-y-2 text-sm text-[var(--text-muted)]">${tag.custom_prompt ? `<div>- <span class="font-medium" data-i18n="tagManagement.customPrompt">Custom Prompt:</span>+ <span class="font-medium">${t('tagManagement.customPrompt')}:</span><span class="text-xs">${escapeHtml(tag.custom_prompt.substring(0, 60))}${tag.custom_prompt.length > 60 ? '...' : ''}</span></div>` : ''}-+${tag.default_language || tag.default_min_speakers || tag.default_max_speakers ? `<div class="pt-2 border-t border-[var(--border-secondary)]">- <span class="font-medium text-xs" data-i18n="tagManagement.asrDefaults">ASR Defaults:</span>+ <span class="font-medium text-xs">${t('tagManagement.asrDefaults')}:</span><div class="flex flex-wrap gap-2 mt-1">- ${tag.default_language ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">Lang: ${escapeHtml(tag.default_language)}</span>` : ''}- ${tag.default_min_speakers ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">Min: ${tag.default_min_speakers}</span>` : ''}- ${tag.default_max_speakers ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">Max: ${tag.default_max_speakers}</span>` : ''}+ ${tag.default_language ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">${t('form.language')}: ${escapeHtml(tag.default_language)}</span>` : ''}+ ${tag.default_min_speakers ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">${t('tagManagement.minSpeakers')}: ${tag.default_min_speakers}</span>` : ''}+ ${tag.default_max_speakers ? `<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-[var(--bg-accent)] text-[var(--text-accent)]">${t('tagManagement.maxSpeakers')}: ${tag.default_max_speakers}</span>` : ''}</div></div>` : ''}@@ -2575,7 +2575,7 @@<div class="flex-1"><h4 class="text-sm font-medium text-[var(--text-primary)]">${template.name}</h4>${template.description ? `<p class="text-xs text-[var(--text-muted)] mt-1">${template.description}</p>` : ''}- ${template.is_default ? '<span class="text-xs text-[var(--text-accent)] mt-1"><i class="fas fa-star mr-1"></i>Default</span>' : ''}+ ${template.is_default ? `<span class="text-xs text-[var(--text-accent)] mt-1"><i class="fas fa-star mr-1"></i>${t('transcriptTemplates.default')}</span>` : ''}</div></div>`;