From: Karl-Johan Karlsson Date: Mon, 12 Oct 2020 16:17:00 +0000 (+0200) Subject: Set language from LC_MESSAGES, not LC_CTYPE X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=5206d4614876a83f757155eabb9b18cb00984ad6;p=torbrowser-launcher.git Set language from LC_MESSAGES, not LC_CTYPE Calling `locale.getlocale()` checks LC_CTYPE, which is not meant for UI strings. Change the call to check LC_MESSAGES instead. Also call `locale.setlocale()` first to import the locale settings from the environment. This is not needed for LC_CTYPE due to https://bugs.python.org/issue6203 but is required for LC_MESSAGES. Closes #361 --- diff --git a/torbrowser_launcher/common.py b/torbrowser_launcher/common.py index 1a05fb4..94ae39c 100644 --- a/torbrowser_launcher/common.py +++ b/torbrowser_launcher/common.py @@ -100,7 +100,8 @@ class Common(object): "zh-CN", "zh-TW", ] - default_locale = locale.getlocale()[0] + locale.setlocale(locale.LC_MESSAGES, '') + default_locale = locale.getlocale(locale.LC_MESSAGES)[0] if default_locale is None: self.language = "en-US" else: