summaryrefslogtreecommitdiff
path: root/onionshare
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2018-12-18 19:21:50 -0800
committerMicah Lee <micah@micahflee.com>2018-12-18 19:21:50 -0800
commit187b7887fd475ba3c1559d946bad9aa774338611 (patch)
treec771786e7a3991176b2722e3d886857bc9969b3b /onionshare
parenta06bb0878f5a7c0ebf20ceff48f278b9ae5e5e1a (diff)
parente6f26f65459489de6c59dda8bc8e4abc213ba762 (diff)
downloadonionshare-187b7887fd475ba3c1559d946bad9aa774338611.tar.gz
onionshare-187b7887fd475ba3c1559d946bad9aa774338611.zip
Merge branch '846_mac_packaging' into 406_osx_sandbox
Diffstat (limited to 'onionshare')
-rw-r--r--onionshare/settings.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/onionshare/settings.py b/onionshare/settings.py
index 00ba7d67..a1d96d26 100644
--- a/onionshare/settings.py
+++ b/onionshare/settings.py
@@ -112,7 +112,19 @@ class Settings(object):
# Choose the default locale based on the OS preference, and fall-back to English
if self._settings['locale'] is None:
- default_locale = locale.getdefaultlocale()[0][:2]
+ language_code, encoding = locale.getdefaultlocale()
+
+ # Default to English
+ if not language_code:
+ language_code = 'en_US'
+
+ if language_code == 'pt_PT' and language_code == 'pt_BR':
+ # Portuguese locales include country code
+ default_locale = language_code
+ else:
+ # All other locales cut off the country code
+ default_locale = language_code[:2]
+
if default_locale not in self.available_locales:
default_locale = 'en'
self._settings['locale'] = default_locale