-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
2715 lines (2505 loc) · 118 KB
/
Copy pathrenderer.js
File metadata and controls
2715 lines (2505 loc) · 118 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const SUPPORTED_INTERFACE_LANGUAGES = [
'en', 'pt-BR', 'es', 'fr', 'de', 'it', 'nl', 'el', 'ru', 'zh-CN', 'ja', 'ko', 'ar', 'hi', 'tr',
];
const DEFAULT_DETECTION_LANGUAGES = ['en'];
const DICTIONARY_LANGUAGE_CODES = ['pt', 'en'];
const TRANSLATIONS = {
en: {
appTagline: 'Write at the speed of thought.',
globalShortcut: 'Global shortcut',
pasteLastShortcut: 'Paste last',
dictionary: 'Dictionary',
settings: 'Settings',
streak: 'Streak',
daysUsed: 'Days used',
wordsSpoken: 'Words spoken',
averageWpm: 'Average WPM',
latestTranscriptions: 'Latest transcriptions',
historyCopyLimited: 'Local history for the latest {count} messages.',
historyCopyUnlimited: 'Local history for all messages.',
search: 'Search',
historySearchPlaceholder: 'Search words in transcriptions...',
noTranscriptions: 'No transcriptions yet.',
noSearchResults: 'No transcriptions found for this search.',
settingsCopy: 'Appearance, language, and AI model preferences.',
interfaceLanguage: 'Interface language',
interfaceLanguageCopy: 'Search and switch the app language instantly.',
searchLanguage: 'Search language',
languageSearchPlaceholder: 'Search your language...',
noLanguageResults: 'No languages match your search.',
selectedLanguage: 'Selected',
appearance: 'Appearance',
darkMode: 'Dark mode',
lightMode: 'Light mode',
floatingBar: 'Floating bar',
showOverlay: 'Show global overlay',
showOverlayCopy: 'Display the recording indicator above any app.',
startWithComputer: 'Start with the computer',
startWithComputerCopy: 'Launch OpenFlow in the background when you sign in.',
soundEffects: 'Sound feedback',
soundEffectsCopy: 'Play sounds on load, start, stop, cancel, and hands-free activation.',
shortcuts: 'Shortcuts',
shortcutsCopy: 'Choose the keys you press to dictate and to paste.',
globalShortcutCopy: 'Hold to dictate. Add Space while holding for hands-free.',
systemAudioShortcut: 'Computer audio',
systemAudioShortcutCopy:
'Hold {shortcut} to transcribe audio playing on this computer. Add Space for hands-free.',
systemAudioShortcutUnavailable: 'Computer-audio transcription is available on Windows only.',
pasteLastCopy: 'Paste your most recent transcription into any app.',
shortcutHint: 'Click a shortcut, then press the key combination you want. Press Esc to cancel.',
recordingShortcut: 'Press keys…',
invalidShortcut: "That combination can't be used. Try adding a modifier key.",
muteMusicTitle: 'Audio',
muteMusic: 'Duck audio while dictating',
muteMusicCopy: "Mute other apps' sound while you speak, then restore it afterwards.",
advancedSettings: 'Advanced settings',
advancedSettingsCopy: 'Shortcuts, model, history, and floating bar customization.',
back: 'Back',
floatingBarCustomization: 'Floating bar appearance',
floatingBarCustomizationCopy: 'Fine-tune how the floating pill looks on screen.',
overlayOpacity: 'Pill opacity',
overlayOpacityCopy: 'Transparency of the pill background. The effects stay fully visible.',
overlaySize: 'Pill size',
overlaySizeCopy: 'Overall size of the floating pill (100% is the default).',
overlayDynamicSize: 'Dynamic size',
overlayDynamicSizeCopy: 'Shrink the pill to half size until you start speaking, then grow it to full size.',
transcriptionHistory: 'Transcription history',
transcriptionHistoryCopy:
'Control whether the app stores only the latest local messages or every transcription.',
keepAllTranscriptions: 'Keep all transcriptions',
keepAllTranscriptionsCopy:
'Save every local transcription without the {count}-message limit.',
transcribeCancelledRecordings: 'Transcribe cancelled recordings',
transcribeCancelledRecordingsCopy:
'When Esc cancels a recording, transcribe it in the background and save it to history without pasting.',
autoEnableHandsFreeMode: 'Auto-enable hands-free mode',
autoEnableHandsFreeModeCopy:
'Start hands-free dictation as soon as you press the global shortcut.',
detectionLanguages: 'Detection languages',
detectionLanguagesCopy: 'Pick the languages OpenFlow should consider while listening.',
searchDetectionLanguage: 'Search language',
detectionLanguageSearchPlaceholder: 'Search detection languages...',
activeDetectionLanguage: 'Active',
activeDetectionLanguageSingular: 'active language',
activeDetectionLanguagePlural: 'active languages',
removeDetectionLanguage: 'Remove',
addDetectionLanguage: 'Add',
showMoreLanguages: 'Show more languages',
showLessLanguages: 'Show fewer languages',
noDetectionLanguageResults: 'No detection languages match your search.',
keepOneDetectionLanguage: 'Keep at least one detection language selected.',
transcriptionModels: 'Transcription models',
localModels: 'Local models',
cloudModels: 'Cloud models',
processInCloud: 'Process in the cloud',
processInCloudCopy: 'Use OpenRouter speech-to-text models.',
openRouterApiKey: 'OpenRouter API key',
openRouterApiKeyPlaceholder: 'sk-or-...',
saveApiKey: 'Save key',
changeApiKey: 'Change key',
clearApiKey: 'Remove',
apiKeyConfigured: 'API key saved.',
apiKeyMissing: 'Add an OpenRouter API key.',
cloudModel: 'Cloud model',
cloudModelCopy: 'OpenRouter models and prices.',
refreshModels: 'Refresh',
loadingCloudModels: 'Loading cloud models...',
noCloudModels: 'No speech-to-text models found.',
cloudModelsError: 'Could not load cloud models: {message}',
savedCloudRecordings: 'Saved failed recordings',
savedCloudRecordingsCopy: 'Retry without recording again.',
noSavedCloudRecordings: 'No failed recordings saved.',
retry: 'Retry',
cloudPrivacyTitle: 'Cloud privacy notice',
cloudPrivacyCopy:
'When cloud transcription is enabled, your audio is sent to OpenRouter and the selected provider. OpenFlow cannot guarantee that third parties delete or retain data in a specific way.',
cancelCloud: 'Keep local',
acceptCloud: 'Enable cloud',
cloudRequiresKey: 'Save your OpenRouter API key before enabling cloud transcription.',
resetAverage: 'Reset average',
systemDiagnostics: 'System diagnostics',
activeModel: 'Active model',
processing: 'Processing',
backend: 'Backend',
close: 'Close',
noNotes: 'No notes.',
dictionaryCopy: 'Replace terms automatically in the final text.',
dictionarySources: 'When you say',
dictionarySourceInputPlaceholder: 'Type a variation and press Enter',
dictionarySourceInputMore: 'Add another variation',
dictionaryTarget: 'Replace with',
dictionaryTargetPlaceholder: 'Ex.: OpenFlow',
dictionaryTargetHint: 'Leave empty to remove the words from the text.',
dictionaryDeleteLabel: '(removed)',
dictionaryApplyTo: 'Apply to',
activeLanguages: 'Active languages',
editingRule: 'Editing rule',
cancelEditing: 'Cancel editing',
addRule: 'Add rule',
saveRule: 'Save rule',
activeRules: 'Your rules',
dictionarySearchLabel: 'Search rules',
dictionarySearchPlaceholder: 'Search rules...',
dictionaryEmptyTitle: 'No rules yet',
dictionaryEmptyCopy: 'Fix words the transcription keeps getting wrong — e.g. "open flow" becomes "OpenFlow".',
noRuleResults: 'No rules found for this search.',
edit: 'Edit',
remove: 'Remove',
fillRuleError: 'Add at least one variation to replace.',
copy: 'Copy',
copied: 'Copied',
deleteEntry: 'Delete',
exportHistory: 'Export',
historyExported: 'History exported ({count} messages).',
historyExportEmpty: 'No transcriptions to export.',
exportFailed: 'Export failed: {message}',
confirmReset: 'Click again to confirm',
startHidden: 'Start minimized to tray',
startHiddenCopy: 'Keep the main window hidden when OpenFlow starts. Use the tray icon to open it.',
resetOverlayPosition: 'Reset position',
resetOverlayPositionCopy: 'Moved the pill somewhere awkward? Bring it back to the default spot.',
overlayPositionReset: 'Floating bar is back at the default position.',
exportDictionary: 'Export',
importDictionary: 'Import',
dictionaryExported: 'Dictionary exported ({count} rules).',
dictionaryExportEmpty: 'No rules to export.',
dictionaryImported: '{count} rule(s) imported.',
dictionaryImportNone: 'No new rules to import.',
dictionaryImportInvalid: 'This file is not a valid dictionary export.',
loadingStatusTitle: 'Loading model',
loadingStatusDetail: '',
loadingStatusHint: '',
switchingStatusTitle: 'Loading model',
switchingStatusHint: '',
errorStatusTitle: 'Something needs attention',
errorStatusHint: 'Check the system diagnostics below if this keeps happening.',
softwareUpdate: 'Software update',
softwareUpdateCopy: 'Install the newest OpenFlow build straight from inside the app.',
checkForUpdates: 'Check for updates',
downloadUpdate: 'Update',
openDownloadPage: 'Open download',
installUpdate: 'Restart & install',
updateIdle: 'Check whether a newer version is available.',
updateChecking: 'Checking for updates...',
updateUpToDate: "You're on the latest version.",
updateAvailable: 'Version {version} is available.',
updateDownloading: 'Downloading update... {percent}%',
updateDownloaded: 'Version {version} is ready. Restart to finish installing.',
updateManualDownload:
'Version {version} is available. Open the GitHub download page to install it.',
updateError: 'Update failed: {message}',
updateUnsupported: 'Updates are available only in the installed app.',
updateUpdaterUnavailable:
'Automatic updates are not configured in this build. Open the download page to install the latest OpenFlow.',
updateMetadataUnavailable: 'Auto-update metadata was not found for the latest GitHub release.',
updateMetadataUnavailableForVersion:
'Version {version} is available, but auto-update metadata was not found for that GitHub release.',
updateNotPackaged:
'In-app updates work only from the installed app. OpenFlow is currently running from a development or unpacked build.',
},
'pt-BR': {
appTagline: 'Escreva na velocidade do pensamento.',
globalShortcut: 'Atalho global',
pasteLastShortcut: 'Colar ultima',
dictionary: 'Dicionário',
settings: 'Configurações',
streak: 'Sequência',
daysUsed: 'Dias de uso',
wordsSpoken: 'Palavras faladas',
averageWpm: 'Média WPM',
latestTranscriptions: 'Últimas transcrições',
historyCopy: 'Histórico local das últimas 100 mensagens.',
search: 'Pesquisar',
historySearchPlaceholder: 'Buscar palavras nas transcrições...',
noTranscriptions: 'Nenhuma transcrição ainda.',
noSearchResults: 'Nenhuma transcrição encontrada para essa busca.',
settingsCopy: 'Ajustes de aparência, idioma e modelo de IA.',
interfaceLanguage: 'Idioma da interface',
interfaceLanguageCopy: 'Pesquise e troque o idioma do app na hora.',
searchLanguage: 'Pesquisar idioma',
languageSearchPlaceholder: 'Pesquise seu idioma...',
noLanguageResults: 'Nenhum idioma corresponde à busca.',
selectedLanguage: 'Selecionado',
appearance: 'Aparência',
darkMode: 'Modo escuro',
lightMode: 'Modo claro',
floatingBar: 'Barra flutuante',
showOverlay: 'Exibir overlay global',
showOverlayCopy: 'Mostra o indicador de gravação acima de qualquer app.',
startWithComputer: 'Iniciar com o computador',
startWithComputerCopy: 'Abre o OpenFlow em segundo plano ao entrar no sistema.',
soundEffects: 'Sons de feedback',
soundEffectsCopy: 'Toca sons ao carregar, iniciar, encerrar, cancelar e ativar hands-free.',
shortcuts: 'Atalhos',
shortcutsCopy: 'Escolha as teclas que você pressiona para ditar e para colar.',
globalShortcutCopy: 'Segure para ditar. Adicione Espaço enquanto segura para o modo hands-free.',
systemAudioShortcut: 'Áudio do computador',
systemAudioShortcutCopy:
'Segure {shortcut} para transcrever o áudio que está saindo do computador. Adicione Espaço para hands-free.',
systemAudioShortcutUnavailable:
'A transcrição do áudio do computador está disponível apenas no Windows.',
pasteLastCopy: 'Cole sua transcrição mais recente em qualquer app.',
shortcutHint: 'Clique em um atalho e pressione a combinação desejada. Pressione Esc para cancelar.',
recordingShortcut: 'Pressione as teclas…',
invalidShortcut: 'Essa combinação não pode ser usada. Tente adicionar uma tecla modificadora.',
muteMusicTitle: 'Áudio',
muteMusic: 'Abaixar o áudio ao ditar',
muteMusicCopy: 'Silencia o som de outros apps enquanto você fala e restaura depois.',
advancedSettings: 'Configurações avançadas',
advancedSettingsCopy: 'Atalhos, modelo, histórico e personalização da barra flutuante.',
back: 'Voltar',
floatingBarCustomization: 'Aparência da barra flutuante',
floatingBarCustomizationCopy: 'Ajuste como a barra flutuante aparece na tela.',
overlayOpacity: 'Opacidade da barra',
overlayOpacityCopy: 'Transparência do fundo da barra. Os efeitos continuam totalmente visíveis.',
overlaySize: 'Tamanho da barra',
overlaySizeCopy: 'Tamanho geral da barra flutuante (100% é o padrão).',
overlayDynamicSize: 'Tamanho dinâmico',
overlayDynamicSizeCopy: 'Reduz a barra para a metade do tamanho até você começar a falar e então cresce até o tamanho cheio.',
detectionLanguages: 'Idiomas de detecção',
detectionLanguagesCopy: 'Escolha os idiomas que o OpenFlow deve considerar enquanto escuta.',
searchDetectionLanguage: 'Pesquisar idioma',
detectionLanguageSearchPlaceholder: 'Pesquise os idiomas de detecção...',
activeDetectionLanguage: 'Ativo',
activeDetectionLanguageSingular: 'idioma ativo',
activeDetectionLanguagePlural: 'idiomas ativos',
removeDetectionLanguage: 'Remover',
addDetectionLanguage: 'Adicionar',
showMoreLanguages: 'Mostrar mais idiomas',
showLessLanguages: 'Mostrar menos idiomas',
noDetectionLanguageResults: 'Nenhum idioma de detecção corresponde à busca.',
keepOneDetectionLanguage: 'Mantenha pelo menos um idioma de detecção ativo.',
transcriptionModels: 'Modelos de transcrição',
localModels: 'Modelos locais',
cloudModels: 'Modelos da nuvem',
processInCloud: 'Processar na nuvem',
processInCloudCopy: 'Use modelos speech-to-text da OpenRouter.',
openRouterApiKey: 'Chave da OpenRouter',
openRouterApiKeyPlaceholder: 'sk-or-...',
saveApiKey: 'Salvar chave',
changeApiKey: 'Trocar chave',
clearApiKey: 'Remover',
apiKeyConfigured: 'Chave salva.',
apiKeyMissing: 'Adicione uma chave da OpenRouter.',
cloudModel: 'Modelo na nuvem',
cloudModelCopy: 'Modelos e precos da OpenRouter.',
refreshModels: 'Atualizar',
loadingCloudModels: 'Carregando modelos da nuvem...',
noCloudModels: 'Nenhum modelo speech-to-text encontrado.',
cloudModelsError: 'Nao foi possivel carregar modelos da nuvem: {message}',
savedCloudRecordings: 'Gravacoes com falha salvas',
savedCloudRecordingsCopy: 'Tente reenviar sem gravar de novo.',
noSavedCloudRecordings: 'Nenhuma gravacao com falha salva.',
retry: 'Tentar de novo',
cloudPrivacyTitle: 'Aviso de privacidade da nuvem',
cloudPrivacyCopy:
'Ao ativar a transcricao na nuvem, seu audio e enviado para a OpenRouter e para o provedor selecionado. O OpenFlow nao consegue garantir que terceiros apaguem ou retenham dados de uma forma especifica.',
cancelCloud: 'Manter local',
acceptCloud: 'Ativar nuvem',
cloudRequiresKey: 'Salve sua chave da OpenRouter antes de ativar a transcricao na nuvem.',
resetAverage: 'Resetar média',
systemDiagnostics: 'Diagnóstico do sistema',
activeModel: 'Modelo ativo',
processing: 'Processamento',
backend: 'Backend',
close: 'Fechar',
noNotes: 'Sem observações.',
dictionaryCopy: 'Troque termos automaticamente no texto final.',
dictionarySources: 'Quando você disser',
dictionarySourceInputPlaceholder: 'Digite uma variação e aperte Enter',
dictionarySourceInputMore: 'Adicionar outra variação',
dictionaryTarget: 'Substituir por',
dictionaryTargetPlaceholder: 'Ex.: OpenFlow',
dictionaryTargetHint: 'Deixe vazio para remover as palavras do texto.',
dictionaryDeleteLabel: '(removido)',
dictionaryApplyTo: 'Aplicar em',
activeLanguages: 'Idiomas ativos',
editingRule: 'Editando regra',
cancelEditing: 'Cancelar edição',
addRule: 'Adicionar regra',
saveRule: 'Salvar regra',
activeRules: 'Suas regras',
dictionarySearchLabel: 'Buscar regras',
dictionarySearchPlaceholder: 'Buscar regras...',
dictionaryEmptyTitle: 'Nenhuma regra ainda',
dictionaryEmptyCopy: 'Corrija palavras que a transcrição erra — ex.: "open flow" vira "OpenFlow".',
noRuleResults: 'Nenhuma regra encontrada para essa busca.',
edit: 'Editar',
remove: 'Remover',
fillRuleError: 'Adicione pelo menos uma variação para substituir.',
copy: 'Copiar',
copied: 'Copiado',
deleteEntry: 'Excluir',
exportHistory: 'Exportar',
historyExported: 'Histórico exportado ({count} mensagens).',
historyExportEmpty: 'Nenhuma transcrição para exportar.',
exportFailed: 'Falha ao exportar: {message}',
confirmReset: 'Clique de novo para confirmar',
startHidden: 'Iniciar minimizado na bandeja',
startHiddenCopy: 'Mantém a janela principal oculta quando o OpenFlow abre. Use o ícone da bandeja para abrir.',
resetOverlayPosition: 'Restaurar posição',
resetOverlayPositionCopy: 'Moveu a barra para um lugar ruim? Traga ela de volta para o lugar padrão.',
overlayPositionReset: 'Barra flutuante de volta à posição padrão.',
exportDictionary: 'Exportar',
importDictionary: 'Importar',
dictionaryExported: 'Dicionário exportado ({count} regras).',
dictionaryExportEmpty: 'Nenhuma regra para exportar.',
dictionaryImported: '{count} regra(s) importada(s).',
dictionaryImportNone: 'Nenhuma regra nova para importar.',
dictionaryImportInvalid: 'Este arquivo não é um dicionário exportado válido.',
loadingStatusTitle: 'Carregando o modelo',
loadingStatusDetail: '',
loadingStatusHint: '',
switchingStatusTitle: 'Carregando o modelo',
switchingStatusHint: '',
errorStatusTitle: 'Algo precisa de atencao',
errorStatusHint: 'Se isso continuar, verifique o diagnostico do sistema logo abaixo.',
softwareUpdate: 'Atualização do app',
softwareUpdateCopy: 'Instale a versão mais recente do OpenFlow direto pelo app.',
checkForUpdates: 'Procurar atualizações',
downloadUpdate: 'Atualizar',
openDownloadPage: 'Abrir download',
installUpdate: 'Reiniciar e instalar',
updateIdle: 'Verifique se há uma versão mais nova disponível.',
updateChecking: 'Procurando atualizações...',
updateUpToDate: 'Você está na versão mais recente.',
updateAvailable: 'A versão {version} está disponível.',
updateDownloading: 'Baixando atualização... {percent}%',
updateDownloaded: 'Versão {version} pronta. Reinicie para concluir a instalação.',
updateManualDownload:
'A versao {version} esta disponivel. Abra a pagina de download do GitHub para instalar.',
updateError: 'Falha na atualização: {message}',
updateUnsupported: 'As atualizações só estão disponíveis no app instalado.',
updateUpdaterUnavailable:
'As atualizacoes automaticas nao estao configuradas nesta build. Abra a pagina de download para instalar o OpenFlow mais recente.',
updateMetadataUnavailable:
'Os metadados de atualização não foram encontrados no release mais recente do GitHub.',
updateMetadataUnavailableForVersion:
'A versão {version} está disponível, mas os metadados de atualização não foram encontrados no release do GitHub.',
updateNotPackaged:
'As atualizacoes pelo app funcionam somente no app instalado. O OpenFlow esta rodando por uma build de desenvolvimento ou descompactada.',
},
};
Object.assign(TRANSLATIONS, {
es: { settings: 'Configuración', interfaceLanguage: 'Idioma de la interfaz', interfaceLanguageCopy: 'Busca y cambia el idioma de la app al instante.', searchLanguage: 'Buscar idioma', languageSearchPlaceholder: 'Busca tu idioma...', selectedLanguage: 'Seleccionado', appearance: 'Apariencia', darkMode: 'Modo oscuro', lightMode: 'Modo claro', floatingBar: 'Barra flotante', detectionLanguages: 'Idiomas de detección', transcriptionModels: 'Modelos de transcripción', systemDiagnostics: 'Diagnóstico del sistema', close: 'Cerrar', dictionary: 'Diccionario' },
fr: { settings: 'Paramètres', interfaceLanguage: "Langue de l'interface", interfaceLanguageCopy: "Recherchez et changez instantanément la langue de l'application.", searchLanguage: 'Rechercher une langue', languageSearchPlaceholder: 'Recherchez votre langue...', selectedLanguage: 'Sélectionné', appearance: 'Apparence', darkMode: 'Mode sombre', lightMode: 'Mode clair', floatingBar: 'Barre flottante', detectionLanguages: 'Langues de détection', transcriptionModels: 'Modèles de transcription', systemDiagnostics: 'Diagnostic système', close: 'Fermer', dictionary: 'Dictionnaire' },
de: { settings: 'Einstellungen', interfaceLanguage: 'Sprache der Oberfläche', interfaceLanguageCopy: 'Suche und wechsle die App-Sprache sofort.', searchLanguage: 'Sprache suchen', languageSearchPlaceholder: 'Sprache suchen...', selectedLanguage: 'Ausgewählt', appearance: 'Darstellung', darkMode: 'Dunkelmodus', lightMode: 'Hellmodus', floatingBar: 'Schwebende Leiste', detectionLanguages: 'Erkennungssprachen', transcriptionModels: 'Transkriptionsmodelle', systemDiagnostics: 'Systemdiagnose', close: 'Schließen', dictionary: 'Wörterbuch' },
it: { settings: 'Impostazioni', interfaceLanguage: "Lingua dell'interfaccia", interfaceLanguageCopy: "Cerca e cambia subito la lingua dell'app.", searchLanguage: 'Cerca lingua', languageSearchPlaceholder: 'Cerca la tua lingua...', selectedLanguage: 'Selezionato', appearance: 'Aspetto', darkMode: 'Modalità scura', lightMode: 'Modalità chiara', floatingBar: 'Barra flottante', detectionLanguages: 'Lingue di rilevamento', transcriptionModels: 'Modelli di trascrizione', systemDiagnostics: 'Diagnostica di sistema', close: 'Chiudi', dictionary: 'Dizionario' },
nl: { settings: 'Instellingen', interfaceLanguage: 'Interfacetaal', interfaceLanguageCopy: 'Zoek en wissel direct van app-taal.', searchLanguage: 'Taal zoeken', languageSearchPlaceholder: 'Zoek je taal...', selectedLanguage: 'Geselecteerd', appearance: 'Weergave', darkMode: 'Donkere modus', lightMode: 'Lichte modus', floatingBar: 'Zwevende balk', detectionLanguages: 'Detectietalen', transcriptionModels: 'Transcriptiemodellen', systemDiagnostics: 'Systeemdiagnostiek', close: 'Sluiten', dictionary: 'Woordenboek' },
el: { settings: 'Ρυθμίσεις', interfaceLanguage: 'Γλώσσα διεπαφής', interfaceLanguageCopy: 'Αναζητήστε και αλλάξτε άμεσα τη γλώσσα της εφαρμογής.', searchLanguage: 'Αναζήτηση γλώσσας', languageSearchPlaceholder: 'Αναζητήστε τη γλώσσα σας...', selectedLanguage: 'Επιλεγμένο', appearance: 'Εμφάνιση', darkMode: 'Σκούρο θέμα', lightMode: 'Ανοιχτό θέμα', floatingBar: 'Πλωτή μπάρα', detectionLanguages: 'Γλώσσες ανίχνευσης', transcriptionModels: 'Μοντέλα απομαγνητοφώνησης', systemDiagnostics: 'Διαγνωστικά συστήματος', close: 'Κλείσιμο', dictionary: 'Λεξικό' },
ru: { settings: 'Настройки', interfaceLanguage: 'Язык интерфейса', interfaceLanguageCopy: 'Ищите и мгновенно переключайте язык приложения.', searchLanguage: 'Поиск языка', languageSearchPlaceholder: 'Найдите свой язык...', selectedLanguage: 'Выбран', appearance: 'Внешний вид', darkMode: 'Тёмная тема', lightMode: 'Светлая тема', floatingBar: 'Плавающая панель', detectionLanguages: 'Языки распознавания', transcriptionModels: 'Модели транскрипции', systemDiagnostics: 'Диагностика системы', close: 'Закрыть', dictionary: 'Словарь' },
'zh-CN': { settings: '设置', interfaceLanguage: '界面语言', interfaceLanguageCopy: '搜索并立即切换应用语言。', searchLanguage: '搜索语言', languageSearchPlaceholder: '搜索你的语言...', selectedLanguage: '已选择', appearance: '外观', darkMode: '深色模式', lightMode: '浅色模式', floatingBar: '悬浮条', detectionLanguages: '检测语言', transcriptionModels: '转录模型', systemDiagnostics: '系统诊断', close: '关闭', dictionary: '词典' },
ja: { settings: '設定', interfaceLanguage: 'インターフェース言語', interfaceLanguageCopy: '言語を検索してすぐに切り替えられます。', searchLanguage: '言語を検索', languageSearchPlaceholder: '言語を検索...', selectedLanguage: '選択中', appearance: '表示', darkMode: 'ダークモード', lightMode: 'ライトモード', floatingBar: 'フローティングバー', detectionLanguages: '検出言語', transcriptionModels: '文字起こしモデル', systemDiagnostics: 'システム診断', close: '閉じる', dictionary: '辞書' },
ko: { settings: '설정', interfaceLanguage: '인터페이스 언어', interfaceLanguageCopy: '언어를 검색하고 즉시 앱 언어를 바꿀 수 있습니다.', searchLanguage: '언어 검색', languageSearchPlaceholder: '언어 검색...', selectedLanguage: '선택됨', appearance: '화면', darkMode: '다크 모드', lightMode: '라이트 모드', floatingBar: '플로팅 바', detectionLanguages: '감지 언어', transcriptionModels: '전사 모델', systemDiagnostics: '시스템 진단', close: '닫기', dictionary: '사전' },
ar: { settings: 'الإعدادات', interfaceLanguage: 'لغة الواجهة', interfaceLanguageCopy: 'ابحث عن لغة التطبيق وبدلها فورًا.', searchLanguage: 'ابحث عن لغة', languageSearchPlaceholder: 'ابحث عن لغتك...', selectedLanguage: 'محدد', appearance: 'المظهر', darkMode: 'الوضع الداكن', lightMode: 'الوضع الفاتح', floatingBar: 'الشريط العائم', detectionLanguages: 'لغات الاكتشاف', transcriptionModels: 'نماذج النسخ', systemDiagnostics: 'تشخيص النظام', close: 'إغلاق', dictionary: 'القاموس' },
hi: { settings: 'सेटिंग्स', interfaceLanguage: 'इंटरफ़ेस भाषा', interfaceLanguageCopy: 'अपनी भाषा खोजें और तुरंत ऐप की भाषा बदलें।', searchLanguage: 'भाषा खोजें', languageSearchPlaceholder: 'अपनी भाषा खोजें...', selectedLanguage: 'चयनित', appearance: 'रूप', darkMode: 'डार्क मोड', lightMode: 'लाइट मोड', floatingBar: 'फ़्लोटिंग बार', detectionLanguages: 'पता लगाने की भाषाएँ', transcriptionModels: 'ट्रांसक्रिप्शन मॉडल', systemDiagnostics: 'सिस्टम डायग्नोस्टिक्स', close: 'बंद करें', dictionary: 'शब्दकोश' },
tr: { settings: 'Ayarlar', interfaceLanguage: 'Arayüz dili', interfaceLanguageCopy: 'Dil arayın ve uygulama dilini anında değiştirin.', searchLanguage: 'Dil ara', languageSearchPlaceholder: 'Dilini ara...', selectedLanguage: 'Seçili', appearance: 'Görünüm', darkMode: 'Koyu mod', lightMode: 'Açık mod', floatingBar: 'Yüzen çubuk', detectionLanguages: 'Algılama dilleri', transcriptionModels: 'Döküm modelleri', systemDiagnostics: 'Sistem tanıları', close: 'Kapat', dictionary: 'Sözlük' },
});
Object.assign(TRANSLATIONS['pt-BR'], {
historyCopyLimited: 'Historico local das ultimas {count} mensagens.',
historyCopyUnlimited: 'Historico local de todas as mensagens.',
transcriptionHistory: 'Historico de transcricoes',
transcriptionHistoryCopy:
'Controle se o app guarda apenas as ultimas mensagens locais ou todas as transcricoes.',
keepAllTranscriptions: 'Guardar todas as transcricoes',
keepAllTranscriptionsCopy:
'Salva cada transcricao local sem o limite de {count} mensagens.',
transcribeCancelledRecordings: 'Transcrever gravacoes canceladas',
transcribeCancelledRecordingsCopy:
'Ao cancelar com Esc, transcreve em segundo plano e salva no historico sem colar.',
autoEnableHandsFreeMode: 'Ativar hands-free automaticamente',
autoEnableHandsFreeModeCopy:
'Inicia o ditado em hands-free assim que voce pressiona o atalho global.',
systemAudioShortcut: 'Audio do computador',
systemAudioShortcutCopy:
'Segure {shortcut} para transcrever o audio que esta saindo do computador. Adicione Espaco para hands-free.',
systemAudioShortcutUnavailable:
'A transcricao do audio do computador esta disponivel apenas no Windows.',
});
const DETECTION_LANGUAGE_TRANSLATIONS = {
es: {
detectionLanguagesCopy: 'Elige los idiomas que OpenFlow debe considerar mientras escucha.',
searchDetectionLanguage: 'Buscar idioma',
detectionLanguageSearchPlaceholder: 'Buscar idiomas de deteccion...',
activeDetectionLanguage: 'Activo',
activeDetectionLanguageSingular: 'idioma activo',
activeDetectionLanguagePlural: 'idiomas activos',
removeDetectionLanguage: 'Quitar',
addDetectionLanguage: 'Agregar',
showMoreLanguages: 'Mostrar mas idiomas',
showLessLanguages: 'Mostrar menos idiomas',
noDetectionLanguageResults: 'Ningun idioma coincide con la busqueda.',
keepOneDetectionLanguage: 'Mantén al menos un idioma de deteccion seleccionado.',
},
fr: {
detectionLanguagesCopy: 'Choisissez les langues qu OpenFlow doit prendre en compte pendant l ecoute.',
searchDetectionLanguage: 'Rechercher une langue',
detectionLanguageSearchPlaceholder: 'Rechercher des langues de detection...',
activeDetectionLanguage: 'Actif',
activeDetectionLanguageSingular: 'langue active',
activeDetectionLanguagePlural: 'langues actives',
removeDetectionLanguage: 'Retirer',
addDetectionLanguage: 'Ajouter',
showMoreLanguages: 'Afficher plus de langues',
showLessLanguages: 'Afficher moins de langues',
noDetectionLanguageResults: 'Aucune langue ne correspond a cette recherche.',
keepOneDetectionLanguage: 'Conservez au moins une langue de detection selectionnee.',
},
de: {
detectionLanguagesCopy: 'Wahle die Sprachen, die OpenFlow beim Zuhoren berucksichtigen soll.',
searchDetectionLanguage: 'Sprache suchen',
detectionLanguageSearchPlaceholder: 'Erkennungssprachen suchen...',
activeDetectionLanguage: 'Aktiv',
activeDetectionLanguageSingular: 'aktive Sprache',
activeDetectionLanguagePlural: 'aktive Sprachen',
removeDetectionLanguage: 'Entfernen',
addDetectionLanguage: 'Hinzufugen',
showMoreLanguages: 'Mehr Sprachen anzeigen',
showLessLanguages: 'Weniger Sprachen anzeigen',
noDetectionLanguageResults: 'Keine Sprache passt zu dieser Suche.',
keepOneDetectionLanguage: 'Mindestens eine Erkennungssprache muss ausgewahlt bleiben.',
},
it: {
detectionLanguagesCopy: 'Scegli le lingue che OpenFlow deve considerare durante l ascolto.',
searchDetectionLanguage: 'Cerca lingua',
detectionLanguageSearchPlaceholder: 'Cerca lingue di rilevamento...',
activeDetectionLanguage: 'Attiva',
activeDetectionLanguageSingular: 'lingua attiva',
activeDetectionLanguagePlural: 'lingue attive',
removeDetectionLanguage: 'Rimuovi',
addDetectionLanguage: 'Aggiungi',
showMoreLanguages: 'Mostra altre lingue',
showLessLanguages: 'Mostra meno lingue',
noDetectionLanguageResults: 'Nessuna lingua corrisponde alla ricerca.',
keepOneDetectionLanguage: 'Mantieni almeno una lingua di rilevamento selezionata.',
},
nl: {
detectionLanguagesCopy: 'Kies de talen die OpenFlow moet meenemen tijdens het luisteren.',
searchDetectionLanguage: 'Taal zoeken',
detectionLanguageSearchPlaceholder: 'Detectietalen zoeken...',
activeDetectionLanguage: 'Actief',
activeDetectionLanguageSingular: 'actieve taal',
activeDetectionLanguagePlural: 'actieve talen',
removeDetectionLanguage: 'Verwijderen',
addDetectionLanguage: 'Toevoegen',
showMoreLanguages: 'Meer talen tonen',
showLessLanguages: 'Minder talen tonen',
noDetectionLanguageResults: 'Geen taal gevonden voor deze zoekopdracht.',
keepOneDetectionLanguage: 'Houd minstens een detectietaal geselecteerd.',
},
el: {
detectionLanguagesCopy: 'Επιλέξτε τις γλώσσες που θα λαμβάνει υπόψη το OpenFlow κατά την ακρόαση.',
searchDetectionLanguage: 'Αναζήτηση γλώσσας',
detectionLanguageSearchPlaceholder: 'Αναζήτηση γλωσσών ανίχνευσης...',
activeDetectionLanguage: 'Ενεργή',
activeDetectionLanguageSingular: 'ενεργή γλώσσα',
activeDetectionLanguagePlural: 'ενεργές γλώσσες',
removeDetectionLanguage: 'Αφαίρεση',
addDetectionLanguage: 'Προσθήκη',
showMoreLanguages: 'Εμφάνιση περισσότερων γλωσσών',
showLessLanguages: 'Εμφάνιση λιγότερων γλωσσών',
noDetectionLanguageResults: 'Καμία γλώσσα δεν ταιριάζει με την αναζήτηση.',
keepOneDetectionLanguage: 'Κρατήστε επιλεγμένη τουλάχιστον μία γλώσσα ανίχνευσης.',
},
ru: {
detectionLanguagesCopy: 'Выберите языки, которые OpenFlow должен учитывать во время прослушивания.',
searchDetectionLanguage: 'Поиск языка',
detectionLanguageSearchPlaceholder: 'Поиск языков распознавания...',
activeDetectionLanguage: 'Активно',
activeDetectionLanguageSingular: 'активный язык',
activeDetectionLanguagePlural: 'активные языки',
removeDetectionLanguage: 'Удалить',
addDetectionLanguage: 'Добавить',
showMoreLanguages: 'Показать больше языков',
showLessLanguages: 'Показать меньше языков',
noDetectionLanguageResults: 'Нет языков, подходящих под поиск.',
keepOneDetectionLanguage: 'Оставьте выбранным хотя бы один язык распознавания.',
},
'zh-CN': {
detectionLanguagesCopy: '选择 OpenFlow 在聆听时应考虑的语言。',
searchDetectionLanguage: '搜索语言',
detectionLanguageSearchPlaceholder: '搜索检测语言...',
activeDetectionLanguage: '已启用',
activeDetectionLanguageSingular: '启用的语言',
activeDetectionLanguagePlural: '启用的语言',
removeDetectionLanguage: '移除',
addDetectionLanguage: '添加',
showMoreLanguages: '显示更多语言',
showLessLanguages: '显示更少语言',
noDetectionLanguageResults: '没有匹配的检测语言。',
keepOneDetectionLanguage: '请至少保留一种检测语言。',
},
ja: {
detectionLanguagesCopy: 'OpenFlow が聞き取り時に考慮する言語を選びます。',
searchDetectionLanguage: '言語を検索',
detectionLanguageSearchPlaceholder: '検出言語を検索...',
activeDetectionLanguage: '有効',
activeDetectionLanguageSingular: '有効な言語',
activeDetectionLanguagePlural: '有効な言語',
removeDetectionLanguage: '削除',
addDetectionLanguage: '追加',
showMoreLanguages: '他の言語を表示',
showLessLanguages: '表示を減らす',
noDetectionLanguageResults: '検索に一致する検出言語がありません。',
keepOneDetectionLanguage: '少なくとも 1 つの検出言語を選択してください。',
},
ko: {
detectionLanguagesCopy: 'OpenFlow가 듣는 동안 고려할 언어를 선택하세요.',
searchDetectionLanguage: '언어 검색',
detectionLanguageSearchPlaceholder: '감지 언어 검색...',
activeDetectionLanguage: '활성',
activeDetectionLanguageSingular: '활성 언어',
activeDetectionLanguagePlural: '활성 언어',
removeDetectionLanguage: '제거',
addDetectionLanguage: '추가',
showMoreLanguages: '더 많은 언어 보기',
showLessLanguages: '언어 적게 보기',
noDetectionLanguageResults: '검색과 일치하는 감지 언어가 없습니다.',
keepOneDetectionLanguage: '감지 언어를 하나 이상 선택하세요.',
},
ar: {
detectionLanguagesCopy: 'اختر اللغات التي يجب أن يراعيها OpenFlow أثناء الاستماع.',
searchDetectionLanguage: 'ابحث عن لغة',
detectionLanguageSearchPlaceholder: 'ابحث في لغات الاكتشاف...',
activeDetectionLanguage: 'نشطة',
activeDetectionLanguageSingular: 'لغة نشطة',
activeDetectionLanguagePlural: 'لغات نشطة',
removeDetectionLanguage: 'إزالة',
addDetectionLanguage: 'إضافة',
showMoreLanguages: 'إظهار المزيد من اللغات',
showLessLanguages: 'إظهار لغات أقل',
noDetectionLanguageResults: 'لا توجد لغات مطابقة للبحث.',
keepOneDetectionLanguage: 'أبق لغة اكتشاف واحدة على الأقل محددة.',
},
hi: {
detectionLanguagesCopy: 'सुनते समय OpenFlow जिन भाषाओं पर विचार करे उन्हें चुनें।',
searchDetectionLanguage: 'भाषा खोजें',
detectionLanguageSearchPlaceholder: 'पता लगाने की भाषाएँ खोजें...',
activeDetectionLanguage: 'सक्रिय',
activeDetectionLanguageSingular: 'सक्रिय भाषा',
activeDetectionLanguagePlural: 'सक्रिय भाषाएँ',
removeDetectionLanguage: 'हटाएँ',
addDetectionLanguage: 'जोड़ें',
showMoreLanguages: 'और भाषाएँ दिखाएँ',
showLessLanguages: 'कम भाषाएँ दिखाएँ',
noDetectionLanguageResults: 'इस खोज से कोई भाषा नहीं मिली।',
keepOneDetectionLanguage: 'कम से कम एक पता लगाने की भाषा चयनित रखें।',
},
tr: {
detectionLanguagesCopy: 'OpenFlow un dinlerken dikkate alacağı dilleri seçin.',
searchDetectionLanguage: 'Dil ara',
detectionLanguageSearchPlaceholder: 'Algılama dillerini ara...',
activeDetectionLanguage: 'Aktif',
activeDetectionLanguageSingular: 'aktif dil',
activeDetectionLanguagePlural: 'aktif diller',
removeDetectionLanguage: 'Kaldır',
addDetectionLanguage: 'Ekle',
showMoreLanguages: 'Daha fazla dil göster',
showLessLanguages: 'Daha az dil göster',
noDetectionLanguageResults: 'Bu aramaya uygun algılama dili yok.',
keepOneDetectionLanguage: 'En az bir algılama dili seçili kalmalı.',
},
};
for (const code of SUPPORTED_INTERFACE_LANGUAGES) {
if (code === 'en' || code === 'pt-BR') {
continue;
}
Object.assign(TRANSLATIONS[code] || (TRANSLATIONS[code] = {}), {
historyCopyLimited: 'Local history for the latest {count} messages.',
historyCopyUnlimited: 'Local history for all messages.',
transcriptionHistory: 'Transcription history',
transcriptionHistoryCopy:
'Control whether the app stores only the latest local messages or every transcription.',
keepAllTranscriptions: 'Keep all transcriptions',
keepAllTranscriptionsCopy:
'Save every local transcription without the {count}-message limit.',
transcribeCancelledRecordings: 'Transcribe cancelled recordings',
transcribeCancelledRecordingsCopy:
'When Esc cancels a recording, transcribe it in the background and save it to history without pasting.',
autoEnableHandsFreeMode: 'Auto-enable hands-free mode',
autoEnableHandsFreeModeCopy:
'Start hands-free dictation as soon as you press the global shortcut.',
systemAudioShortcut: 'Computer audio',
systemAudioShortcutCopy:
'Hold {shortcut} to transcribe audio playing on this computer. Add Space for hands-free.',
systemAudioShortcutUnavailable: 'Computer-audio transcription is available on Windows only.',
...(DETECTION_LANGUAGE_TRANSLATIONS[code] || {}),
});
}
const MODEL_LABELS = {
tiny: { en: 'Lite', 'pt-BR': 'Lite' },
base: { en: 'Fast', 'pt-BR': 'Rápido' },
small: { en: 'Balanced', 'pt-BR': 'Equilibrado' },
medium: { en: 'Precise', 'pt-BR': 'Preciso' },
'large-v3': { en: 'Maximum', 'pt-BR': 'Máximo' },
};
const MODEL_DESCRIPTIONS = {
tiny: { en: 'Minimum latency for quick tests.', 'pt-BR': 'Latência mínima para testes rápidos.' },
base: { en: 'Better than tiny while staying very fast.', 'pt-BR': 'Melhor que tiny, ainda bem ágil.' },
small: { en: 'A solid middle ground for daily use.', 'pt-BR': 'Bom meio-termo para uso diário.' },
medium: { en: 'More quality with moderate latency.', 'pt-BR': 'Mais qualidade com latência moderada.' },
'large-v3': { en: 'Highest accuracy with a heavier local cost.', 'pt-BR': 'Maior precisão com custo local mais alto.' },
};
const els = {
historyList: document.getElementById('history-list'),
historyCount: document.getElementById('history-count'),
historySearch: document.getElementById('history-search'),
historySearchClear: document.getElementById('history-search-clear'),
exportHistory: document.getElementById('export-history'),
historyCopy: document.getElementById('history-copy'),
shortcutLabel: document.getElementById('shortcut-label'),
pasteShortcutLabel: document.getElementById('paste-shortcut-label'),
systemAudioShortcutLabel: document.getElementById('system-audio-shortcut-label'),
systemAudioShortcutMeta: document.getElementById('system-audio-shortcut-meta'),
systemAudioShortcutCopy: document.getElementById('system-audio-shortcut-copy'),
systemAudioShortcutKeys: document.getElementById('system-audio-shortcut-keys'),
noticeStrip: document.getElementById('notice-strip'),
statusPanel: document.getElementById('status-panel'),
statusPanelTitle: document.getElementById('status-panel-title'),
statusPanelProgress: document.getElementById('status-panel-progress'),
detectionLanguageDefaults: document.getElementById('detection-language-defaults'),
detectionLanguageSummary: document.getElementById('detection-language-summary'),
toggleDetectionLanguages: document.getElementById('toggle-detection-languages'),
detectionLanguageMore: document.getElementById('detection-language-more'),
detectionLanguageSearch: document.getElementById('detection-language-search'),
detectionLanguageList: document.getElementById('detection-language-list'),
cloudTranscriptionEnabled: document.getElementById('cloud-transcription-enabled'),
cloudSettings: document.getElementById('cloud-settings'),
openRouterKeyForm: document.getElementById('openrouter-key-form'),
openRouterApiKey: document.getElementById('openrouter-api-key'),
openRouterKeySaved: document.getElementById('openrouter-key-saved'),
openRouterKeyStatus: document.getElementById('openrouter-key-status'),
changeOpenRouterKey: document.getElementById('change-openrouter-key'),
cancelOpenRouterKeyChange: document.getElementById('cancel-openrouter-key-change'),
clearOpenRouterKey: document.getElementById('clear-openrouter-key'),
refreshOpenRouterModels: document.getElementById('refresh-openrouter-models'),
cloudModelList: document.getElementById('cloud-model-list'),
cloudRetrySection: document.getElementById('cloud-retry-section'),
cloudRetryList: document.getElementById('cloud-retry-list'),
cloudPrivacyDialog: document.getElementById('cloud-privacy-dialog'),
cloudPrivacyBackdrop: document.getElementById('cloud-privacy-backdrop'),
cancelCloudPrivacy: document.getElementById('cancel-cloud-privacy'),
acceptCloudPrivacy: document.getElementById('accept-cloud-privacy'),
modelList: document.getElementById('model-list'),
resetStats: document.getElementById('reset-stats'),
activeModelLabel: document.getElementById('active-model-label'),
deviceLabel: document.getElementById('device-label'),
deviceNote: document.getElementById('device-note'),
streakValue: document.getElementById('streak-value'),
daysUsedValue: document.getElementById('days-used-value'),
wordsTotalValue: document.getElementById('words-total-value'),
wpmValue: document.getElementById('wpm-value'),
openDictionary: document.getElementById('open-dictionary'),
closeDictionary: document.getElementById('close-dictionary'),
dictionaryWindow: document.getElementById('dictionary-window'),
dictionaryBackdrop: document.getElementById('dictionary-backdrop'),
dictionaryForm: document.getElementById('dictionary-form'),
dictionarySourceBox: document.getElementById('dictionary-source-box'),
dictionarySourceInput: document.getElementById('dictionary-source-input'),
dictionaryEditingBanner: document.getElementById('dictionary-editing-banner'),
dictionaryTarget: document.getElementById('dictionary-target'),
dictionaryLangPt: document.getElementById('dictionary-lang-pt'),
dictionaryLangEn: document.getElementById('dictionary-lang-en'),
dictionaryLangPtLabel: document.getElementById('dictionary-lang-pt-label'),
dictionaryLangEnLabel: document.getElementById('dictionary-lang-en-label'),
dictionaryList: document.getElementById('dictionary-list'),
dictionaryCount: document.getElementById('dictionary-count'),
dictionarySearch: document.getElementById('dictionary-search'),
exportDictionary: document.getElementById('export-dictionary'),
importDictionary: document.getElementById('import-dictionary'),
cancelDictionaryEdit: document.getElementById('cancel-dictionary-edit'),
submitDictionaryRule: document.getElementById('submit-dictionary-rule'),
openSettings: document.getElementById('open-settings'),
closeSettings: document.getElementById('close-settings'),
settingsDrawer: document.getElementById('settings-drawer'),
settingsBackdrop: document.getElementById('settings-backdrop'),
openAdvanced: document.getElementById('open-advanced'),
closeAdvanced: document.getElementById('close-advanced'),
advancedDrawer: document.getElementById('advanced-drawer'),
advancedBackdrop: document.getElementById('advanced-backdrop'),
captureShortcut: document.getElementById('capture-shortcut'),
capturePasteShortcut: document.getElementById('capture-paste-shortcut'),
shortcutCaptureKeys: document.getElementById('shortcut-capture-keys'),
pasteShortcutCaptureKeys: document.getElementById('paste-shortcut-capture-keys'),
duckAudio: document.getElementById('duck-audio'),
startHidden: document.getElementById('start-hidden'),
resetOverlayPosition: document.getElementById('reset-overlay-position'),
overlayOpacity: document.getElementById('overlay-opacity'),
overlayOpacityValue: document.getElementById('overlay-opacity-value'),
overlayScale: document.getElementById('overlay-scale'),
overlayScaleValue: document.getElementById('overlay-scale-value'),
overlayDynamicSize: document.getElementById('overlay-dynamic-size'),
showOverlayBar: document.getElementById('show-overlay-bar'),
launchAtLogin: document.getElementById('launch-at-login'),
soundEffectsEnabled: document.getElementById('sound-effects-enabled'),
keepAllTranscriptions: document.getElementById('keep-all-transcriptions'),
transcribeCancelledRecordings: document.getElementById('transcribe-cancelled-recordings'),
autoEnableHandsFreeMode: document.getElementById('auto-enable-hands-free-mode'),
keepAllTranscriptionsCopy: document.getElementById('keep-all-transcriptions-copy'),
transcriptionHistoryCopy: document.getElementById('transcription-history-copy'),
themeRadios: document.querySelectorAll('input[name="theme"]'),
interfaceLanguageSearch: document.getElementById('interface-language-search'),
interfaceLanguageList: document.getElementById('interface-language-list'),
updateVersion: document.getElementById('update-version'),
updateStatusText: document.getElementById('update-status-text'),
updateProgress: document.getElementById('update-progress'),
updateProgressBar: document.getElementById('update-progress-bar'),
updateAction: document.getElementById('update-action'),
translatable: document.querySelectorAll('[data-i18n]'),
translatablePlaceholders: document.querySelectorAll('[data-i18n-placeholder]'),
};
let renderedHistory = [];
let historyFilter = '';
let lastState = null;
let settingsOpen = false;
let settingsCloseTimer = null;
let advancedOpen = false;
let advancedCloseTimer = null;
let capturingShortcutTarget = null;
let captureHeldTokens = new Set();
let captureBestTokens = [];
let captureFinalizing = false;
let dictionaryOpen = false;
let dictionaryCloseTimer = null;
let detectionLanguagesExpanded = false;
let editingDictionaryRuleId = null;
let dictionarySourceChips = [];
let toastHideTimer = null;
let dictionaryFilter = '';
let lastUpdate = { status: 'idle', version: null, availableVersion: null, progress: 0, message: '' };
let installAfterDownload = false;
let cloudSettingsSetupOpen = false;
let cloudKeyEditOpen = false;
const renderCache = {
translations: '',
detectionLanguages: '',
interfaceLanguages: '',
history: '',
dictionary: '',
models: '',
cloudModels: '',
cloudRetries: '',
usage: '',
};
const SETTINGS_CLOSE_DELAY_MS = 500;
const TOAST_HIDE_DELAY_MS = 3200;
function locale() {
return lastState?.interfaceLanguage || 'en';
}
function t(key) {
return (TRANSLATIONS[locale()] && TRANSLATIONS[locale()][key]) || TRANSLATIONS.en[key] || key;
}
function template(key, replacements = {}) {
return Object.entries(replacements).reduce(
(message, [name, value]) => message.replaceAll(`{${name}}`, String(value)),
t(key),
);
}
function intFmt(value) {
return new Intl.NumberFormat(locale(), { maximumFractionDigits: 0 }).format(Number(value) || 0);
}
function compactFmt(value) {
return new Intl.NumberFormat(locale(), {
notation: 'compact',
maximumFractionDigits: 1,
}).format(Number(value) || 0);
}
function langName(code, displayLocale = locale()) {
try {
return new Intl.DisplayNames([displayLocale], { type: 'language' }).of(code) || code;
} catch (_error) {
return code;
}
}
function capitalizeLanguageLabel(value, displayLocale = locale()) {
const text = String(value || '').trim();
if (!text) return text;
return text.replace(/^\p{L}/u, (match) => match.toLocaleUpperCase(displayLocale));
}
function getSupportedDetectionLanguages() {
const fromState = Array.isArray(lastState?.supportedDetectionLanguages)
? lastState.supportedDetectionLanguages
: [];
const unique = [...new Set(fromState.map((code) => String(code || '').trim().toLowerCase()).filter(Boolean))];
for (const code of DEFAULT_DETECTION_LANGUAGES) {
if (!unique.includes(code)) {
unique.push(code);
}
}
return unique;
}
function getSelectedDetectionLanguages() {
const fromState = Array.isArray(lastState?.allowedLanguages) ? lastState.allowedLanguages : [];
const list = [...new Set(fromState.map((code) => String(code || '').trim().toLowerCase()).filter(Boolean))];
return list.length > 0 ? list : [...DEFAULT_DETECTION_LANGUAGES];
}
function getDictionaryFallbackLanguages() {
const selected = getSelectedDetectionLanguages().filter((code) => DICTIONARY_LANGUAGE_CODES.includes(code));
return selected.length > 0 ? selected : ['pt'];
}
function detectionLanguageSummary(selectedLanguages) {
const count = Array.isArray(selectedLanguages) ? selectedLanguages.length : 0;
return countLabel(
count,
t('activeDetectionLanguageSingular'),
t('activeDetectionLanguagePlural'),
);
}
function buildSelectedDetectionLanguageCard(code, canRemove) {
const nativeName = capitalizeLanguageLabel(langName(code, code), code);
const localName = capitalizeLanguageLabel(langName(code));
const showLocalName = localName && localName !== nativeName;
return `
<article class="detection-language-card detection-language-card--selected">
<div class="detection-language-card__copy">
<strong>${esc(nativeName)}</strong>
<span>${esc(showLocalName ? localName : code.toUpperCase())}</span>
</div>
<div class="detection-language-card__side">
<span class="detection-language-card__meta">${esc(code.toUpperCase())}</span>
${
canRemove
? `<button class="detection-language-remove" data-detection-remove="${esc(code)}" type="button" aria-label="${esc(t('removeDetectionLanguage'))} ${esc(localName || nativeName)}">×</button>`
: `<span class="detection-language-lock">${esc(t('activeDetectionLanguage'))}</span>`
}
</div>
</article>
`;
}
function buildDetectionLanguageOption(code) {
const nativeName = capitalizeLanguageLabel(langName(code, code), code);
const localName = capitalizeLanguageLabel(langName(code));
const showLocalName = localName && localName !== nativeName;
return `
<button class="detection-language-card detection-language-card--add" data-detection-add="${esc(code)}" type="button">
<div class="detection-language-card__copy">
<strong>${esc(nativeName)}</strong>
<span>${esc(showLocalName ? localName : code.toUpperCase())}</span>
</div>
<span class="detection-language-add">+ ${esc(t('addDetectionLanguage'))}</span>
</button>
`;
}
function renderDetectionLanguages() {
const supported = getSupportedDetectionLanguages();
const selected = new Set(getSelectedDetectionLanguages());
const query = String(els.detectionLanguageSearch.value || '').trim().toLocaleLowerCase(locale());
const signature = [
locale(),
detectionLanguagesExpanded ? 'expanded' : 'compact',
query,
supported.join(','),
[...selected].sort().join(','),
].join('|');
if (renderCache.detectionLanguages === signature) {
return;
}
renderCache.detectionLanguages = signature;
const selectedLanguages = [...selected];
const extraLanguages = supported
.filter((code) => !selected.has(code))
.map((code) => ({
code,
label: capitalizeLanguageLabel(langName(code)),
nativeName: capitalizeLanguageLabel(langName(code, code), code),
}))
.sort((left, right) => left.label.localeCompare(right.label, locale()));
const filteredExtras = extraLanguages.filter((item) => {
const searchText = `${item.code} ${item.label} ${item.nativeName}`.toLocaleLowerCase(locale());
return !query || searchText.includes(query);
});
els.detectionLanguageDefaults.innerHTML = selectedLanguages
.map((code) => buildSelectedDetectionLanguageCard(code, selected.size > 1))
.join('');
els.detectionLanguageSummary.textContent = detectionLanguageSummary(selectedLanguages);
els.toggleDetectionLanguages.textContent = detectionLanguagesExpanded
? t('showLessLanguages')
: `${t('showMoreLanguages')} (${intFmt(extraLanguages.length)})`;
els.toggleDetectionLanguages.classList.toggle('hidden', extraLanguages.length === 0);
els.detectionLanguageMore.classList.toggle('hidden', !detectionLanguagesExpanded);
if (filteredExtras.length === 0) {
els.detectionLanguageList.innerHTML = `<div class="history-empty">${esc(t('noDetectionLanguageResults'))}</div>`;
return;
}
els.detectionLanguageList.innerHTML = filteredExtras
.map((item) => buildDetectionLanguageOption(item.code))
.join('');
}
function esc(value) {
return String(value || '')
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
function countLabel(count, singular, plural) {
return `${intFmt(count)} ${count === 1 ? singular : plural}`;
}
function modelLabel(modelId) {
const cloudModel = (lastState?.openRouterModels || []).find((model) => model.id === modelId);
return (
(MODEL_LABELS[modelId] && (MODEL_LABELS[modelId][locale()] || MODEL_LABELS[modelId].en)) ||
cloudModel?.name ||
modelId ||
'--'
);
}
function modelDescription(modelId) {
return (MODEL_DESCRIPTIONS[modelId] && (MODEL_DESCRIPTIONS[modelId][locale()] || MODEL_DESCRIPTIONS[modelId].en)) || modelId || '--';
}
function formatMs(ms) {
const value = Number(ms) || 0;
return value > 0 ? `${Math.round(value)} ms` : '--';
}
function formatCostUsd(value) {
const cost = Number(value) || 0;
if (cost <= 0) return '';
return new Intl.NumberFormat(locale(), {
style: 'currency',
currency: 'USD',