commit-gnue
[Top][All Lists]
Advanced

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

gnue/common/src GBaseApp.py GClientApp.py GComm...


From: James Thompson
Subject: gnue/common/src GBaseApp.py GClientApp.py GComm...
Date: Thu, 02 May 2002 17:20:33 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/05/02 17:20:33

Modified files:
        common/src     : GBaseApp.py GClientApp.py GComm.py 
                         GConditions.py GConfig.py GConnections.py 
                         GDebug.py GImport.py __init__.py 

Log message:
        Altered gettext support to be part of GBaseApp
        (GImport in each file should not be needed now)
        default _() override when gettext fails

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GBaseApp.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GClientApp.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GComm.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConditions.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConfig.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConnections.py.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDebug.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GImport.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/__init__.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gnue/common/src/GBaseApp.py
diff -c gnue/common/src/GBaseApp.py:1.14 gnue/common/src/GBaseApp.py:1.15
*** gnue/common/src/GBaseApp.py:1.14    Tue Apr 30 13:23:26 2002
--- gnue/common/src/GBaseApp.py Thu May  2 17:20:33 2002
***************
*** 39,45 ****
  import GConnections
  import GConfig
  import ConfigParser
! import GImport
  
  class GBaseApp:
  
--- 39,45 ----
  import GConnections
  import GConfig
  import ConfigParser
! #import GImport
  
  class GBaseApp:
  
***************
*** 67,72 ****
--- 67,85 ----
  
  
    def __init__(self, connections=None, application=None):
+     #
+     # i18n support
+     #
+     import gettext
+ 
+     try:
+       
gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations')
+     except IOError:
+       sys.stderr.write('Unable to load locale information falling back to 
dummy _()\n')    
+       import __builtin__
+       __builtin__.__dict__['_'] = lambda string:string
+ 
+ 
      # format of COMMAND_OPTIONS and _base_options:
      #  [option, option] where option is:
      #       [dictionary key name, short option, long option,
Index: gnue/common/src/GClientApp.py
diff -c gnue/common/src/GClientApp.py:1.13 gnue/common/src/GClientApp.py:1.14
*** gnue/common/src/GClientApp.py:1.13  Thu May  2 12:06:43 2002
--- gnue/common/src/GClientApp.py       Thu May  2 17:20:33 2002
***************
*** 33,39 ****
  #
  
  from GBaseApp import GBaseApp
! import GImport
  
  class GClientApp(GBaseApp): 
  
--- 33,39 ----
  #
  
  from GBaseApp import GBaseApp
! #import GImport
  
  class GClientApp(GBaseApp): 
  
Index: gnue/common/src/GComm.py
diff -c gnue/common/src/GComm.py:1.15 gnue/common/src/GComm.py:1.16
*** gnue/common/src/GComm.py:1.15       Thu May  2 12:08:45 2002
--- gnue/common/src/GComm.py    Thu May  2 17:20:33 2002
***************
*** 28,34 ****
  #
  
  import GDebug
! import GImport
  from gnue.common import dyn_import, openResource
  
  
--- 28,34 ----
  #
  
  import GDebug
! #import GImport
  from gnue.common import dyn_import, openResource
  
  
Index: gnue/common/src/GConditions.py
diff -c gnue/common/src/GConditions.py:1.11 gnue/common/src/GConditions.py:1.12
*** gnue/common/src/GConditions.py:1.11 Thu May  2 12:10:08 2002
--- gnue/common/src/GConditions.py      Thu May  2 17:20:33 2002
***************
*** 31,37 ****
  
  from GObjects import GObj
  import GTypecast
! import GImport
  
  class ConditionError (StandardError):
    pass
--- 31,37 ----
  
  from GObjects import GObj
  import GTypecast
! #import GImport
  
  class ConditionError (StandardError):
    pass
Index: gnue/common/src/GConfig.py
diff -c gnue/common/src/GConfig.py:1.17 gnue/common/src/GConfig.py:1.18
*** gnue/common/src/GConfig.py:1.17     Thu May  2 12:17:43 2002
--- gnue/common/src/GConfig.py  Thu May  2 17:20:33 2002
***************
*** 35,41 ****
  from gnue.common import openResource
  import GDebug
  import copy
! import GImport
  
  TRUE = 1
  FALSE = 0
--- 35,41 ----
  from gnue.common import openResource
  import GDebug
  import copy
! ##import GImport
  
  TRUE = 1
  FALSE = 0
Index: gnue/common/src/GConnections.py
diff -c gnue/common/src/GConnections.py:1.33 
gnue/common/src/GConnections.py:1.34
*** gnue/common/src/GConnections.py:1.33        Thu May  2 12:21:24 2002
--- gnue/common/src/GConnections.py     Thu May  2 17:20:33 2002
***************
*** 36,42 ****
  import GDataObjects
  import GLoginHandler
  from gnue.common import openResource, dyn_import
! import GImport
  
  class Error(StandardError):
    # Base error
--- 36,42 ----
  import GDataObjects
  import GLoginHandler
  from gnue.common import openResource, dyn_import
! #import GImport
  
  class Error(StandardError):
    # Base error
Index: gnue/common/src/GDebug.py
diff -c gnue/common/src/GDebug.py:1.7 gnue/common/src/GDebug.py:1.8
*** gnue/common/src/GDebug.py:1.7       Wed Apr 17 11:25:15 2002
--- gnue/common/src/GDebug.py   Thu May  2 17:20:33 2002
***************
*** 135,137 ****
--- 135,143 ----
  
  
  
+ 
+ 
+ 
+ 
+ 
+ 
Index: gnue/common/src/GImport.py
diff -c gnue/common/src/GImport.py:1.2 gnue/common/src/GImport.py:1.3
*** gnue/common/src/GImport.py:1.2      Tue Apr 30 12:54:01 2002
--- gnue/common/src/GImport.py  Thu May  2 17:20:33 2002
***************
*** 33,65 ****
  #
  
  import gettext
! import os
  
  try:
!   gettext.install('gnue',os.environ['INSTALL_PREFIX']+'/translations')
! except:
!   print """
!     If your error is like this:
!         File "/usr/lib/python2.1/gettext.py", line 251, 
!         in install translation(domain, localedir).install(unicode)
!         File "/usr/lib/python2.1/gettext.py", line 238, in translation
!         raise IOError(ENOENT, 'No translation file found for domain', domain)
!         IOError: [Errno 2] No translation file found for domain: 'gnue'
!     or
!       File "..../gnue/...../......py", line ..., in ?
!           _("some text goes here")
!       NameError: name '_' is not defined    
!                                           
!     Then check if in folder /common/translations exist subfolder called like
!     $LC_ALL shell variable (you can check it by echo $LC_ALL).
!     If folder does not exist, you can create it (and probably solve this 
error)
!     in such steps:
!                   0. cd ....common/translations
!                   1. mkdir $LC_ALL
!                   2. cd $LC_ALL
!                   3. mkdir LC_MESSAGES
!                   3. Copy there gnue.mo file from any other folder
!                      (cp ../en_US/LC_MESSAGES/gnue.mo LC_MESSAGES/gnue.mo)
!                      
!     That's all.
! """
--- 33,75 ----
  #
  
  import gettext
! from gnue.common import GConfig
  
  try:
!   
gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations')
! except IOError:
!   print "Whoops!"
!   import __builtin__
!   __builtin__.__dict__['_'] = lambda string:string
! 
! 
! 
! 
! 
! 
! 
! #  print """
! #    If your error is like this:
! #        File "/usr/lib/python2.1/gettext.py", line 251, 
! #       in install translation(domain, localedir).install(unicode)
! #        File "/usr/lib/python2.1/gettext.py", line 238, in translation
! #       raise IOError(ENOENT, 'No translation file found for domain', domain)
! #       IOError: [Errno 2] No translation file found for domain: 'gnue'
! #    or
! #     File "..../gnue/...../......py", line ..., in ?
! #          _("some text goes here")
! #     NameError: name '_' is not defined    
! #                                         
! #    Then check if in folder /common/translations exist subfolder called like
! #    $LC_ALL shell variable (you can check it by echo $LC_ALL).
! #    If folder does not exist, you can create it (and probably solve this 
error)
! #    in such steps:
! #                 0. cd ....common/translations
! #                 1. mkdir $LC_ALL
! #                 2. cd $LC_ALL
! #                 3. mkdir LC_MESSAGES
! #                 3. Copy there gnue.mo file from any other folder
! #                    (cp ../en_US/LC_MESSAGES/gnue.mo LC_MESSAGES/gnue.mo)
! #                    
! #    That's all.
! #"""
Index: gnue/common/src/__init__.py
diff -c gnue/common/src/__init__.py:1.9 gnue/common/src/__init__.py:1.10
*** gnue/common/src/__init__.py:1.9     Sun Feb 17 01:08:46 2002
--- gnue/common/src/__init__.py Thu May  2 17:20:33 2002
***************
*** 91,97 ****
  def lineWrap(message,maxWidth):
    text = ""
  
!   temptext = string.strip(message)
  
    for strings in string.split(temptext,"\n"):
      while len(strings) > maxWidth:
--- 91,97 ----
  def lineWrap(message,maxWidth):
    text = ""
  
!   temptext = string.strip(str(message))
  
    for strings in string.split(temptext,"\n"):
      while len(strings) > maxWidth:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]