Improving localization
authorEugene Gagarin <mosfet07@ya.ru>
Wed, 29 Apr 2009 10:48:23 +0000 (14:48 +0400)
committerEugene Gagarin <mosfet07@ya.ru>
Wed, 29 Apr 2009 10:48:23 +0000 (14:48 +0400)
src/files/outtable.py
src/files/search.py
src/main.py
src/misc.py

index 9135445..b7219dc 100755 (executable)
@@ -2,6 +2,8 @@
 # -*-coding: utf-8 -*-
 # vim: sw=4 ts=4 expandtab ai
 
+from misc import _
+
 #==============================================================================
 
 # class OutTable_Control(object):
index 4816c90..6b15c4b 100755 (executable)
@@ -6,7 +6,7 @@ from os import walk
 from os.path import join, abspath, normcase, basename, isdir, getsize
 from heapq import nlargest
 
-from misc import *
+from misc import size_hum_read, _
 
 #==============================================================================
 
index fb86578..cd1bafb 100755 (executable)
@@ -6,6 +6,7 @@
 import sys
 
 from config import Config
+from misc import _
 
 __progname__ = 'FindIT'
 __version__ = '0.2.0'
@@ -39,18 +40,6 @@ under the terms of the GNU General Public License\nas published by the Free \
 Software Foundation; either version 3\nof the License, or (at your option) \
 any later version.'
 
-        import gettext
-        try:
-            # Meaning ru/LC_MESSAGES/program.mo in current dir (sys.path[0])
-            # For /usr/share/locale uncomment next string:
-            #LANGRU = gettext.translation('findit')
-            LANGRU = gettext.translation('findit', sys.path[0], languages=['ru'])
-            LANGRU.install()
-        except IOError:
-            # Comment out before use pygettext
-            def _(text): 
-                return text
-
 #==============================================================================
 
 class Cli_Presentation(object):
index b807c1d..a8a964f 100755 (executable)
@@ -8,3 +8,22 @@ def size_hum_read(size):
             if size < 1024**(i+1):
                 return unit % (size/1024.**i)
         return '>1024 Tb'
+
+#==============================================================================
+
+import sys
+import gettext
+import os
+
+os.environ['LANGUAGE'] = 'ru'   ###
+
+try:
+    # Meaning ru/LC_MESSAGES/findit.mo is in current dir (sys.path[0])
+    # For /usr/share/locale write `gettext.bindtextdomain('findit')`:
+    gettext.bindtextdomain('findit', sys.path[0])
+    gettext.textdomain('findit')
+    _ = gettext.gettext
+except IOError:
+    # Comment out before use pygettext
+    def _(text):
+        return text