def test_detect_system_language_translation_not_found(self, monkeypatch): """Tests detect_system_language() returns default if no translation found for system language.""" monkeypatch.setattr(QLocale, "name", lambda x: "fr_FR") assert detect_system_language() == "tr_en_US.qm"
def test_detect_system_language_translation_found(self, monkeypatch): """Tests detect_system_language() returns the appropriate translation filename for the system language.""" locales = ("ar_EG", "de_DE", "en_US", "fr_CA", "ja_JP", "nl_NL", "sv_SE", "zh_CN", "zh_HK") for locale in locales: monkeypatch.setattr(QLocale, "name", lambda x: locale) assert detect_system_language() == "tr_{}.qm".format(locale)