From 4944ea0586ce2b4d39ae141e4e0fd74804ade93f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Date: Wed, 6 Mar 2013 14:44:59 +0100 Subject: [PATCH] purge CODECFORTR & -codecfortr support qt-based code is expected to be utf8-encoded nowadays. the respective c++ interfaces have been purged in 5.0 already. Change-Id: I592b49f198aae05212afbf8d3aa2b01b1e9369dd Reviewed-by: Robin Burchell <robin+qt@viroteck.net> --- src/linguist/lconvert/main.cpp | 14 --- .../doc/snippets/doc_src_linguist-manual.pro | 5 - .../linguist/doc/src/linguist-manual.qdoc | 32 +---- src/linguist/linguist/main.cpp | 1 - src/linguist/linguist/messagemodel.cpp | 3 - src/linguist/linguist/messagemodel.h | 1 - src/linguist/lupdate/cpp.cpp | 66 ++++------ src/linguist/lupdate/java.cpp | 5 +- src/linguist/lupdate/main.cpp | 43 +------ src/linguist/lupdate/merge.cpp | 3 - src/linguist/lupdate/ui.cpp | 5 +- src/linguist/shared/po.cpp | 9 +- src/linguist/shared/qm.cpp | 115 ++++-------------- src/linguist/shared/translator.cpp | 32 +---- src/linguist/shared/translator.h | 7 -- src/linguist/shared/translatormessage.cpp | 20 +-- src/linguist/shared/translatormessage.h | 7 -- src/linguist/shared/ts.cpp | 35 +----- .../linguist/lconvert/data/codec-cp1252.ts | 28 ----- .../auto/linguist/lconvert/data/codec-utf8.ts | 1 - .../linguist/lconvert/data/dual-encoding.ts | 11 -- tests/auto/linguist/lconvert/tst_lconvert.cpp | 1 - .../auto/linguist/lrelease/testdata/dupes.ts | 4 - .../lrelease/testdata/mixedcodecs-ts20.ts | 18 --- tests/auto/linguist/lrelease/tst_lrelease.cpp | 21 +--- .../testdata/good/codecforsrc/main.cpp | 2 +- .../testdata/good/codecforsrc/project.pro | 1 - .../good/codecforsrc/project.ts.result | 1 - .../lupdate/testdata/good/codecfortr/main.cpp | 65 ---------- .../testdata/good/codecfortr/project.pro | 7 -- .../good/codecfortr/project.ts.result | 13 -- .../testdata/good/codecfortr1/main.cpp | 63 ---------- .../testdata/good/codecfortr1/project.pro | 7 -- .../good/codecfortr1/project.ts.result | 38 ------ .../testdata/good/codecfortr2/main.cpp | 62 ---------- .../testdata/good/codecfortr2/project.pro | 8 -- .../good/codecfortr2/project.ts.result | 33 ----- .../good/codecfortr3/expectedoutput.txt | 1 - .../testdata/good/codecfortr3/main.cpp | 45 ------- .../testdata/good/codecfortr3/project.pro | 5 - .../good/codecfortr3/project.ts.before | 13 -- .../good/codecfortr3/project.ts.result | 12 -- .../good/codecfortr4/expectedoutput.txt | 0 .../testdata/good/codecfortr4/main.cpp | 45 ------- .../testdata/good/codecfortr4/project.pro | 5 - .../good/codecfortr4/project.ts.before | 13 -- .../good/codecfortr4/project.ts.result | 13 -- .../good/parse_special_chars/main.cpp | 4 +- .../testdata/good/parsecpp/project.ts.result | 2 +- .../testdata/good/parseui/project.ts.result | 2 +- .../good/recurse_full/project_sub.ts.result | 1 - .../good/recurse_part/project_sub.ts.result | 1 - .../subdirs_full/subdir2/subsub2/subsub2.pro | 1 - .../subdirs_part/subdir2/subsub2/subsub2.pro | 1 - 54 files changed, 69 insertions(+), 882 deletions(-) delete mode 100644 tests/auto/linguist/lconvert/data/codec-cp1252.ts delete mode 100644 tests/auto/linguist/lconvert/data/dual-encoding.ts delete mode 100644 tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before delete mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result diff --git a/src/linguist/lconvert/main.cpp b/src/linguist/lconvert/main.cpp index af1576c97..edac6fe60 100644 --- a/src/linguist/lconvert/main.cpp +++ b/src/linguist/lconvert/main.cpp @@ -90,12 +90,6 @@ static int usage(const QStringList &args) " -of <outformat>\n" " --output-format <outformat>\n" " Specify output format. See -if.\n\n" - " --input-codec <codec>\n" - " Specify encoding for QM and PO input files. Default is 'Latin1'\n" - " for QM and 'UTF-8' for PO files. UTF-8 is always tried as well for\n" - " QM, corresponding to the possible use of the trUtf8() function.\n\n" - " --output-codec <codec>\n" - " Specify encoding for PO output files. Default is 'UTF-8'.\n\n" " --drop-tags <regexp>\n" " Drop named extra tags when writing TS or XLIFF files.\n" " May be specified repeatedly.\n\n" @@ -195,14 +189,6 @@ int main(int argc, char *argv[]) if (++i >= args.size()) return usage(args); inFormat = args[i]; - } else if (args[i] == QLatin1String("-input-codec")) { - if (++i >= args.size()) - return usage(args); - cd.m_codecForSource = args[i].toLatin1(); - } else if (args[i] == QLatin1String("-output-codec")) { - if (++i >= args.size()) - return usage(args); - cd.m_outputCodec = args[i].toLatin1(); } else if (args[i] == QLatin1String("-drop-tag")) { if (++i >= args.size()) return usage(args); diff --git a/src/linguist/linguist/doc/snippets/doc_src_linguist-manual.pro b/src/linguist/linguist/doc/snippets/doc_src_linguist-manual.pro index 772bdf1b7..d89cb10b5 100644 --- a/src/linguist/linguist/doc/snippets/doc_src_linguist-manual.pro +++ b/src/linguist/linguist/doc/snippets/doc_src_linguist-manual.pro @@ -52,11 +52,6 @@ TRANSLATIONS = superapp_dk.ts \ #! [0] -#! [1] -CODECFORTR = ISO-8859-5 -#! [1] - - #! [2] CODECFORSRC = UTF-8 #! [2] diff --git a/src/linguist/linguist/doc/src/linguist-manual.qdoc b/src/linguist/linguist/doc/src/linguist-manual.qdoc index 852a006bd..d1af32be2 100644 --- a/src/linguist/linguist/doc/src/linguist-manual.qdoc +++ b/src/linguist/linguist/doc/src/linguist-manual.qdoc @@ -159,22 +159,9 @@ files: \snippet doc_src_linguist-manual.pro 0 - \snippet doc_src_linguist-manual.pro 1 - QTextCodec::setCodecForTr() makes it possible to choose a 8-bit - encoding for literal strings that appear within \c tr() calls. - This is useful for applications whose source language is, for - example, Chinese or Japanese. If no encoding is set, \c tr() uses - Latin1. - - If you do use the QTextCodec::codecForTr() mechanism in your - application, \QL needs you to set the \c CODECFORTR - entry in the \c .pro file as well. For example: - - \snippet doc_src_linguist-manual.pro 1 - - Also, if your compiler uses a different encoding for its runtime - system as for its source code and you want to use non-ASCII + If your compiler uses a different encoding for its runtime + system than for its source code and you want to use non-ASCII characters in string literals, you will need to set the \c CODECFORSRC. For example: @@ -1269,15 +1256,6 @@ \snippet arrowpad/arrowpad.pro 1 - If your sources contain genuine non-Latin1 strings, - lupdate needs - to be told about it in the \c .pro file by using, for example, - the following line: - - \code - CODECFORTR = UTF-8 - \endcode - For more information, see \l{Using lupdate} and \l{Using lrelease}. \section2 Loading Translations @@ -1297,12 +1275,6 @@ \snippet arrowpad/main.cpp 0 \snippet arrowpad/main.cpp 1 - For non-Latin1 strings in the sources you will also need for example: - - \code - QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); - \endcode - In production applications a more flexible approach, for example, loading translations according to locale, might be more appropriate. If the TS files are all named according to a convention such as diff --git a/src/linguist/linguist/main.cpp b/src/linguist/linguist/main.cpp index f53399f79..1ca3b293c 100644 --- a/src/linguist/linguist/main.cpp +++ b/src/linguist/linguist/main.cpp @@ -46,7 +46,6 @@ #include <QtCore/QLibraryInfo> #include <QtCore/QLocale> #include <QtCore/QSettings> -#include <QtCore/QTextCodec> #include <QtCore/QTranslator> #include <QtWidgets/QApplication> diff --git a/src/linguist/linguist/messagemodel.cpp b/src/linguist/linguist/messagemodel.cpp index 553e223e9..bf45ea8fc 100644 --- a/src/linguist/linguist/messagemodel.cpp +++ b/src/linguist/linguist/messagemodel.cpp @@ -43,7 +43,6 @@ #include <QtCore/QCoreApplication> #include <QtCore/QDebug> -#include <QtCore/QTextCodec> #include <QtWidgets/QMessageBox> #include <QtGui/QPainter> @@ -243,7 +242,6 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent } m_srcFileName = fileName; - m_codecName = tor.codecName(); m_relativeLocations = (tor.locationsType() == Translator::RelativeLocations); m_extra = tor.extras(); m_contextList.clear(); @@ -336,7 +334,6 @@ bool DataModel::save(const QString &fileName, QWidget *parent) tor.setLanguageCode(Translator::makeLanguageCode(m_language, m_country)); tor.setSourceLanguageCode(Translator::makeLanguageCode(m_sourceLanguage, m_sourceCountry)); - tor.setCodecName(m_codecName); tor.setLocationsType(m_relativeLocations ? Translator::RelativeLocations : Translator::AbsoluteLocations); tor.setExtras(m_extra); diff --git a/src/linguist/linguist/messagemodel.h b/src/linguist/linguist/messagemodel.h index 9c2e75c90..76dd2db23 100644 --- a/src/linguist/linguist/messagemodel.h +++ b/src/linguist/linguist/messagemodel.h @@ -257,7 +257,6 @@ private: QLocale::Language m_sourceLanguage; QLocale::Country m_country; QLocale::Country m_sourceCountry; - QByteArray m_codecName; bool m_relativeLocations; Translator::ExtraData m_extra; diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index f3063a188..8288cbff5 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -246,15 +246,15 @@ private: bool getMacroArgs(); bool match(uint t); bool matchString(QString *s); - bool matchEncoding(bool *utf8); + bool matchEncoding(); bool matchStringOrNull(QString *s); bool matchExpression(); - QString transcode(const QString &str, bool utf8); + QString transcode(const QString &str); void recordMessage( int line, const QString &context, const QString &text, const QString &comment, const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, - bool utf8, bool plural); + bool plural); void processInclude(const QString &file, ConversionData &cd, const QStringList &includeStack, QSet<QString> &inclusions); @@ -308,8 +308,6 @@ private: QString yyFileName; int yyCh; bool yyAtNewline; - bool yyCodecIsUtf8; - bool yyForceUtf8; QString yyWord; qlonglong yyInteger; QStack<IfdefState> yyIfdefStack; @@ -378,7 +376,6 @@ void CppParser::setInput(const QString &in) yyInStr = in; yyFileName = QString(); yySourceCodec = 0; - yyForceUtf8 = true; } void CppParser::setInput(QTextStream &ts, const QString &fileName) @@ -386,7 +383,6 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName) yyInStr = ts.readAll(); yyFileName = fileName; yySourceCodec = ts.codec(); - yyForceUtf8 = false; } /* @@ -1460,7 +1456,7 @@ STRING(UnicodeUTF8); STRING(DefaultCodec); STRING(CodecForTr); -bool CppParser::matchEncoding(bool *utf8) +bool CppParser::matchEncoding() { if (yyTok != Tok_Ident) return false; @@ -1469,16 +1465,11 @@ bool CppParser::matchEncoding(bool *utf8) if (yyTok == Tok_ColonColon) yyTok = getToken(); } - if (yyWord == strUnicodeUTF8) { - *utf8 = true; - yyTok = getToken(); - return true; - } - if (yyWord == strDefaultCodec || yyWord == strCodecForTr) { - *utf8 = false; + if (yyWord == strUnicodeUTF8 || yyWord == strDefaultCodec || yyWord == strCodecForTr) { yyTok = getToken(); return true; } + yyMsg() << qPrintable(LU::tr("Unsupported encoding Latin1\n")); return false; } @@ -1530,12 +1521,12 @@ bool CppParser::matchExpression() return true; } -QString CppParser::transcode(const QString &str, bool utf8) +QString CppParser::transcode(const QString &str) { static const char tab[] = "abfnrtv"; static const char backTab[] = "\a\b\f\n\r\t\v"; // This function has to convert back to bytes, as C's \0* sequences work at that level. - const QByteArray in = yyForceUtf8 ? str.toUtf8() : tor->codec()->fromUnicode(str); + const QByteArray in = str.toUtf8(); QByteArray out; out.reserve(in.length()); @@ -1574,33 +1565,25 @@ QString CppParser::transcode(const QString &str, bool utf8) out += c; } } - return (utf8 || yyForceUtf8) ? QString::fromUtf8(out.constData(), out.length()) - : tor->codec()->toUnicode(out); + return QString::fromUtf8(out.constData(), out.length()); } -void CppParser::recordMessage( - int line, const QString &context, const QString &text, const QString &comment, - const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, - bool utf8, bool plural) +void CppParser::recordMessage(int line, const QString &context, const QString &text, const QString &comment, + const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, bool plural) { TranslatorMessage msg( - transcode(context, utf8), transcode(text, utf8), transcode(comment, utf8), QString(), + transcode(context), transcode(text), transcode(comment), QString(), yyFileName, line, QStringList(), TranslatorMessage::Unfinished, plural); - msg.setExtraComment(transcode(extracomment.simplified(), utf8)); + msg.setExtraComment(transcode(extracomment.simplified())); msg.setId(msgid); msg.setExtras(extra); - if ((utf8 || yyForceUtf8) && !yyCodecIsUtf8 && msg.needs8Bit()) - msg.setUtf8(true); tor->append(msg); } void CppParser::parse(const QString &initialContext, ConversionData &cd, const QStringList &includeStack, QSet<QString> &inclusions) { - if (tor) - yyCodecIsUtf8 = (tor->codecName() == "UTF-8"); - namespaces << HashString(); functionContext = namespaces; functionContextUnresolved = initialContext; @@ -1624,7 +1607,6 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac QString functionName; #endif int line; - bool utf8; bool yyTokColonSeen = false; // Start of c'tor's initializer list yyWord.reserve(yyInStr.size()); // Rather insane. That's because we do no length checking. @@ -1834,7 +1816,6 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac goto case_default; if (!sourcetext.isEmpty()) yyMsg() << qPrintable(LU::tr("//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n")); - utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); if (match(Tok_LeftParen) && matchString(&text) && !text.isEmpty()) { @@ -1927,7 +1908,7 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac } gotctx: - recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); + recordMessage(line, context, text, comment, extracomment, msgid, extra, plural); } sourcetext.clear(); // Will have warned about that already extracomment.clear(); @@ -1940,7 +1921,6 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac goto case_default; if (!sourcetext.isEmpty()) yyMsg() << qPrintable(LU::tr("//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n")); - utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); if (match(Tok_LeftParen) @@ -1956,7 +1936,7 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac if (!match(Tok_RightParen)) { // look for encoding if (match(Tok_Comma)) { - if (matchEncoding(&utf8)) { + if (matchEncoding()) { if (!match(Tok_RightParen)) { // look for the plural quantifier, // this can be a number, an identifier or @@ -1983,7 +1963,7 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac break; } } - recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); + recordMessage(line, context, text, comment, extracomment, msgid, extra, plural); } sourcetext.clear(); // Will have warned about that already extracomment.clear(); @@ -1995,13 +1975,12 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac goto case_default; if (!msgid.isEmpty()) yyMsg() << qPrintable(LU::tr("//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n")); - //utf8 = false; // Maybe use //%% or something like that line = yyLineNo; yyTok = getToken(); if (match(Tok_LeftParen) && matchString(&msgid) && !msgid.isEmpty()) { bool plural = match(Tok_Comma); recordMessage(line, QString(), sourcetext, QString(), extracomment, - msgid, extra, false, plural); + msgid, extra, plural); } sourcetext.clear(); extracomment.clear(); @@ -2102,11 +2081,11 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac context = comment.left(k); comment.remove(0, k + 1); TranslatorMessage msg( - transcode(context, false), QString(), - transcode(comment, false), QString(), + transcode(context), QString(), + transcode(comment), QString(), yyFileName, yyLineNo, QStringList(), TranslatorMessage::Finished, false); - msg.setExtraComment(transcode(extracomment.simplified(), false)); + msg.setExtraComment(transcode(extracomment.simplified())); extracomment.clear(); tor->append(msg); tor->setExtras(extra); @@ -2239,7 +2218,7 @@ const ParseResults *CppParser::recordResults(bool isHeader) void loadCPP(Translator &translator, const QStringList &filenames, ConversionData &cd) { QByteArray codecName = cd.m_codecForSource.isEmpty() - ? translator.codecName() : cd.m_codecForSource; + ? "UTF-8" : cd.m_codecForSource; QTextCodec *codec = QTextCodec::codecForName(codecName); foreach (const QString &filename, filenames) { @@ -2257,10 +2236,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat ts.setCodec(codec); ts.setAutoDetectUnicode(true); parser.setInput(ts, filename); - if (cd.m_outputCodec.isEmpty() && ts.codec()->name() == "UTF-16") - translator.setCodecName("System"); Translator *tor = new Translator; - tor->setCodecName(translator.codecName()); parser.setTranslator(tor); QSet<QString> inclusions; parser.parse(cd.m_defaultContext, cd, QStringList(), inclusions); diff --git a/src/linguist/lupdate/java.cpp b/src/linguist/lupdate/java.cpp index 2d22f1a0e..079847f43 100644 --- a/src/linguist/lupdate/java.cpp +++ b/src/linguist/lupdate/java.cpp @@ -626,7 +626,7 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c if (!cd.m_codecForSource.isEmpty()) codecName = cd.m_codecForSource; else - codecName = translator.codecName(); // Just because it should be latin1 already + codecName = "UTF-8"; ts.setCodec(QTextCodec::codecForName(codecName)); ts.setAutoDetectUnicode(true); yyInStr = ts.readAll(); @@ -636,9 +636,6 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c yyParenLineNo = 1; parse(&translator); - - // Java uses UTF-16 internally and Jambi makes UTF-8 for tr() purposes of it. - translator.setCodecName("UTF-8"); return true; } diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index a60b8bdb6..ff7538de7 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -135,10 +135,7 @@ static void printUsage() " Specify the language of the translations for new files.\n" " Guessed from the file name if not specified.\n" " -ts <ts-file>...\n" - " Specify the output file(s). This will override the TRANSLATIONS\n" - " and nullify the CODECFORTR from possibly specified project files.\n" - " -codecfortr <codec>\n" - " Specify the codec assumed for tr() calls. Effective only with -ts.\n" + " Specify the output file(s). This will override the TRANSLATIONS.\n" " -version\n" " Display the version of lupdate and exit.\n" " @lst-file\n" @@ -149,7 +146,7 @@ static void printUsage() static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames, const QStringList &alienFiles, - bool setCodec, const QString &sourceLanguage, const QString &targetLanguage, + const QString &sourceLanguage, const QString &targetLanguage, UpdateOptions options, bool *fail) { QList<Translator> aliens; @@ -180,11 +177,6 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil } tor.resolveDuplicates(); cd.clearErrors(); - if (setCodec && fetchedTor.codec() != tor.codec()) - printErr(LU::tr("lupdate warning: Codec for tr() '%1' disagrees with" - " existing file's codec '%2'. Expect trouble.\n") - .arg(QString::fromLatin1(fetchedTor.codecName()), - QString::fromLatin1(tor.codecName()))); if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode()) printErr(LU::tr("lupdate warning: Specified target language '%1' disagrees with" " existing file's language '%2'. Ignoring.\n") @@ -194,8 +186,6 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil " existing file's language '%2'. Ignoring.\n") .arg(sourceLanguage, tor.sourceLanguageCode())); } else { - if (setCodec) - tor.setCodec(fetchedTor.codec()); if (!targetLanguage.isEmpty()) tor.setLanguageCode(targetLanguage); else @@ -217,8 +207,6 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil if (tor.locationsType() == Translator::NoLocations) // Could be set from file theseOptions |= NoLocations; Translator out = merge(tor, fetchedTor, aliens, theseOptions, err); - if (setCodec) - out.setCodec(fetchedTor.codec()); if ((options & Verbose) && !err.isEmpty()) { printOut(err); @@ -483,18 +471,10 @@ static void processProjects(bool topLevel, bool nestComplain, const QStringList continue; } Translator tor; - bool setCodec = false; - QStringList tmp = visitor.values(QLatin1String("CODEC")) - + visitor.values(QLatin1String("DEFAULTCODEC")) - + visitor.values(QLatin1String("CODECFORTR")); - if (!tmp.isEmpty()) { - tor.setCodecName(tmp.last().toLatin1()); - setCodec = true; - } processProject(false, proFile, option, parser, visitor, options, codecForSource, targetLanguage, sourceLanguage, &tor, fail); updateTsFiles(tor, tsFiles, QStringList(), - setCodec, sourceLanguage, targetLanguage, options, fail); + sourceLanguage, targetLanguage, options, fail); pro->deref(); continue; } @@ -543,7 +523,6 @@ int main(int argc, char **argv) QStringList alienFiles; QString targetLanguage; QString sourceLanguage; - QByteArray codecForTr; UpdateOptions options = Verbose | // verbose is on by default starting with Qt 4.2 @@ -645,14 +624,6 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-version")) { printOut(QObject::tr("lupdate version %1\n").arg(QLatin1String(QT_VERSION_STR))); return 0; - } else if (arg == QLatin1String("-codecfortr")) { - ++i; - if (i == argc) { - printErr(LU::tr("The -codecfortr option should be followed by a codec name.\n")); - return 1; - } - codecForTr = args[i].toLatin1(); - continue; } else if (arg == QLatin1String("-ts")) { metTsFlag = true; continue; @@ -821,8 +792,6 @@ int main(int argc, char **argv) if (!targetLanguage.isEmpty() && tsFileNames.count() != 1) printErr(LU::tr("lupdate warning: -target-language usually only" " makes sense with exactly one TS file.\n")); - if (!codecForTr.isEmpty() && tsFileNames.isEmpty()) - printErr(LU::tr("lupdate warning: -codecfortr has no effect without -ts.\n")); bool fail = false; if (proFiles.isEmpty()) { @@ -836,9 +805,8 @@ int main(int argc, char **argv) cd.m_projectRoots = projectRoots; cd.m_includePath = includePath; cd.m_allCSources = allCSources; - fetchedTor.setCodecName(codecForTr); processSources(fetchedTor, sourceFiles, cd); - updateTsFiles(fetchedTor, tsFileNames, alienFiles, !codecForTr.isEmpty(), + updateTsFiles(fetchedTor, tsFileNames, alienFiles, sourceLanguage, targetLanguage, options, &fail); } else { if (!sourceFiles.isEmpty() || !includePath.isEmpty()) { @@ -859,10 +827,9 @@ int main(int argc, char **argv) if (!tsFileNames.isEmpty()) { Translator fetchedTor; - fetchedTor.setCodecName(codecForTr); processProjects(true, true, proFiles, outDirMap, &option, &parser, options, QByteArray(), targetLanguage, sourceLanguage, &fetchedTor, &fail); - updateTsFiles(fetchedTor, tsFileNames, alienFiles, !codecForTr.isEmpty(), + updateTsFiles(fetchedTor, tsFileNames, alienFiles, sourceLanguage, targetLanguage, options, &fail); } else { processProjects(true, false, proFiles, outDirMap, &option, &parser, options, QByteArray(), diff --git a/src/linguist/lupdate/merge.cpp b/src/linguist/lupdate/merge.cpp index 9808399d6..3160f914b 100644 --- a/src/linguist/lupdate/merge.cpp +++ b/src/linguist/lupdate/merge.cpp @@ -48,7 +48,6 @@ #include <QtCore/QDebug> #include <QtCore/QMap> #include <QtCore/QStringList> -#include <QtCore/QTextCodec> #include <QtCore/QVector> QT_BEGIN_NAMESPACE @@ -338,7 +337,6 @@ Translator merge( outTor.setLanguageCode(tor.languageCode()); outTor.setSourceLanguageCode(tor.sourceLanguageCode()); outTor.setLocationsType(tor.locationsType()); - outTor.setCodecName(tor.codecName()); /* The types of all the messages from the vernacular translator @@ -439,7 +437,6 @@ Translator merge( copyAttribs: m.setReferences(mv->allReferences()); m.setPlural(mv->isPlural()); - m.setUtf8(mv->isUtf8()); m.setExtraComment(mv->extraComment()); m.setId(mv->id()); } diff --git a/src/linguist/lupdate/ui.cpp b/src/linguist/lupdate/ui.cpp index 5584a551c..537f0a92b 100644 --- a/src/linguist/lupdate/ui.cpp +++ b/src/linguist/lupdate/ui.cpp @@ -65,7 +65,7 @@ class UiReader : public QXmlDefaultHandler public: UiReader(Translator &translator, ConversionData &cd) : m_translator(translator), m_cd(cd), m_lineNumber(-1), m_isTrString(false), - m_needUtf8(translator.codecName() != "UTF-8"), m_insideStringList(false) + m_insideStringList(false) {} bool startElement(const QString &namespaceURI, const QString &localName, @@ -92,7 +92,6 @@ private: QString m_accum; int m_lineNumber; bool m_isTrString; - bool m_needUtf8; bool m_insideStringList; }; @@ -161,8 +160,6 @@ void UiReader::flush() m_comment, QString(), m_cd.m_sourceFileName, m_lineNumber, QStringList()); msg.setExtraComment(m_extracomment); - if (m_needUtf8 && msg.needs8Bit()) - msg.setUtf8(true); m_translator.extend(msg); } m_source.clear(); diff --git a/src/linguist/shared/po.cpp b/src/linguist/shared/po.cpp index 5e4da8417..2f51e1c4e 100644 --- a/src/linguist/shared/po.cpp +++ b/src/linguist/shared/po.cpp @@ -404,8 +404,7 @@ static QByteArray QByteArrayList_join(const QList<QByteArray> &that, char sep) bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) { - QTextCodec *codec = QTextCodec::codecForName( - cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource); + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); bool error = false; // format of a .po file entry: @@ -478,7 +477,6 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } else if (hdrName == "MIME-Version") { // just assume it is 1.0 } else if (hdrName == "Content-Type") { - if (cd.m_codecForSource.isEmpty()) { if (!hdrValue.startsWith("text/plain; charset=")) { cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'") .arg(QString::fromLatin1(hdrValue))); @@ -498,7 +496,6 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) codec = cdc; } } - } } else if (hdrName == "Content-Transfer-Encoding") { if (hdrValue != "8bit") { cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'") @@ -723,13 +720,13 @@ static QString escapeComment(const QString &in, bool escape) return out; } -bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool savePO(const Translator &translator, QIODevice &dev, ConversionData &) { QString str_format = QLatin1String("-format"); bool ok = true; QTextStream out(&dev); - out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); + out.setCodec("UTF-8"); bool qtContexts = false; foreach (const TranslatorMessage &msg, translator.messages()) diff --git a/src/linguist/shared/qm.cpp b/src/linguist/shared/qm.cpp index 3697ff4f5..418c12ee3 100644 --- a/src/linguist/shared/qm.cpp +++ b/src/linguist/shared/qm.cpp @@ -165,12 +165,7 @@ public: enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96 }; - Releaser() : m_codec(0) {} - - void setCodecName(const QByteArray &codecName) - { - m_codec = QTextCodec::codecForName(codecName); - } + Releaser() {} bool save(QIODevice *iod); @@ -187,10 +182,7 @@ private: // This should reproduce the byte array fetched from the source file, which // on turn should be the same as passed to the actual tr(...) calls - QByteArray originalBytes(const QString &str, bool isUtf8) const; - - void insertInternal(const TranslatorMessage &message, const QStringList &tlns, - bool forceComment, bool isUtf8); + QByteArray originalBytes(const QString &str) const; static Prefix commonPrefix(const ByteTranslatorMessage &m1, const ByteTranslatorMessage &m2); @@ -207,21 +199,16 @@ private: QByteArray m_numerusRules; QStringList m_dependencies; QByteArray m_dependencyArray; - - // Used to reproduce the original bytes - QTextCodec *m_codec; }; -QByteArray Releaser::originalBytes(const QString &str, bool isUtf8) const +QByteArray Releaser::originalBytes(const QString &str) const { if (str.isEmpty()) { // Do not use QByteArray() here as the result of the serialization // will be different. return QByteArray(""); } - if (isUtf8) - return str.toUtf8(); - return m_codec ? m_codec->fromUnicode(str) : str.toLatin1(); + return str.toUtf8(); } uint Releaser::msgHash(const ByteTranslatorMessage &msg) @@ -429,12 +416,11 @@ void Releaser::squeeze(TranslatorSaveMode mode) } } -void Releaser::insertInternal(const TranslatorMessage &message, const QStringList &tlns, - bool forceComment, bool isUtf8) +void Releaser::insert(const TranslatorMessage &message, const QStringList &tlns, bool forceComment) { - ByteTranslatorMessage bmsg(originalBytes(message.context(), isUtf8), - originalBytes(message.sourceText(), isUtf8), - originalBytes(message.comment(), isUtf8), + ByteTranslatorMessage bmsg(originalBytes(message.context()), + originalBytes(message.sourceText()), + originalBytes(message.comment()), tlns); if (!forceComment) { ByteTranslatorMessage bmsg2( @@ -447,16 +433,9 @@ void Releaser::insertInternal(const TranslatorMessage &message, const QStringLis m_messages.insert(bmsg, 0); } -void Releaser::insert(const TranslatorMessage &message, const QStringList &tlns, bool forceComment) -{ - insertInternal(message, tlns, forceComment, message.isUtf8()); - if (message.isUtf8() && message.isNonUtf8()) - insertInternal(message, tlns, forceComment, false); -} - void Releaser::insertIdBased(const TranslatorMessage &message, const QStringList &tlns) { - ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns); + ByteTranslatorMessage bmsg("", originalBytes(message.id()), "", tlns); m_messages.insert(bmsg, 0); } @@ -480,30 +459,12 @@ static quint32 read32(const uchar *data) return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3]); } -static void fromBytes(const char *str, int len, QTextCodec *codec, QTextCodec *utf8Codec, - QString *out, QString *utf8Out, - bool *isSystem, bool *isUtf8, bool *needs8Bit) +static void fromBytes(const char *str, int len, QString *out, bool *utf8Fail) { - for (int i = 0; i < len; ++i) - if (str[i] & 0x80) { - if (utf8Codec) { - QTextCodec::ConverterState cvtState; - *utf8Out = utf8Codec->toUnicode(str, len, &cvtState); - *isUtf8 = !cvtState.invalidChars; - } - QTextCodec::ConverterState cvtState; - *out = codec->toUnicode(str, len, &cvtState); - *isSystem = !cvtState.invalidChars; - *needs8Bit = true; - return; - } - *out = QString::fromLatin1(str, len); - *isSystem = true; - if (utf8Codec) { - *utf8Out = *out; - *isUtf8 = true; - } - *needs8Bit = false; + static QTextCodec *utf8Codec = QTextCodec::codecForName("UTF-8"); + QTextCodec::ConverterState cvtState; + *out = utf8Codec->toUnicode(str, len, &cvtState); + *utf8Fail = cvtState.invalidChars; } bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) @@ -565,12 +526,6 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) size_t numItems = offsetLength / (2 * sizeof(quint32)); //qDebug() << "NUMITEMS: " << numItems; - QTextCodec *codec = QTextCodec::codecForName( - cd.m_codecForSource.isEmpty() ? QByteArray("Latin1") : cd.m_codecForSource); - QTextCodec *utf8Codec = 0; - if (codec->name() != "UTF-8") - utf8Codec = QTextCodec::codecForName("UTF-8"); - QString strProN = QLatin1String("%n"); QLocale::Language l; QLocale::Country c; @@ -580,12 +535,8 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) if (getNumerusInfo(l, c, 0, &numerusForms, 0)) guessPlurals = (numerusForms.count() == 1); - QString context, contextUtf8; - bool contextIsSystem, contextIsUtf8, contextNeeds8Bit; - QString sourcetext, sourcetextUtf8; - bool sourcetextIsSystem, sourcetextIsUtf8, sourcetextNeeds8Bit; - QString comment, commentUtf8; - bool commentIsSystem, commentIsUtf8, commentNeeds8Bit; + QString context, sourcetext, comment; + bool utf8Fail = false; QStringList translations; for (const uchar *start = offsetArray; start != offsetArray + (numItems << 3); start += 8) { @@ -626,9 +577,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "SOURCE LEN: " << len; //qDebug() << "SOURCE: " << QByteArray((const char*)m, len); - fromBytes((const char*)m, len, codec, utf8Codec, - &sourcetext, &sourcetextUtf8, - &sourcetextIsSystem, &sourcetextIsUtf8, &sourcetextNeeds8Bit); + fromBytes((const char*)m, len, &sourcetext, &utf8Fail); m += len; break; } @@ -637,9 +586,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "CONTEXT LEN: " << len; //qDebug() << "CONTEXT: " << QByteArray((const char*)m, len); - fromBytes((const char*)m, len, codec, utf8Codec, - &context, &contextUtf8, - &contextIsSystem, &contextIsUtf8, &contextNeeds8Bit); + fromBytes((const char*)m, len, &context, &utf8Fail); m += len; break; } @@ -648,9 +595,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "COMMENT LEN: " << len; //qDebug() << "COMMENT: " << QByteArray((const char*)m, len); - fromBytes((const char*)m, len, codec, utf8Codec, - &comment, &commentUtf8, - &commentIsSystem, &commentIsUtf8, &commentNeeds8Bit); + fromBytes((const char*)m, len, &comment, &utf8Fail); m += len; break; } @@ -673,28 +618,15 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) } msg.setTranslations(translations); translations.clear(); - if (contextNeeds8Bit || sourcetextNeeds8Bit || commentNeeds8Bit) { - if (utf8Codec && contextIsUtf8 && sourcetextIsUtf8 && commentIsUtf8) { - // The message is utf-8, but file is not. - msg.setUtf8(true); - msg.setContext(contextUtf8); - msg.setSourceText(sourcetextUtf8); - msg.setComment(commentUtf8); - translator.append(msg); - continue; - } - if (!(contextIsSystem && sourcetextIsSystem && commentIsSystem)) { - cd.appendError(QLatin1String( - "Cannot read file with specified input codec")); - return false; - } - // The message is 8-bit in the file's encoding (utf-8 or not). - } msg.setContext(context); msg.setSourceText(sourcetext); msg.setComment(comment); translator.append(msg); } + if (utf8Fail) { + cd.appendError(QLatin1String("Cannot read file with UTF-8 codec")); + return false; + } return ok; } @@ -719,7 +651,6 @@ bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) QByteArray rules; if (getNumerusInfo(l, c, &rules, 0, 0)) releaser.setNumerusRules(rules); - releaser.setCodecName(translator.codecName()); int finished = 0; int unfinished = 0; diff --git a/src/linguist/shared/translator.cpp b/src/linguist/shared/translator.cpp index 41be87dc0..a722ad774 100644 --- a/src/linguist/shared/translator.cpp +++ b/src/linguist/shared/translator.cpp @@ -60,7 +60,6 @@ #include <QtCore/QDir> #include <QtCore/QFile> #include <QtCore/QFileInfo> -#include <QtCore/QTextCodec> #include <QtCore/QTextStream> #include <private/qtranslator_p.h> @@ -78,7 +77,6 @@ QString QObject::tr(const char *sourceText, const char *, int n) #endif Translator::Translator() : - m_codec(QTextCodec::codecForName("ISO-8859-1")), m_locationsType(AbsoluteLocations), m_indexOk(true) { @@ -164,10 +162,6 @@ void Translator::extend(const TranslatorMessage &msg) cmt.append(msg.extraComment()); emsg.setExtraComment(cmt); } - if (msg.isUtf8() != emsg.isUtf8()) { - emsg.setUtf8(true); - emsg.setNonUtf8(true); - } } } @@ -593,14 +587,7 @@ Translator::Duplicates Translator::resolveDuplicates() ++i; continue; gotDupe: - if (omsg->isUtf8() != msg.isUtf8() && !omsg->isNonUtf8()) { - // Dual-encoded message - omsg->setUtf8(true); - omsg->setNonUtf8(true); - } else { - // Duplicate - pDup->insert(oi); - } + pDup->insert(oi); if (!omsg->isTranslated() && msg.isTranslated()) omsg->setTranslations(msg.translations()); m_indexOk = false; @@ -745,23 +732,6 @@ void Translator::setExtra(const QString &key, const QString &value) m_extra[key] = value; } -void Translator::setCodecName(const QByteArray &name) -{ - QTextCodec *codec = QTextCodec::codecForName(name); - if (!codec) { - if (!name.isEmpty()) - std::cerr << "No QTextCodec for " << name.constData() << " available. Using Latin1.\n"; - m_codec = QTextCodec::codecForName("ISO-8859-1"); - } else { - m_codec = codec; - } -} - -QByteArray Translator::codecName() const -{ - return m_codec->name(); -} - void Translator::dump() const { for (int i = 0; i != messageCount(); ++i) diff --git a/src/linguist/shared/translator.h b/src/linguist/shared/translator.h index 41fc9820a..712098219 100644 --- a/src/linguist/shared/translator.h +++ b/src/linguist/shared/translator.h @@ -98,7 +98,6 @@ public: public: QString m_defaultContext; QByteArray m_codecForSource; // CPP, PO & QM specific - QByteArray m_outputCodec; // CPP & PO specific QString m_unTrPrefix; // QM specific QString m_sourceFileName; QString m_targetFileName; @@ -160,11 +159,6 @@ public: Duplicates resolveDuplicates(); void reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose); - void setCodecName(const QByteArray &name); - void setCodec(QTextCodec *codec) { m_codec = codec; } - QByteArray codecName() const; - QTextCodec *codec() const { return m_codec; } - QString languageCode() const { return m_language; } QString sourceLanguageCode() const { return m_sourceLanguage; } @@ -231,7 +225,6 @@ private: typedef QList<TranslatorMessage> TMM; // int stores the sequence position. TMM m_messages; - QTextCodec *m_codec; LocationsType m_locationsType; // A string beginning with a 2 or 3 letter language code (ISO 639-1 diff --git a/src/linguist/shared/translatormessage.cpp b/src/linguist/shared/translatormessage.cpp index 206c535b1..050bc33ee 100644 --- a/src/linguist/shared/translatormessage.cpp +++ b/src/linguist/shared/translatormessage.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE TranslatorMessage::TranslatorMessage() - : m_lineNumber(-1), m_type(Unfinished), m_utf8(false), m_nonUtf8(false), m_plural(false) + : m_lineNumber(-1), m_type(Unfinished), m_plural(false) { } @@ -64,7 +64,7 @@ TranslatorMessage::TranslatorMessage(const QString &context, : m_context(context), m_sourcetext(sourceText), m_comment(comment), m_userData(userData), m_translations(translations), m_fileName(fileName), m_lineNumber(lineNumber), - m_type(type), m_utf8(false), m_nonUtf8(false), m_plural(plural) + m_type(type), m_plural(plural) { } @@ -124,22 +124,6 @@ TranslatorMessage::References TranslatorMessage::allReferences() const return refs; } -static bool needs8BitHelper(const QString &ba) -{ - for (int i = ba.size(); --i >= 0; ) - if (ba.at(i).unicode() >= 0x80) - return true; - return false; -} - -bool TranslatorMessage::needs8Bit() const -{ - //dump(); - return needs8BitHelper(m_sourcetext) - || needs8BitHelper(m_comment) - || needs8BitHelper(m_context); -} - bool TranslatorMessage::hasExtra(const QString &key) const { diff --git a/src/linguist/shared/translatormessage.h b/src/linguist/shared/translatormessage.h index 01725addd..4680b0ec2 100644 --- a/src/linguist/shared/translatormessage.h +++ b/src/linguist/shared/translatormessage.h @@ -129,10 +129,6 @@ public: Type type() const { return m_type; } void setType(Type t) { m_type = t; } - bool isUtf8() const { return m_utf8; } // codecForTr override - void setUtf8(bool on) { m_utf8 = on; } - bool isNonUtf8() const { return m_nonUtf8; } // codecForTr override - void setNonUtf8(bool on) { m_nonUtf8 = on; } bool isPlural() const { return m_plural; } void setPlural(bool isplural) { m_plural = isplural; } @@ -145,7 +141,6 @@ public: void setExtras(const ExtraData &extras) { m_extra = extras; } void unsetExtra(const QString &key); - bool needs8Bit() const; void dump() const; private: @@ -165,8 +160,6 @@ private: References m_extraRefs; Type m_type; - bool m_utf8; - bool m_nonUtf8; bool m_plural; }; diff --git a/src/linguist/shared/ts.cpp b/src/linguist/shared/ts.cpp index 74ad45e9a..38e76f9b1 100644 --- a/src/linguist/shared/ts.cpp +++ b/src/linguist/shared/ts.cpp @@ -54,15 +54,6 @@ QT_BEGIN_NAMESPACE -/* - * The encodings are a total mess. - * A Translator has a codecForTr(). Each message's text will be passed to tr() - * in that encoding or as UTF-8 to trUtf8() if it is flagged as such. - * For ts 2.0, the file content is always uniformly in UTF-8. The file stores - * the codecForTr default and marks deviating messages accordingly. - */ - - QDebug &operator<<(QDebug &d, const QXmlStreamAttribute &attr) { return d << "[" << attr.name().toString() << "," << attr.value().toString() << "]"; @@ -207,7 +198,6 @@ QString TSReader::readTransContents() bool TSReader::read(Translator &translator) { - STRING(both); STRING(byte); STRING(catalog); STRING(comment); @@ -215,7 +205,6 @@ bool TSReader::read(Translator &translator) STRING(defaultcodec); STRING(dependencies); STRING(dependency); - STRING(encoding); STRING(extracomment); STRING(filename); STRING(id); @@ -233,12 +222,10 @@ bool TSReader::read(Translator &translator) STRING(sourcelanguage); STRING(translation); STRING(translatorcomment); - STRING(true); STRING(TS); STRING(type); STRING(unfinished); STRING(userdata); - STRING(utf8); STRING(value); //STRING(version); STRING(yes); @@ -277,9 +264,8 @@ bool TSReader::read(Translator &translator) // ignore these, just whitespace } else if (elementStarts(strdefaultcodec)) { // <defaultcodec> - const QString &codec = readElementText(); - if (!codec.isEmpty()) - translator.setCodecName(codec.toLatin1()); + readElementText(); + m_cd.appendError(QString::fromLatin1("Warning: ignoring <defaultcodec> element")); // </defaultcodec> } else if (isStartElement() && name().toString().startsWith(strextrans)) { @@ -338,10 +324,6 @@ bool TSReader::read(Translator &translator) msg.setContext(context); msg.setType(TranslatorMessage::Finished); msg.setPlural(attributes().value(strnumerus) == stryes); - const QStringRef &utf8Attr = attributes().value(strutf8); - msg.setNonUtf8(utf8Attr == strboth); - msg.setUtf8(msg.isNonUtf8() || utf8Attr == strtrue - || attributes().value(strencoding) == strUtf8); while (!atEnd()) { readNext(); if (isEndElement()) { @@ -544,7 +526,6 @@ bool saveTS(const Translator &translator, QIODevice &dev, ConversionData &cd) bool result = true; QTextStream t(&dev); t.setCodec(QTextCodec::codecForName("UTF-8")); - bool trIsUtf8 = (translator.codecName() == "UTF-8"); //qDebug() << translator.codecName(); // The xml prolog allows processors to easily detect the correct encoding @@ -560,10 +541,6 @@ bool saveTS(const Translator &translator, QIODevice &dev, ConversionData &cd) t << " sourcelanguage=\"" << languageCode << "\""; t << ">\n"; - QByteArray codecName = translator.codecName(); - if (codecName != "ISO-8859-1") - t << "<defaultcodec>" << codecName << "</defaultcodec>\n"; - QStringList deps = translator.dependencies(); if (!deps.isEmpty()) { t << "<dependencies>\n"; @@ -604,14 +581,6 @@ bool saveTS(const Translator &translator, QIODevice &dev, ConversionData &cd) t << " <message"; if (!msg.id().isEmpty()) t << " id=\"" << msg.id() << "\""; - if (!trIsUtf8) { - if (msg.isUtf8()) { - if (msg.isNonUtf8()) - t << " utf8=\"both\""; - else - t << " utf8=\"true\""; - } - } if (msg.isPlural()) t << " numerus=\"yes\""; t << ">\n"; diff --git a/tests/auto/linguist/lconvert/data/codec-cp1252.ts b/tests/auto/linguist/lconvert/data/codec-cp1252.ts deleted file mode 100644 index 5ffa2f3d6..000000000 --- a/tests/auto/linguist/lconvert/data/codec-cp1252.ts +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>windows-1252</defaultcodec> -<context> - <name>FooBar</name> - <message> - <location filename="main.cpp" line="10"/> - <source>random ascii only</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="11"/> - <source>this contains an umlaut ü &uuml;</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="12"/> - <source>random ascii only in utf8</source> - <translation type="unfinished"></translation> - </message> - <message utf8="true"> - <location filename="main.cpp" line="13"/> - <source>umlaut ü &uuml; in utf8</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lconvert/data/codec-utf8.ts b/tests/auto/linguist/lconvert/data/codec-utf8.ts index 0ebdbfdd6..1a2b626fb 100644 --- a/tests/auto/linguist/lconvert/data/codec-utf8.ts +++ b/tests/auto/linguist/lconvert/data/codec-utf8.ts @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> -<defaultcodec>UTF-8</defaultcodec> <context> <name>FooBar</name> <message> diff --git a/tests/auto/linguist/lconvert/data/dual-encoding.ts b/tests/auto/linguist/lconvert/data/dual-encoding.ts deleted file mode 100644 index 5023a04d9..000000000 --- a/tests/auto/linguist/lconvert/data/dual-encoding.ts +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<context> - <name></name> - <message utf8="both"> - <source>Mühsam</source> - <translation>tedious</translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 0f4dfcdad..b6608a8cf 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -316,7 +316,6 @@ void tst_lconvert::roundtrips_data() QTest::newRow("po-ts-po (references)") << "test-refs.po" << poTsPo << noArgs; - QTest::newRow("ts-qm-ts (dual-encoding)") << "dual-encoding.ts" << tsQmTs << noArgs; QTest::newRow("ts-qm-ts (plurals-de)") << "plurals-de.ts" << tsQmTs << outDeArgs; QTest::newRow("ts-qm-ts (plurals-cn)") << "plurals-cn.ts" << tsQmTs << outCnArgs; QTest::newRow("ts-qm-ts (variants)") << "variants.ts" << tsQmTs << outDeArgs; diff --git a/tests/auto/linguist/lrelease/testdata/dupes.ts b/tests/auto/linguist/lrelease/testdata/dupes.ts index ec368c327..79bc4506b 100644 --- a/tests/auto/linguist/lrelease/testdata/dupes.ts +++ b/tests/auto/linguist/lrelease/testdata/dupes.ts @@ -3,10 +3,6 @@ <TS version="1.1"> <context> <name>FindDialog</name> - <message utf8="true"> - <source>Search reached start of the document</source> - <translation type="unfinished"></translation> - </message> <message> <location filename="finddialog.cpp" line="109"/> <source>Search reached start of the document</source> diff --git a/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts b/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts deleted file mode 100644 index 8bb56d43f..000000000 --- a/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>windows-1252</defaultcodec> -<context> - <name>FooBar</name> - <message> - <location filename="main.cpp" line="11"/> - <source>this contains an umlaut ü &uuml;</source> - <translation>random stuff with umlaut</translation> - </message> - <message utf8="true"> - <location filename="main.cpp" line="13"/> - <source>umlaut ü &uuml; in utf8</source> - <translation>more random stuff with umlaut</translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index c3593da68..f53eca36d 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -60,7 +60,6 @@ private: private slots: void translate(); - void mixedcodecs(); void compressed(); void idbased(); void markuntranslated(); @@ -156,9 +155,9 @@ void tst_lrelease::translate() QCOMPARE(tr("There are %n cars", "More Plurals", 3) , QString("There are 3 cars")); - QCOMPARE(QCoreApplication::translate("no_en", "Kj\370r K\345re, kj\346re"), QString::fromLatin1("Drive K\345re, dear")); - QCOMPARE(QCoreApplication::translate("en_no", "Drive K\345re, dear"), QString::fromLatin1("Kj\370r K\345re, kj\346re")); - QCOMPARE(QCoreApplication::translate("en_ch", "Chinese symbol:"), QString::fromLatin1("Chinese symbol:%1").arg(QChar(0x7c1f))); + QCOMPARE(QCoreApplication::translate("no_en", "Kj\xc3\xb8r K\xc3\xa5re, kj\xc3\xa6re"), QString::fromUtf8("Drive K\xc3\xa5re, dear")); + QCOMPARE(QCoreApplication::translate("en_no", "Drive K\xc3\xa5re, dear"), QString::fromUtf8("Kj\xc3\xb8r K\xc3\xa5re, kj\xc3\xa6re")); + QCOMPARE(QCoreApplication::translate("en_ch", "Chinese symbol:"), QString::fromUtf8("Chinese symbol:\xe7\xb0\x9f")); // printf("halo\r\nhallo"); // QCOMPARE(tr("This\r\nwill fail"), QString("THIS\nWILL FAIL")); // \r\n = 0d 0a @@ -171,20 +170,6 @@ void tst_lrelease::translate() qApp->removeTranslator(&translator); } -void tst_lrelease::mixedcodecs() -{ - QVERIFY(!QProcess::execute(binDir + "/lrelease " + dataDir + "mixedcodecs-ts20.ts")); - - QTranslator translator; - QVERIFY(translator.load(dataDir + "mixedcodecs-ts20.qm")); - qApp->installTranslator(&translator); - - QCOMPARE(QCoreApplication::translate("FooBar", "this contains an umlaut \xfc ü"), - QString::fromLatin1("random stuff with umlaut")); - QCOMPARE(QCoreApplication::translate("FooBar", "umlaut \xc3\xbc ü in utf8"), - QString::fromLatin1("more random stuff with umlaut")); -} - void tst_lrelease::compressed() { QVERIFY(!QProcess::execute(binDir + "/lrelease -compress " + dataDir + "compressed.ts")); diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp index 16594c15e..91e3c5e71 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char **argv) { QApplication a(argc, argv); - QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + QWidget w; QLabel label1(QObject::tr("abc", "ascii"), &w); diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro index f133c60d2..3779ef0e7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -3,6 +3,5 @@ CONFIG+= console TRANSLATIONS = project.ts -CODECFORTR = utf-8 CODECFORSRC = utf-8 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result index 711bf025a..b1a40ade8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> -<defaultcodec>UTF-8</defaultcodec> <context> <name>QObject</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp deleted file mode 100644 index 436039fa2..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QApplication> -#include <QtGui> -#include <QtCore> -#include <QTextCodec> - -int main(int argc, char **argv) -{ - QApplication a(argc, argv); - QTranslator trans(0); - - trans.load("t1_en", "."); - - a.installTranslator(&trans); - QWidget w; -/* - QLabel label1(QObject::tr("\33"), &w); - QLabel label2(QObject::tr("\32"), &w); - QLabel label3(QObject::tr("\176"), &w); -*/ - QLabel label4(QObject::tr("\301"), &w); - - w.show(); - return a.exec(); -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro deleted file mode 100644 index 884fc5273..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro +++ /dev/null @@ -1,7 +0,0 @@ -SOURCES += main.cpp -CONFIG+= console - -TRANSLATIONS = project.ts - -CODECFORTR = CP1251 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result deleted file mode 100644 index 6ee369a78..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>windows-1251</defaultcodec> -<context> - <name>QObject</name> - <message> - <location filename="main.cpp" line="61"/> - <source>Б</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp deleted file mode 100644 index deea8031f..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore> - -class FooBar : QObject -{ - Q_OBJECT - -public: - void doFoo() - { - tr("random ascii only"); - tr("this contains an umlaut ü ü literally"); - tr("this contains an umlaut \xfc ü escaped"); - trUtf8("random ascii only in utf8"); - trUtf8("umlaut ü ü in literal utf8"); - trUtf8("umlaut \303\274 ü in escaped utf8"); - } -}; - -int main(int argc, char **argv) -{ - return 0; -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro deleted file mode 100644 index 6d21e0d2f..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro +++ /dev/null @@ -1,7 +0,0 @@ -SOURCES += main.cpp -CONFIG += console - -TRANSLATIONS = project.ts - -CODECFORTR = CP1252 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result deleted file mode 100644 index d548e2465..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>windows-1252</defaultcodec> -<context> - <name>FooBar</name> - <message> - <location filename="main.cpp" line="51"/> - <source>random ascii only</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="52"/> - <source>this contains an umlaut ü &uuml; literally</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="53"/> - <source>this contains an umlaut ü &uuml; escaped</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="54"/> - <source>random ascii only in utf8</source> - <translation type="unfinished"></translation> - </message> - <message utf8="true"> - <location filename="main.cpp" line="55"/> - <source>umlaut ü &uuml; in literal utf8</source> - <translation type="unfinished"></translation> - </message> - <message utf8="true"> - <location filename="main.cpp" line="56"/> - <source>umlaut ü &uuml; in escaped utf8</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp deleted file mode 100644 index a5fb61fee..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore> - -class FooBar : QObject -{ - Q_OBJECT - -public: - void doFoo() - { - tr("random ascii only"); - tr("this contains an umlaut ü ü literally"); - tr("this contains an umlaut \303\274 ü escaped, really in utf-8"); - trUtf8("random ascii only in utf8"); - trUtf8("umlaut \303\274 ü in escaped utf8"); - } -}; - -int main(int argc, char **argv) -{ - return 0; -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro deleted file mode 100644 index 8918087e8..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro +++ /dev/null @@ -1,8 +0,0 @@ -SOURCES += main.cpp -CONFIG += console - -TRANSLATIONS = project.ts - -CODECFORSRC = CP1252 -CODECFORTR = UTF-8 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result deleted file mode 100644 index 6728a256b..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>UTF-8</defaultcodec> -<context> - <name>FooBar</name> - <message> - <location filename="main.cpp" line="51"/> - <source>random ascii only</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="52"/> - <source>this contains an umlaut ü &uuml; literally</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="53"/> - <source>this contains an umlaut ü &uuml; escaped, really in utf-8</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="54"/> - <source>random ascii only in utf8</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="main.cpp" line="55"/> - <source>umlaut ü &uuml; in escaped utf8</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt deleted file mode 100644 index feecddace..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt +++ /dev/null @@ -1 +0,0 @@ -lupdate warning: Codec for tr\(\) 'ISO-8859-1' disagrees with existing file's codec 'UTF-8'\. Expect trouble\. diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp deleted file mode 100644 index 757ccc95b..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -int main(int argc, char **argv) -{ - QObject::tr("hi"); -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro deleted file mode 100644 index 1a2f50e41..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES += main.cpp - -TRANSLATIONS = project.ts -CODECFORTR = latin1 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before deleted file mode 100644 index 07ad79b82..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>UTF-8</defaultcodec> -<context> - <name>QObject</name> - <message> - <location filename="main.cpp" line="44"/> - <source>hi</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result deleted file mode 100644 index b6899c162..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<context> - <name>QObject</name> - <message> - <location filename="main.cpp" line="44"/> - <source>hi</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp deleted file mode 100644 index 757ccc95b..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -int main(int argc, char **argv) -{ - QObject::tr("hi"); -} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro deleted file mode 100644 index 2d08a07de..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES += main.cpp - -TRANSLATIONS = project.ts -CODECFORTR = latin2 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before deleted file mode 100644 index e18e34e0e..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>ISO-8859-2</defaultcodec> -<context> - <name>QObject</name> - <message> - <location filename="main.cpp" line="44"/> - <source>hi</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result deleted file mode 100644 index e18e34e0e..000000000 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0"> -<defaultcodec>ISO-8859-2</defaultcodec> -<context> - <name>QObject</name> - <message> - <location filename="main.cpp" line="44"/> - <source>hi</source> - <translation type="unfinished"></translation> - </message> -</context> -</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp index 7d3f63839..9f47f3176 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp @@ -51,9 +51,9 @@ class Dialog2 : public QDialog void Dialog2::func() { - tr("cat\351gorie"); + tr("cat\xc3\xa9gorie"); - tr("F\374r \310lise") + tr("F\xc3\xbcr \xc3\x88lise") } diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 7d87d17c6..c8cca3f04 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -134,7 +134,7 @@ backslashed \ stuff.</source> </context> <context> <name>KÃ¥ntekst</name> - <message utf8="true"> + <message> <location filename="finddialog.cpp" line="180"/> <source>encoding, using QApplication</source> <translation type="unfinished"></translation> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index b27d23991..d53c6d8e4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -8,7 +8,7 @@ <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> - <message utf8="true"> + <message> <location filename="project.ui" line="58"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result index cddb9632f..ca9504eb5 100644 --- a/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> -<defaultcodec>ISO-8859-2</defaultcodec> <context> <name>subsub2</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result index cddb9632f..ca9504eb5 100644 --- a/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> -<defaultcodec>ISO-8859-2</defaultcodec> <context> <name>subsub2</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro index afbcd9cf7..26a954a26 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro @@ -1,5 +1,4 @@ SOURCES += main.cpp TRANSLATIONS = ../../project_sub.ts -CODECFORTR = ISO-8859-2 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro index afbcd9cf7..26a954a26 100644 --- a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro @@ -1,5 +1,4 @@ SOURCES += main.cpp TRANSLATIONS = ../../project_sub.ts -CODECFORTR = ISO-8859-2 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- GitLab