Vidalia
0.3.1
|
#include <QFile>
#include <QFileInfo>
#include <QDomDocument>
#include <QTextStream>
#include <QTextCodec>
#include <QDateTime>
#include <stdlib.h>
#include "ts2po_config.h"
Go to the source code of this file.
Macros | |
#define | TS_DOCTYPE "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_ELEMENT_LOCATION "location" |
#define | TS_ATTR_FILENAME "filename" |
#define | TS_ATTR_LINE "line" |
Functions | |
QString | create_po_timestamp () |
QString | create_po_header (const QString &encoding) |
QString | parse_filename (const QString &filePath) |
int | convert_context (const QDomElement &context, QString *po, QString *errorMessage) |
int | ts2po (const QDomDocument *ts, QString *po, const QString &encoding, QString *errorMessage) |
void | print_usage_and_exit () |
int | main (int argc, char *argv[]) |
int convert_context | ( | const QDomElement & | context, |
QString * | po, | ||
QString * | errorMessage | ||
) |
Convert the messages in context to PO format. The output will be appended to po. Returns the number of source messages converted on success, or -1 on error and errorMessage will be set.
Definition at line 80 of file ts2po.cpp.
References parse_filename(), TS_ATTR_FILENAME, TS_ATTR_LINE, TS_ELEMENT_LOCATION, TS_ELEMENT_MESSAGE, TS_ELEMENT_NAME, TS_ELEMENT_SOURCE, and TS_ELEMENT_TRANSLATION.
Referenced by ts2po().
QString create_po_header | ( | const QString & | encoding | ) |
Return a header to be placed at the top of the .po file. The header will include encoding in the Content-Type header line.
Definition at line 43 of file ts2po.cpp.
References create_po_timestamp(), TS2PO_CONTACT_ADDR, TS2PO_LANGUAGE_TEAM, TS2PO_PROJECT_ID, and TS2PO_VERSION.
Referenced by ts2po().
QString create_po_timestamp | ( | ) |
Return the current time (in UTC) in the format YYYY-MM-DD HH:MM+0000.
Definition at line 34 of file ts2po.cpp.
Referenced by create_po_header().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 199 of file ts2po.cpp.
References tc::DebugMessage::arg(), tc::error(), i(), print_usage_and_exit(), and ts2po().
QString parse_filename | ( | const QString & | filePath | ) |
Parse the filename from the relative or absolute path given in filePath.
Definition at line 70 of file ts2po.cpp.
Referenced by convert_context().
void print_usage_and_exit | ( | ) |
Display application usage and exit.
Definition at line 185 of file ts2po.cpp.
References tc::error().
Referenced by main().
int ts2po | ( | const QDomDocument * | ts, |
QString * | po, | ||
const QString & | encoding, | ||
QString * | errorMessage | ||
) |
Convert the TS-formatted document in ts to a PO-formatted document. The output will be written to po, including a file header that specifies encoding as the character set. Returns the number of strings converted on success, or -1 on error and errorMessage will be set.
Definition at line 144 of file ts2po.cpp.
References convert_context(), create_po_header(), TS_DOCTYPE, and TS_ELEMENT_CONTEXT.
Referenced by main().