Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.i18n.msgfmt Namespace Reference

Classes

class  SyntaxErrorException
class  MsgFmt

Functions

def make
def usage
def main

Variables

string __version__ = "1.3"

Class Documentation

class MoinMoin::i18n::msgfmt::SyntaxErrorException
raised when having trouble parsing the po file content

Definition at line 34 of file msgfmt.py.


Function Documentation

Definition at line 176 of file msgfmt.py.

00176 
00177 def main():
00178     try:
00179         opts, args = getopt.getopt(sys.argv[1:], 'hVo:', ['help', 'version', 'output-file='])
00180     except getopt.error, msg:
00181         usage(1, msg)
00182 
00183     outfile = None
00184     # parse options
00185     for opt, arg in opts:
00186         if opt in ('-h', '--help'):
00187             usage(0)
00188         elif opt in ('-V', '--version'):
00189             print >> sys.stderr, "msgfmt.py", __version__
00190             sys.exit(0)
00191         elif opt in ('-o', '--output-file'):
00192             outfile = arg
00193     # do it
00194     if not args:
00195         print >> sys.stderr, 'No input file given'
00196         print >> sys.stderr, "Try `msgfmt --help' for more information."
00197         return
00198 
00199     for filename in args:
00200         make(filename, outfile)
00201 

Here is the call graph for this function:

def MoinMoin.i18n.msgfmt.make (   filename,
  outfile 
)

Definition at line 149 of file msgfmt.py.

00149 
00150 def make(filename, outfile):
00151     mf = MsgFmt()
00152     infile, outfile = mf.make_filenames(filename, outfile)
00153     try:
00154         lines = file(infile).readlines()
00155     except IOError, msg:
00156         print >> sys.stderr, msg
00157         sys.exit(1)
00158     try:
00159         mf.read_po(lines)
00160         output = mf.generate_mo()
00161     except SyntaxErrorException, msg:
00162         print >> sys.stderr, msg
00163 
00164     try:
00165         open(outfile, "wb").write(output)
00166     except IOError, msg:
00167         print >> sys.stderr, msg
00168 

Here is the caller graph for this function:

def MoinMoin.i18n.msgfmt.usage (   code,
  msg = '' 
)

Definition at line 169 of file msgfmt.py.

00169 
00170 def usage(code, msg=''):
00171     print >> sys.stderr, __doc__
00172     if msg:
00173         print >> sys.stderr, msg
00174     sys.exit(code)
00175 

Here is the caller graph for this function:


Variable Documentation

Definition at line 32 of file msgfmt.py.