summaryrefslogtreecommitdiff
path: root/chirpw
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2014-06-26 12:55:21 -0600
committerIain R. Learmonth <irl@fsfe.org>2015-05-03 18:29:34 +0100
commit5e9167a4a78a45e58ae9969b41e70e9d77176376 (patch)
treeebc0c218856d44b1c60b62ba20ec9cd1b90e4791 /chirpw
parentdf2e8c36e9ce0a448c1ec9a9665644d95d3014c2 (diff)
parentc86187dcdf158df59977baee6c8d6385f964b69b (diff)
Imported Debian patch 0.4.0-1debian/0.4.0-1
Diffstat (limited to 'chirpw')
-rwxr-xr-xchirpw34
1 files changed, 26 insertions, 8 deletions
diff --git a/chirpw b/chirpw
index cd97918..570d13c 100755
--- a/chirpw
+++ b/chirpw
@@ -15,14 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
+from chirp import elib_intl
from chirp import platform, CHIRP_VERSION
from chirpui import config
# Hack to setup environment
platform.get_platform()
-import gtk
import sys
import os
import locale
@@ -51,12 +52,14 @@ conf = config.get()
manual_language = conf.get("language", "state")
langs = []
if manual_language and manual_language != "Auto":
- lang_codes = { "English" : "en_US",
- "Polish" : "pl",
- "Italian" : "it",
- "Dutch" : "nl",
- "German" : "de",
- "Hungarian" : "hu",
+ lang_codes = { "English" : "en_US",
+ "Polish" : "pl",
+ "Italian" : "it",
+ "Dutch" : "nl",
+ "German" : "de",
+ "Hungarian" : "hu",
+ "Russian" : "ru",
+ "Portuguese (BR)" : "pt_BR",
}
try:
print lang_codes[manual_language]
@@ -72,12 +75,21 @@ else:
except:
pass
+try:
+ if os.name == "nt":
+ elib_intl._putenv("LANG", langs[0])
+ else:
+ os.putenv("LANG", langs[0])
+except IndexError:
+ pass
path = "locale"
gettext.bindtextdomain("CHIRP", localepath)
gettext.textdomain("CHIRP")
lang = gettext.translation("CHIRP", localepath, languages=langs,
fallback=True)
+import gtk
+
# Python <2.6 does not have str.format(), which chirp uses to make translation
# strings nicer. So, instead of installing the gettext standard "_()" function,
# we can install our own, which returns a string of the following class,
@@ -91,7 +103,13 @@ class CompatStr(str):
return base
pyver = sys.version.split()[0]
-vmaj, vmin, vrel = pyver.split(".", 3)
+
+try :
+ vmaj, vmin, vrel = pyver.split(".", 3)
+except :
+ vmaj, vmin = pyver.split(".", 2)
+ vrel = 0
+
if int(vmaj) < 2 or int(vmin) < 6:
# Python <2.6, emulate str.format()
import __builtin__