Group :: Communications
RPM: wxdialer
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: wxdialer-gettext.patch
Download
Download
--- wxDialer.py.orig 2006-05-21 19:42:55 +0400
+++ wxDialer.py 2006-05-21 19:42:21 +0400
@@ -16,19 +16,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from gettext import gettext as _
-import locale
-try:
- locale.setlocale(locale.LC_ALL, '')
-except:
- print "Cannot set locale"
-import gettext
-gettext.textdomain("wxdialer")
-
-print _("Please wait, loading...")
+
+print "Please wait, loading..."
import sys
+import wx, gettext
try: from wxPython.wx import *
except:
print "You do not appear to have wxPython installed, or it is not\n" \
@@ -37,6 +29,25 @@
sys.exit()
import os, re, time
+# Lav: Fix from 21.05.2006. See http://wiki.wxpython.org/index.cgi/Internationalization for details
+# Hack to get the locale directory
+basepath = os.path.abspath(os.path.dirname(sys.argv[0]))
+localedir = os.path.join(basepath, "locale")
+langid = wx.LANGUAGE_DEFAULT # use OS default; or use LANGUAGE_JAPANESE, etc.
+domain = "wxdialer"
+
+# Set locale for wxWidgets
+mylocale = wx.Locale(langid)
+mylocale.AddCatalogLookupPathPrefix(localedir)
+mylocale.AddCatalog(domain)
+# Set up Python's gettext
+mytranslation = gettext.translation(domain, localedir,
+ [mylocale.GetCanonicalName()], fallback = True)
+mytranslation.install()
+
+#if wxLocale.GetSystemEncodingName() == "UTF-8" :
+_ = wx.GetTranslation
+print _("Please wait, loading...")
ver = "0.2.1"
HOME = os.environ["HOME"]