One language setting; localized in-memory speech per language

This commit is contained in:
2026-10-09 23:09:07 +02:00
parent 98ec2fe9c4
commit f29af40b37
40 changed files with 77414 additions and 77240 deletions

View File

@@ -161,7 +161,7 @@ class SubtitleBox(QWidget):
self.lay.removeRow(e)
self.edits, self.keys = [], []
ws = self.win.ws
lines = ws.texts.for_sound(s) if ws and s else []
lines = ws.texts.for_sound(s, self.win.language) if ws and s else []
if not lines:
self.lbl.setText("No subtitle for this sound." if s else "")
for b in (self.b_apply, self.b_revert, self.b_open):
@@ -251,12 +251,11 @@ class TextPanel(QWidget):
self._timer.setInterval(150)
self._timer.timeout.connect(self._filter)
self.search.textChanged.connect(lambda _: self._timer.start())
self.cmb_lang = QComboBox()
self.cmb_lang.setToolTip("Language of the texts")
self.cmb_lang.activated.connect(lambda _: self.load(self.cmb_lang.currentText()))
self.lbl_lang = QLabel()
self.lbl_lang.setObjectName("Muted")
self.lbl_lang.setToolTip("Change the language with the Language list at the top of the window")
top.addWidget(self.search, 1)
top.addWidget(QLabel("Language"))
top.addWidget(self.cmb_lang)
top.addWidget(self.lbl_lang)
self.filters = {}
names = ("Character", "Category") if self.kind == "subs" else ("File",)
for name in names:
@@ -349,20 +348,16 @@ class TextPanel(QWidget):
return tx.subtitle_languages() if self.kind == "subs" else tx.menu_languages()
def load(self, lang=None):
"""(Re)load the rows of a language (default: the game's language)."""
"""(Re)load the rows of a language (default: the window's language)."""
ws = self.ws()
if not ws:
return
langs = self.languages()
lang = lang if lang in langs else (ws.game.language() if ws.game.language() in langs else
(langs[0] if langs else None))
self.cmb_lang.blockSignals(True)
self.cmb_lang.clear()
self.cmb_lang.addItems(langs)
if lang:
self.cmb_lang.setCurrentText(lang)
self.cmb_lang.blockSignals(False)
lang = lang or self.win.language
if lang not in self.languages():
lang = None
self.lang = lang
self.lbl_lang.setText("Language: %s" % lang if lang else "No %s in this language" % (
"subtitles" if self.kind == "subs" else "menu text"))
if not lang:
self.model.reset([], {})
return