/[papo]/gnue/common/src/GBaseApp.py
ViewVC logotype

Diff of /gnue/common/src/GBaseApp.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by styxman, Fri Nov 15 15:32:54 2002 UTC revision 1.4.2.1 by anthonyl, Tue Mar 4 22:09:32 2003 UTC
# Line 16  Line 16 
16  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
17  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
18  #  #
19  # Copyright 2000-2002 Free Software Foundation  # Copyright 2000-2003 Free Software Foundation
20  #  #
21  # FILE:  # FILE:
22  # GBaseApp.py  # GBaseApp.py
# Line 43  from gnue.common.TextUtils import lineWr Line 43  from gnue.common.TextUtils import lineWr
43  import locale  import locale
44    
45  locale.setlocale(locale.LC_ALL, '')  locale.setlocale(locale.LC_ALL, '')
46  try:  
47    # gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations')  # Important for now _() to be defined here
48    # no need for LC_ALL on win2k and XP with this variant  import __builtin__
49    lang = [locale.getdefaultlocale()[0]]  __builtin__.__dict__['_'] = lambda string:string
   gettext.translation('gnue',GConfig.getInstalledBase('install_prefix')+'/translations',languages=lang).install()  
 except:  
 #  sys.stderr.write('Unable to load locale information falling back to default English language translations.\n')  
   import __builtin__  
   __builtin__.__dict__['_'] = lambda string:string  
50    
51    
52  import GDebug  import GDebug
# Line 227  class GBaseApp: Line 222  class GBaseApp:
222          if not p in sys.path:          if not p in sys.path:
223            sys.path.append(p)            sys.path.append(p)
224    
225        try:
226          # gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations')
227          # no need for LC_ALL on win2k and XP with this variant
228          lang = [locale.getdefaultlocale()[0]]
229          global catalog, textEncoding
230          catalog = gettext.translation('gnue',GConfig.getInstalledBase('install_prefix')+'/translations',languages=lang)
231          catalog.install(unicode=1)
232          textEncoding = gConfig('textEncoding')
233          if not catalog.charset():
234            raise InvalidFormatError, "Translation file is badly formatted for unicode operation"
235          
236          def translate(msg):
237            global catalog  
238            return catalog.ugettext(msg).encode(textEncoding)
239        
240          import __builtin__  
241          __builtin__.__dict__['_'] = translate
242        except:
243          sys.stderr.write('Unable to load locale information falling back to default English language translations.\n')
244          import __builtin__
245          __builtin__.__dict__['_'] = lambda string:string
246    
247    
248    
249    
250      # Get the connection definitions      # Get the connection definitions
251      if connections != None:      if connections != None:
252        GDebug.printMesg(1,"Reusing connections instance")        GDebug.printMesg(1,"Reusing connections instance")

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26