nsh2po.cpp File Reference

#include <QHash>
#include <QFile>
#include <QTextStream>
#include <QTextCodec>
#include <QDateTime>
#include <QStringList>
#include <stdlib.h>
#include "nsh2po_config.h"

Go to the source code of this file.

Functions

QString parse_message_context (const QString &str)
QString parse_message_context_lame (const QString &str)
QString parse_message_string (const QString &msg)
QString parse_nsh_langstring (const QString &msg)
QString create_po_timestamp ()
QString create_po_header (const QString &charset)
QString read_next_line (QTextStream *stream)
void skip_pot_header (QTextStream *pot)
bool parse_po_template (QTextStream *pot, QHash< QString, QString > *out, QString *errmsg)
int nsh2po (QTextStream *nsh, const QString &charset, const QHash< QString, QString > &pot, QString *po, QString *errmsg)
bool write_po_output (const char *poFileName, const QString &po, QTextCodec *codec, QString *errmsg)
void print_usage_and_exit ()
int main (int argc, char *argv[])

Function Documentation

QString create_po_header ( const QString &  charset  ) 

Return a header to be placed at the top of the .po file.

Definition at line 83 of file nsh2po.cpp.

References create_po_timestamp().

Referenced by nsh2po(), and ts2po().

QString create_po_timestamp (  ) 

Return the current time (in UTC) in the format YYYY-MM-DD HH:MM+0000.

Definition at line 75 of file nsh2po.cpp.

Referenced by create_po_header().

int main ( int  argc,
char *  argv[] 
)
int nsh2po ( QTextStream *  nsh,
const QString &  charset,
const QHash< QString, QString > &  pot,
QString *  po,
QString *  errmsg 
)

Read an NSIS-formatted file containing LangString entries from nsh. If a LangString entry has a corresponding entry in pot, then the message entry is PO-formatted and appended to po. Return true on success, or false on failure and errmsg will be set.

Definition at line 191 of file nsh2po.cpp.

References create_po_header(), parse_nsh_langstring(), and read_next_line().

Referenced by main().

QString parse_message_context ( const QString &  str  ) 

Parse the context name from str, where the context name is of the form DQUOTE ContextName DQUOTE.

Definition at line 25 of file nsh2po.cpp.

Referenced by parse_po_template(), po2nsh(), and po2ts().

QString parse_message_context_lame ( const QString &  str  ) 

Parse the context name from str, where str is of the form ContextName::Number. This is the format used by translate-toolkit.

Definition at line 35 of file nsh2po.cpp.

Referenced by parse_po_template(), po2nsh(), and po2ts().

QString parse_message_string ( const QString &  msg  ) 

Parse the PO-formatted message string from msg.

Definition at line 44 of file nsh2po.cpp.

Referenced by parse_po_template(), po2nsh(), and po2ts().

QString parse_nsh_langstring ( const QString &  msg  ) 

Parse the NSIS-formatted LangString message from msg.

Definition at line 59 of file nsh2po.cpp.

Referenced by nsh2po().

bool parse_po_template ( QTextStream *  pot,
QHash< QString, QString > *  out,
QString *  errmsg 
)

Parse a PO template file for (context,source string) pairs, which are be stored in out using msgctxt as the key and msgid as the value. Return true on success, or false on failure and set errmsg.

Definition at line 136 of file nsh2po.cpp.

References parse_message_context(), parse_message_context_lame(), parse_message_string(), read_next_line(), and skip_pot_header().

Referenced by main().

void print_usage_and_exit (  ) 

Display application usage and exit.

Definition at line 259 of file nsh2po.cpp.

References tc::error().

Referenced by main().

QString read_next_line ( QTextStream *  stream  ) 

Read and return the next non-empty line from stream.

Definition at line 109 of file nsh2po.cpp.

Referenced by nsh2po(), parse_po_template(), po2nsh(), and po2ts().

void skip_pot_header ( QTextStream *  pot  ) 

Skip past the header portion of the POT file and any leading whitespace. The next line read from po will be the first non-header line in the document.

Definition at line 120 of file nsh2po.cpp.

Referenced by parse_po_template().

bool write_po_output ( const char *  poFileName,
const QString &  po,
QTextCodec *  codec,
QString *  errmsg 
)

Write po to poFileName using codec. Return true on success. On failure, return false and set errmsg to the reason for failure.

Definition at line 242 of file nsh2po.cpp.

Referenced by main().


Generated on Wed Dec 23 21:06:55 2009 for Vidalia by  doxygen 1.6.1