Vidalia 0.2.15
|
#include <QHash>
#include <QFile>
#include <QDomDocument>
#include <QTextStream>
#include <QTextCodec>
#include <stdlib.h>
Go to the source code of this file.
Defines | |
#define | TS_DOCTYPE "TS" |
#define | TS_ELEMENT_ROOT "TS" |
#define | TS_ELEMENT_CONTEXT "context" |
#define | TS_ELEMENT_NAME "name" |
#define | TS_ELEMENT_MESSAGE "message" |
#define | TS_ELEMENT_SOURCE "source" |
#define | TS_ELEMENT_TRANSLATION "translation" |
#define | TS_ATTR_TRANSLATION_TYPE "type" |
#define | TS_ATTR_VERSION "version" |
Functions | |
QDomElement | new_context_element (QDomDocument *ts, const QString &contextName) |
QDomElement | new_message_element (QDomDocument *ts, const QString &msgid, const QString &msgstr) |
QDomDocument | new_ts_document () |
QString | parse_message_context (const QString &str) |
QString | parse_message_context_lame (const QString &str) |
QString | parse_message_string (const QString &msg) |
QString | read_next_line (QTextStream *stream) |
void | skip_po_header (QTextStream *po) |
int | po2ts (QTextStream *po, QDomDocument *ts, QString *errorMessage) |
void | print_usage_and_exit () |
int | main (int argc, char *argv[]) |
#define TS_ATTR_TRANSLATION_TYPE "type" |
Definition at line 25 of file po2ts.cpp.
Referenced by new_message_element().
#define TS_ATTR_VERSION "version" |
Definition at line 26 of file po2ts.cpp.
Referenced by new_ts_document().
#define TS_DOCTYPE "TS" |
Definition at line 18 of file po2ts.cpp.
Referenced by new_ts_document().
#define TS_ELEMENT_CONTEXT "context" |
Definition at line 20 of file po2ts.cpp.
Referenced by new_context_element().
#define TS_ELEMENT_MESSAGE "message" |
Definition at line 22 of file po2ts.cpp.
Referenced by new_message_element().
#define TS_ELEMENT_NAME "name" |
Definition at line 21 of file po2ts.cpp.
Referenced by new_context_element().
#define TS_ELEMENT_ROOT "TS" |
Definition at line 19 of file po2ts.cpp.
Referenced by new_ts_document().
#define TS_ELEMENT_SOURCE "source" |
Definition at line 23 of file po2ts.cpp.
Referenced by new_message_element().
#define TS_ELEMENT_TRANSLATION "translation" |
Definition at line 24 of file po2ts.cpp.
Referenced by new_message_element().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 246 of file po2ts.cpp.
References tc::error(), i(), po2ts(), and print_usage_and_exit().
QDomElement new_context_element | ( | QDomDocument * | ts, |
const QString & | contextName | ||
) |
Create a new context element with the name contextName.
Definition at line 31 of file po2ts.cpp.
References TS_ELEMENT_CONTEXT, and TS_ELEMENT_NAME.
Referenced by po2ts().
QDomElement new_message_element | ( | QDomDocument * | ts, |
const QString & | msgid, | ||
const QString & | msgstr | ||
) |
Create a new message element using the source string msgid and the translation msgstr.
Definition at line 48 of file po2ts.cpp.
References TS_ATTR_TRANSLATION_TYPE, TS_ELEMENT_MESSAGE, TS_ELEMENT_SOURCE, and TS_ELEMENT_TRANSLATION.
QDomDocument new_ts_document | ( | ) |
Create a new TS document of the appropriate doctype and with a TS root element.
Definition at line 76 of file po2ts.cpp.
References TS_ATTR_VERSION, TS_DOCTYPE, and TS_ELEMENT_ROOT.
Referenced by po2ts().
QString parse_message_context | ( | const QString & | str | ) |
QString parse_message_context_lame | ( | const QString & | str | ) |
QString parse_message_string | ( | const QString & | msg | ) |
int po2ts | ( | QTextStream * | po, |
QDomDocument * | ts, | ||
QString * | errorMessage | ||
) |
Convert po from the PO format to a TS-formatted XML document. ts will be set to the resulting TS document. Return the number of converted strings on success, or -1 on error and errorMessage will be set.
Definition at line 152 of file po2ts.cpp.
References new_context_element(), new_message_element(), new_ts_document(), parse_message_context(), parse_message_context_lame(), parse_message_string(), read_next_line(), and skip_po_header().
Referenced by main().
void print_usage_and_exit | ( | ) |
Display application usage and exit.
Definition at line 232 of file po2ts.cpp.
References tc::error().
QString read_next_line | ( | QTextStream * | stream | ) |