Back to index

plone3  3.1.7
Functions
create Namespace Reference

Functions

def main

Detailed Description

   Usage: create.py <target-product> <source-product>

   Creates copies of all existing po files of the source product under the name of the target product.
   This is useful to preserves headers of the files and to give a starting point for work.

   You have to run merge after that, to remove the wrong msgid's and include the one's from the actual product

   Using admix.py can then copy over existing translations.

Function Documentation

def create.main ( )

Definition at line 16 of file create.py.

00016 
00017 def main():
00018     if len(sys.argv) < 3:
00019         print 'You have to specify the target and source product.'
00020         sys.exit(1)
00021 
00022     target = sys.argv[1]
00023     source = sys.argv[2]
00024 
00025     os.chdir('..')
00026 
00027     sourcePoFiles = getPoFiles(source)
00028 
00029     if sourcePoFiles == []:
00030         print 'No po-files were found for the source product.'
00031         sys.exit(3)
00032 
00033     for sourcefile in sourcePoFiles:
00034         sourceLanguage = getLanguage(source,sourcefile)
00035         if sourceLanguage:
00036             targetfile = target + '-' + sourceLanguage + '.po'
00037             targetpath = os.path.join(os.curdir, targetfile)
00038             if not os.path.exists(targetpath):
00039                 shutil.copy(sourcefile, targetfile)

Here is the call graph for this function: