[kupfer] main: Put locale and gettext init together



commit 01b6e14230ebbda3636f406531e0e84ad7bc4a0d
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Aug 20 20:29:30 2009 +0200

    main: Put locale and gettext init together

 kupfer/main.py |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/kupfer/main.py b/kupfer/main.py
index 4400dcc..ef61de1 100644
--- a/kupfer/main.py
+++ b/kupfer/main.py
@@ -1,10 +1,10 @@
+import gettext
+import locale
+
 _debug = False
 
-def setup_gettext():
+def setup_locale_and_gettext():
 	"""Set up localization with gettext"""
-	import gettext
-	import locale
-
 	package_name = "kupfer"
 	localedir = "./locale"
 	try:
@@ -20,15 +20,13 @@ def setup_gettext():
 			names=("ngettext",))
 	# also bind this for gtkbuilder (wtf?)
 	locale.bindtextdomain(package_name, localedir)
+	# to load in current locale properly for sorting etc
+	try:
+		locale.resetlocale()
+	except locale.Error, e:
+		pass
 
-setup_gettext()
-
-# to load in current locale properly for sorting etc
-import locale
-try:
-	locale.resetlocale()
-except locale.Error, e:
-	pass
+setup_locale_and_gettext()
 
 def get_options(default_opts=""):
 	"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]