summaryrefslogtreecommitdiff
path: root/chirpw
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@fsfe.org>2015-05-03 18:15:26 +0100
committerIain R. Learmonth <irl@fsfe.org>2015-05-03 18:15:26 +0100
commitc86187dcdf158df59977baee6c8d6385f964b69b (patch)
tree9b4f956c3bbfd9bbb48cf60aa75a32051e496d2c /chirpw
parent717fcf5fd76d3c672c609f336c80a675a548c4c6 (diff)
Imported Upstream version 0.4.0upstream/0.4.0
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__