Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions locale/tts-biglinux.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2106,3 +2106,8 @@ msgstr ""
# File: tts-biglinux/usr/share/biglinux/tts-biglinux/window.py, line: 465
msgid "Restore"
msgstr ""

#
# File: tts-biglinux/usr/share/biglinux/tts-biglinux/services/desktop_integration_service.py, line: 297
msgid "Read or stop the selected text"
msgstr ""
5 changes: 5 additions & 0 deletions tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ def test_every_translated_string_is_a_literal_xgettext_can_extract():
arg = node.args[0] if node.args else None
if not (isinstance(arg, ast.Constant) and isinstance(arg.value, str)):
bad.append(f"{path.relative_to(APP)}:{node.lineno} _(non-literal)")
# Nor does it look inside f-strings: f"{_('x')}" is lost too.
if isinstance(node, ast.JoinedStr):
for inner in ast.walk(node):
if isinstance(inner, ast.Call) and isinstance(inner.func, ast.Name) and inner.func.id == "_":
bad.append(f"{path.relative_to(APP)}:{inner.lineno} _() inside an f-string")
assert not bad, bad


Expand Down
7 changes: 7 additions & 0 deletions tests/test_preview_lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
pytest.skip(f"GTK unavailable headless: {e}", allow_module_level=True)


@pytest.fixture(autouse=True)
def _only_lang(monkeypatch):
# LC_ALL/LC_MESSAGES win over LANG: builders run with LC_ALL=C.
monkeypatch.delenv("LC_ALL", raising=False)
monkeypatch.delenv("LC_MESSAGES", raising=False)


def test_espeak_voice_for_pt(monkeypatch):
monkeypatch.setenv("LANG", "pt_BR.UTF-8")
assert VoiceManagerDialog._espeak_voice_for_lang("pt_BR") == "pt-br"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_text_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def en(text: str, **kw) -> str:
# ── The voice's language decides, not the system's ────────────────────

def test_english_voice_on_a_portuguese_system(monkeypatch):
monkeypatch.delenv("LC_ALL", raising=False) # builders: LC_ALL=C
monkeypatch.delenv("LC_MESSAGES", raising=False)
monkeypatch.setenv("LANG", "pt_BR.UTF-8")
out = en("Mail john@example.com, 50% off at 5 p.m. with Dr. Jones")
assert "arroba" not in out and "cinquenta" not in out and "doutor" not in out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def ensure_desktop_file(kde_key: str) -> Path:

exec_path = DesktopIntegrationService._exec_path_for_speak()
# Name/GenericName are what the desktop's shortcut settings list.
# (_() outside the f-string: xgettext does not look inside f-strings.)
generic_name = _("Read or stop the selected text")
content = f"""[Desktop Entry]
Type=Application
Exec={exec_path}
Expand All @@ -302,7 +304,7 @@ def ensure_desktop_file(kde_key: str) -> Path:
NoDisplay=true
X-KDE-Shortcuts={kde_key}
Name=BigLinux TTS
GenericName={_("Read or stop the selected text")}
GenericName={generic_name}
"""
desktop_dst.parent.mkdir(parents=True, exist_ok=True)
desktop_dst.write_text(content, encoding="utf-8")
Expand Down Expand Up @@ -356,7 +358,8 @@ def write_kde_shortcut_config(cls, accel: str) -> None:
if group_prefix == "services":
val = kde_shortcut
else:
val = f"{kde_shortcut},{kde_shortcut},{_('Read or stop the selected text')}"
name = _("Read or stop the selected text")
val = f"{kde_shortcut},{kde_shortcut},{name}"
subprocess.run(cmd + [val], timeout=2, check=False)
else:
subprocess.run(cmd + ["--delete"], timeout=2, check=False)
Expand Down
Loading