Back to index

plone3  3.1.7
Functions
setcomment Namespace Reference

Functions

def main

Detailed Description

   Usage: setcomment.py <product> <comment>

Function Documentation

def setcomment.main ( )

Definition at line 12 of file setcomment.py.

00012 
00013 def main():
00014     if len(sys.argv) < 2:
00015         print 'You have to specify the product.'
00016         sys.exit(1)
00017 
00018     product = getLongProductName(sys.argv[1])
00019 
00020     os.chdir('..')
00021     os.chdir('i18n')
00022 
00023     poFiles = getPoFiles(product, all=True)
00024     if poFiles == []:
00025         print 'No po-files were found for the given product.'
00026         sys.exit(2)
00027 
00028     for poFile in poFiles:
00029         try:
00030             po_ctl = catalog.MessageCatalog(filename=poFile)
00031         except IOError, e:
00032             print >> sys.stderr, 'I/O Error: %s' % e
00033 
00034         try:
00035             language = po_ctl.commentary_header[0].split('to ')[1:][0]
00036             po_ctl.commentary_header[0] = 'Translation of '+product+'.pot to '+language
00037         except IndexError:
00038             print poFile
00039 
00040         file = open(poFile+'-new', 'w')
00041         writer = catalog.POWriter(file, po_ctl)
00042         writer.write(sort=False)

Here is the call graph for this function: