Philipp Hörist pushed to branch master at gajim / gajim

Commits:
40aa3d80 by Philipp Hörist at 2018-05-17T20:01:59+02:00
Remove unused comments

The attributes were removed in 8e09fd92

- - - - -
2a8c0da3 by Philipp Hörist at 2018-05-17T20:01:59+02:00
Use i18n module to determine locale

- - - - -
03aa1db3 by Philipp Hörist at 2018-05-17T20:01:59+02:00
Handle LC_ALL=C correctly

We default to 'en' for LANG if LC_ALL=C is set

- - - - -


2 changed files:

- gajim/common/connection.py
- gajim/common/i18n.py


Changes:

=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -71,6 +71,7 @@ from gajim.common import app
 from gajim.common import gpg
 from gajim.common import passwords
 from gajim.common import check_X509
+from gajim.common import i18n
 from gajim.common.connection_handlers import *
 from gajim.common.contacts import GC_Contact
 from gajim.gtkgui_helpers import get_action
@@ -619,12 +620,7 @@ class Connection(CommonConnection, ConnectionHandlers):
     def __init__(self, name):
         CommonConnection.__init__(self, name)
         ConnectionHandlers.__init__(self)
-        # this property is used to prevent double connections
-        # If we succeed to connect, remember it so next time we try (after a
-        # disconnection) we try only this type.
-        self.lang = None
-        if locale.getdefaultlocale()[0]:
-            self.lang = locale.getdefaultlocale()[0].split('_')[0]
+
         # increase/decrease default timeout for server responses
         self.try_connecting_for_foo_secs = 45
         # holds the actual hostname to which we are connected
@@ -1522,8 +1518,7 @@ class Connection(CommonConnection, ConnectionHandlers):
     # END connect
 
     def add_lang(self, stanza):
-        if self.lang:
-            stanza.setAttr('xml:lang', self.lang)
+        stanza.setAttr('xml:lang', i18n.LANG)
 
     def get_privacy_lists(self):
         if not app.account_is_connected(self.name):


=====================================
gajim/common/i18n.py
=====================================
--- a/gajim/common/i18n.py
+++ b/gajim/common/i18n.py
@@ -68,7 +68,10 @@ def initialize_lang():
     global LANG
     try:
         # en_US, fr_FR, el_GR etc..
-        LANG = locale.getdefaultlocale()[0]
+        default = locale.getdefaultlocale()[0]
+        if default is None:
+            # LC_ALL=C
+            return
         LANG = LANG[:2]
     except (ValueError, locale.Error):
         pass



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/4f29e2b353c2adec10c5754d56d8e0ba62fae426...03aa1db306384ff64b25bd3897db057e1eeec0f7

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/4f29e2b353c2adec10c5754d56d8e0ba62fae426...03aa1db306384ff64b25bd3897db057e1eeec0f7
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to