Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
gettext.Parser Class Reference

List of all members.

Public Member Functions

def __init__
def format

Public Attributes

 raw
 request

Static Public Attributes

list extensions = ['.po']

Detailed Description

Definition at line 36 of file gettext.py.


Constructor & Destructor Documentation

def gettext.Parser.__init__ (   self,
  raw,
  request,
  kw 
)

Definition at line 39 of file gettext.py.

00039 
00040     def __init__(self, raw, request, **kw):
00041         self.raw = raw
00042         self.request = request


Member Function Documentation

def gettext.Parser.format (   self,
  formatter 
)

Definition at line 43 of file gettext.py.

00043 
00044     def format(self, formatter):
00045         PIPE = subprocess.PIPE
00046         STDOUT = subprocess.STDOUT
00047         p = subprocess.Popen(("msgfmt", "-c", "--statistics", "-", ), shell=False,
00048                              stdin=PIPE, stdout=PIPE, stderr=STDOUT)
00049 
00050         charset = config.charset
00051         textin = self.raw.encode(charset)
00052         out = p.communicate(input=textin)[0]
00053         if out is None:
00054             out = ''
00055         out = out.decode(charset).replace('<stdin>:', 'input data line ')
00056 
00057         # show po file data with line numbers as msgfmt refers to them
00058         text, lineno = [], 0
00059         for l in self.raw.splitlines():
00060             lineno += 1
00061             text.append("%04d: %s" % (lineno, l))
00062 
00063         textout = [formatter.heading(1, 3),
00064                    'Gettext status messages:',
00065                    formatter.heading(0, 3),
00066                    formatter.preformatted(1),
00067                    formatter.text(out),
00068                    formatter.preformatted(0),
00069                    formatter.heading(1, 3),
00070                    'Input:',
00071                    formatter.heading(0, 3),
00072                    formatter.preformatted(1),
00073                    formatter.text("\n".join(text)),
00074                    formatter.preformatted(0),
00075                   ]
00076 
00077         self.request.write(''.join(textout))
00078 

Here is the caller graph for this function:


Member Data Documentation

list gettext.Parser.extensions = ['.po'] [static]

Definition at line 37 of file gettext.py.

Definition at line 40 of file gettext.py.

Definition at line 41 of file gettext.py.


The documentation for this class was generated from the following file: