diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-03-08 18:48:56 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-19 08:39:28 +0100 |
commit | f927eb52f0bcb8d326dbb35250878fcf1d798cf6 (patch) | |
tree | cfa0432a64fb1182eefa3df3a499c0e1426610ab | |
parent | 6597b915b8df43b905f937d0ad87ae9e560ab3b5 (diff) | |
download | qttools-f927eb52f0bcb8d326dbb35250878fcf1d798cf6.tar.gz |
fix translation contexts
the bootstrapped library now fakes the translation api sufficiently
well to enable unifying the usage.
Change-Id: I6a5d7cb1bb67830f1ea0a732566ebee354d62e7e
Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r-- | src/linguist/lupdate/main.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/po.cpp | 4 | ||||
-rw-r--r-- | src/linguist/shared/qm.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/qph.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/translator.cpp | 10 | ||||
-rw-r--r-- | src/linguist/shared/translator.h | 14 | ||||
-rw-r--r-- | src/linguist/shared/ts.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/xliff.cpp | 2 |
8 files changed, 10 insertions, 28 deletions
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index 56078a5ae..2d1590186 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -624,7 +624,7 @@ int main(int argc, char **argv) options |= NoSort; continue; } else if (arg == QLatin1String("-version")) { - printOut(QObject::tr("lupdate version %1\n").arg(QLatin1String(QT_VERSION_STR))); + printOut(LU::tr("lupdate version %1\n").arg(QLatin1String(QT_VERSION_STR))); return 0; } else if (arg == QLatin1String("-ts")) { metTsFlag = true; diff --git a/src/linguist/shared/po.cpp b/src/linguist/shared/po.cpp index 2f51e1c4e..3cf3a72e6 100644 --- a/src/linguist/shared/po.cpp +++ b/src/linguist/shared/po.cpp @@ -878,14 +878,14 @@ int initPO() { Translator::FileFormat format; format.extension = QLatin1String("po"); - format.description = QObject::tr("GNU Gettext localization files"); + format.description = FMT::tr("GNU Gettext localization files"); format.loader = &loadPO; format.saver = &savePO; format.fileType = Translator::FileFormat::TranslationSource; format.priority = 1; Translator::registerFileFormat(format); format.extension = QLatin1String("pot"); - format.description = QObject::tr("GNU Gettext localization template files"); + format.description = FMT::tr("GNU Gettext localization template files"); format.loader = &loadPO; format.saver = &savePOT; format.fileType = Translator::FileFormat::TranslationSource; diff --git a/src/linguist/shared/qm.cpp b/src/linguist/shared/qm.cpp index 418c12ee3..4b6cfdbce 100644 --- a/src/linguist/shared/qm.cpp +++ b/src/linguist/shared/qm.cpp @@ -733,7 +733,7 @@ int initQM() Translator::FileFormat format; format.extension = QLatin1String("qm"); - format.description = QObject::tr("Compiled Qt translations"); + format.description = FMT::tr("Compiled Qt translations"); format.fileType = Translator::FileFormat::TranslationBinary; format.priority = 0; format.loader = &loadQM; diff --git a/src/linguist/shared/qph.cpp b/src/linguist/shared/qph.cpp index 6f2541775..ac80f198e 100644 --- a/src/linguist/shared/qph.cpp +++ b/src/linguist/shared/qph.cpp @@ -191,7 +191,7 @@ int initQPH() Translator::FileFormat format; format.extension = QLatin1String("qph"); - format.description = QObject::tr("Qt Linguist 'Phrase Book'"); + format.description = FMT::tr("Qt Linguist 'Phrase Book'"); format.fileType = Translator::FileFormat::TranslationSource; format.priority = 0; format.loader = &loadQPH; diff --git a/src/linguist/shared/translator.cpp b/src/linguist/shared/translator.cpp index a722ad774..e3295e8bf 100644 --- a/src/linguist/shared/translator.cpp +++ b/src/linguist/shared/translator.cpp @@ -66,16 +66,6 @@ QT_BEGIN_NAMESPACE -#ifdef QT_BOOTSTRAPPED -QString QObject::tr(const char *sourceText, const char *, int n) -{ - QString ret = QString::fromLatin1(sourceText); - if (n >= 0) - ret.replace(QLatin1String("%n"), QString::number(n)); - return ret; -} -#endif - Translator::Translator() : m_locationsType(AbsoluteLocations), m_indexOk(true) diff --git a/src/linguist/shared/translator.h b/src/linguist/shared/translator.h index 17dc3d53d..e0820b047 100644 --- a/src/linguist/shared/translator.h +++ b/src/linguist/shared/translator.h @@ -44,6 +44,7 @@ #include "translatormessage.h" +#include <QCoreApplication> #include <QDir> #include <QList> #include <QLocale> @@ -54,18 +55,9 @@ QT_BEGIN_NAMESPACE -#ifdef QT_BOOTSTRAPPED -class QObject { -public: - static QString tr(const char *sourceText, const char * = 0, int n = -1); -}; -class QCoreApplication : public QObject { -public: - static QString translate(const char *, const char *sourceText, const char * = 0, - int n = -1) - { return tr(sourceText, 0, n); } +class FMT { + Q_DECLARE_TR_FUNCTIONS(Linguist) }; -#endif class QIODevice; diff --git a/src/linguist/shared/ts.cpp b/src/linguist/shared/ts.cpp index 38e76f9b1..2c8840d08 100644 --- a/src/linguist/shared/ts.cpp +++ b/src/linguist/shared/ts.cpp @@ -691,7 +691,7 @@ int initTS() format.extension = QLatin1String("ts"); format.fileType = Translator::FileFormat::TranslationSource; format.priority = 0; - format.description = QObject::tr("Qt translation sources"); + format.description = FMT::tr("Qt translation sources"); format.loader = &loadTS; format.saver = &saveTS; Translator::registerFileFormat(format); diff --git a/src/linguist/shared/xliff.cpp b/src/linguist/shared/xliff.cpp index b66fa89a7..a29c7bab1 100644 --- a/src/linguist/shared/xliff.cpp +++ b/src/linguist/shared/xliff.cpp @@ -837,7 +837,7 @@ int initXLIFF() { Translator::FileFormat format; format.extension = QLatin1String("xlf"); - format.description = QObject::tr("XLIFF localization files"); + format.description = FMT::tr("XLIFF localization files"); format.fileType = Translator::FileFormat::TranslationSource; format.priority = 1; format.loader = &loadXLIFF; |