i18n/mki18n.py
changeset 1742 92932cd370a4
parent 1741 dd94b9a68c61
child 1744 69dfdb26f600
equal deleted inserted replaced
1741:dd94b9a68c61 1742:92932cd370a4
    86 # -----------------------------------------------------------------------------
    86 # -----------------------------------------------------------------------------
    87 # Global variables
    87 # Global variables
    88 # ----------------
    88 # ----------------
    89 #
    89 #
    90 
    90 
    91 __author__ = "Pierre Rouleau"
    91 __author__  = "Pierre Rouleau"
    92 __version__= "$Revision: 1.5 $"
    92 __version__ = "$Revision: 1.5 $"
    93 
    93 
    94 # -----------------------------------------------------------------------------
    94 # -----------------------------------------------------------------------------
    95 
    95 
    96 
    96 
    97 def getlanguageDict():
    97 def getlanguageDict():
   276     os.chdir(applicationDirectoryPath)
   276     os.chdir(applicationDirectoryPath)
   277 
   277 
   278     languageDict = getlanguageDict()
   278     languageDict = getlanguageDict()
   279 
   279 
   280     for langCode in languageDict.keys():
   280     for langCode in languageDict.keys():
   281         if (langCode == 'en') and (forceEnglish==0):
   281         if (langCode == 'en') and (forceEnglish == 0):
   282             pass
   282             pass
   283         else:
   283         else:
   284             langPOfileName = "%s_%s.po" % (applicationName, langCode)
   284             langPOfileName = "%s_%s.po" % (applicationName, langCode)
   285             if os.path.exists(langPOfileName):
   285             if os.path.exists(langPOfileName):
   286                 mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir, langCode)
   286                 mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir, langCode)
   381    """
   381    """
   382 
   382 
   383    # translate the path separators
   383    # translate the path separators
   384    directory = unixpath(directory)
   384    directory = unixpath(directory)
   385    # build a list of all directory elements
   385    # build a list of all directory elements
   386    aList = filter(lambda x: len(x)>0, directory.split('/'))
   386    aList = filter(lambda x: len(x) > 0, directory.split('/'))
   387    theLen = len(aList)
   387    theLen = len(aList)
   388    # if the first element is a Windows-style disk drive
   388    # if the first element is a Windows-style disk drive
   389    # concatenate it with the first directory
   389    # concatenate it with the first directory
   390    if aList[0].endswith(':'):
   390    if aList[0].endswith(':'):
   391       if theLen > 1:
   391       if theLen > 1: