diff options
author | Geir Vattekar <geir.vattekar@nokia.com> | 2010-06-15 12:02:32 (GMT) |
---|---|---|
committer | Geir Vattekar <geir.vattekar@nokia.com> | 2010-06-15 12:02:32 (GMT) |
commit | ac3c3b3a19207328ffbcbdada10ef61291caba15 (patch) | |
tree | a33f216d62aa506448f7fb6cbdf7640f5f223fe0 /tools/linguist | |
parent | c5b06919a8fb5d20aae41f0edf9e2ffa99eb1a8a (diff) | |
parent | a041e4eca3467c1baa6245b6fb47def127f30f41 (diff) | |
download | Qt-ac3c3b3a19207328ffbcbdada10ef61291caba15.zip Qt-ac3c3b3a19207328ffbcbdada10ef61291caba15.tar.gz Qt-ac3c3b3a19207328ffbcbdada10ef61291caba15.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lconvert/main.cpp | 8 | ||||
-rw-r--r-- | tools/linguist/lrelease/main.cpp | 23 | ||||
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 124 | ||||
-rw-r--r-- | tools/linguist/lupdate/java.cpp | 40 | ||||
-rw-r--r-- | tools/linguist/lupdate/main.cpp | 91 | ||||
-rw-r--r-- | tools/linguist/lupdate/qscript.cpp | 22 | ||||
-rw-r--r-- | tools/linguist/lupdate/qscript.g | 24 | ||||
-rw-r--r-- | tools/linguist/phrasebooks/hungarian.qph | 752 | ||||
-rw-r--r-- | tools/linguist/phrasebooks/russian.qph | 2 | ||||
-rw-r--r-- | tools/linguist/shared/po.cpp | 83 | ||||
-rw-r--r-- | tools/linguist/shared/profileevaluator.cpp | 6 | ||||
-rw-r--r-- | tools/linguist/shared/qm.cpp | 4 | ||||
-rw-r--r-- | tools/linguist/shared/translator.cpp | 23 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 2 |
14 files changed, 1005 insertions, 199 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 543c405..094406c 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name)); if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) { - qWarning() << qPrintable(cd.error()); + std::cerr << qPrintable(cd.error()); return 2; } tr.reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose); @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) for (int i = 1; i < inFiles.size(); ++i) { Translator tr2; if (!tr2.load(inFiles[i].name, cd, inFiles[i].format)) { - qWarning() << qPrintable(cd.error()); + std::cerr << qPrintable(cd.error()); return 2; } tr2.reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose); @@ -273,11 +273,11 @@ int main(int argc, char *argv[]) tr.normalizeTranslations(cd); if (!cd.errors().isEmpty()) { - qWarning("%s", qPrintable(cd.error())); + std::cerr << qPrintable(cd.error()); cd.clearErrors(); } if (!tr.save(outFileName, cd, outFormat)) { - qWarning("%s", qPrintable(cd.error())); + std::cerr << qPrintable(cd.error()); return 3; } return 0; diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 266474e..b5cff90 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -55,6 +55,8 @@ #include <QtCore/QStringList> #include <QtCore/QTextStream> +#include <iostream> + QT_USE_NAMESPACE #ifdef QT_BOOTSTRAPPED @@ -106,7 +108,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo ConversionData cd; bool ok = tor.load(tsFileName, cd, QLatin1String("auto")); if (!ok) { - qWarning("lrelease error: %s\n", qPrintable(cd.error())); + std::cerr << "lrelease error: " << qPrintable(cd.error()); } else { if (!cd.errors().isEmpty()) printOut(cd.error()); @@ -130,8 +132,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { - qWarning("lrelease error: cannot create '%s': %s\n", - qPrintable(qmFileName), qPrintable(file.errorString())); + std::cerr << "lrelease error: cannot create '" << qPrintable(qmFileName) + << "': " << qPrintable(file.errorString()) << std::endl; return false; } @@ -140,8 +142,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, file.close(); if (!ok) { - qWarning("lrelease error: cannot save '%s': %s\n", - qPrintable(qmFileName), qPrintable(cd.error())); + std::cerr << "lrelease error: cannot save '" << qPrintable(qmFileName) + << "': " << qPrintable(cd.error()); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); } @@ -253,19 +255,20 @@ int main(int argc, char **argv) visitor.setVerbose(cd.isVerbose()); if (!visitor.queryProFile(&pro)) { - qWarning("lrelease error: cannot read project file '%s'.", qPrintable(inputFile)); + std::cerr << "lrelease error: cannot read project file '" + << qPrintable(inputFile) << "'.\n"; continue; } if (!visitor.accept(&pro)) { - qWarning("lrelease error: cannot process project file '%s'.", qPrintable(inputFile)); + std::cerr << "lrelease error: cannot process project file '" + << qPrintable(inputFile) << "'.\n"; continue; } QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { - qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in" - " project file '%s'\n", - qPrintable(inputFile)); + std::cerr << "lrelease warning: Met no 'TRANSLATIONS' entry in project file '" + << qPrintable(inputFile) << "'\n"; } else { QDir proDir(fi.absolutePath()); foreach (const QString &trans, translations) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index db4bbca..b3e7e84 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -51,6 +51,8 @@ #include <QtCore/QTextCodec> #include <QtCore/QTextStream> +#include <iostream> + #include <ctype.h> // for isXXX() QT_BEGIN_NAMESPACE @@ -226,6 +228,8 @@ private: int elseLine; }; + std::ostream &yyMsg(int line = 0); + uint getChar(); uint getToken(); bool getMacroArgs(); @@ -352,6 +356,12 @@ CppParser::CppParser(ParseResults *_results) inDefine = false; } + +std::ostream &CppParser::yyMsg(int line) +{ + return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": "; +} + void CppParser::setInput(const QString &in) { yyInStr = in; @@ -613,9 +623,9 @@ uint CppParser::getToken() if (yyBracketDepth != is.bracketDepth1st || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/bracket/brace mismatch between " - "#if and #else branches; using #if branch\n", - qPrintable(yyFileName), is.elseLine); + yyMsg(is.elseLine) + << "Parenthesis/bracket/brace mismatch between " + "#if and #else branches; using #if branch\n"; } else { is.bracketDepth1st = yyBracketDepth; is.braceDepth1st = yyBraceDepth; @@ -636,9 +646,9 @@ uint CppParser::getToken() if (yyBracketDepth != is.bracketDepth1st || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/brace mismatch between " - "#if and #else branches; using #if branch\n", - qPrintable(yyFileName), is.elseLine); + yyMsg(is.elseLine) + << "Parenthesis/brace mismatch between " + "#if and #else branches; using #if branch\n"; yyBracketDepth = is.bracketDepth1st; yyBraceDepth = is.braceDepth1st; yyParenDepth = is.parenDepth1st; @@ -664,8 +674,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - qWarning("%s:%d: Unterminated C++ comment\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ comment\n"; break; } @@ -795,8 +804,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - qWarning("%s:%d: Unterminated C++ comment\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ comment\n"; break; } *ptr++ = yyCh; @@ -829,8 +837,7 @@ uint CppParser::getToken() yyWord.resize(ptr - (ushort *)yyWord.unicode()); if (yyCh != '"') - qWarning("%s:%d: Unterminated C++ string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ string\n"; else yyCh = getChar(); return Tok_String; @@ -867,8 +874,7 @@ uint CppParser::getToken() forever { if (yyCh == EOF || yyCh == '\n') { - qWarning("%s:%d: Unterminated C++ character\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated C++ character\n"; break; } yyCh = getChar(); @@ -887,9 +893,9 @@ uint CppParser::getToken() case '}': if (yyBraceDepth == yyMinBraceDepth) { if (!inDefine) - qWarning("%s:%d: Excess closing brace in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing brace in C++ code" + " (or abuse of the C++ preprocessor)\n"; // Avoid things getting messed up even more yyCh = getChar(); return Tok_Semicolon; @@ -905,9 +911,9 @@ uint CppParser::getToken() return Tok_LeftParen; case ')': if (yyParenDepth == 0) - qWarning("%s:%d: Excess closing parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n"; else yyParenDepth--; yyCh = getChar(); @@ -920,9 +926,9 @@ uint CppParser::getToken() return Tok_LeftBracket; case ']': if (yyBracketDepth == 0) - qWarning("%s:%d: Excess closing bracket in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyCurLineNo); + yyMsg(yyCurLineNo) + << "Excess closing bracket in C++ code" + " (or abuse of the C++ preprocessor)\n"; else yyBracketDepth--; yyCh = getChar(); @@ -1290,8 +1296,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QString cleanFile = QDir::cleanPath(file); if (inclusions.contains(cleanFile)) { - qWarning("%s:%d: circular inclusion of %s\n", - qPrintable(yyFileName), yyLineNo, qPrintable(cleanFile)); + yyMsg() << "circular inclusion of " << qPrintable(cleanFile) << std::endl; return; } @@ -1315,9 +1320,9 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QFile f(cleanFile); if (!f.open(QIODevice::ReadOnly)) { - qWarning("%s:%d: Cannot open %s: %s\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(cleanFile), qPrintable(f.errorString())); + yyMsg() + << "Cannot open " << qPrintable(cleanFile) << ": " + << qPrintable(f.errorString()) << std::endl; return; } @@ -1656,8 +1661,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) // Forward-declared class definitions can be namespaced. NamespaceList nsl; if (!fullyQualify(namespaces, quali, true, &nsl, 0)) { - qWarning("%s:%d: Ignoring definition of undeclared qualified class\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Ignoring definition of undeclared qualified class\n"; break; } namespaceDepths.push(namespaces.count()); @@ -1757,8 +1761,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); @@ -1779,10 +1782,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); - qWarning("%s:%d: Qualifying with unknown namespace/class %s::%s\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(stringifyNamespace(functionContext)), - qPrintable(unresolved.first())); + yyMsg() << "Qualifying with unknown namespace/class " + << qPrintable(stringifyNamespace(functionContext)) << "::" + << qPrintable(unresolved.first()) << std::endl; } pendingContext.clear(); } @@ -1790,8 +1792,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (functionContextUnresolved.isEmpty()) { int idx = functionContext.length(); if (idx < 2) { - qWarning("%s:%d: tr() cannot be called without context\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "tr() cannot be called without context\n"; break; } Namespace *fctx; @@ -1800,9 +1801,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = stringifyNamespace(functionContext); fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { - qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(context)); + yyMsg() << "Class '" << qPrintable(context) + << "' lacks Q_OBJECT macro\n"; fctx->complained = true; } goto gotctx; @@ -1830,9 +1830,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) int last = prefix.lastIndexOf(strColons); QString className = prefix.mid(last == -1 ? 0 : last + 2); if (!className.isEmpty() && className == functionName) { - qWarning("%s::%d: It is not recommended to call tr() from within a constructor '%s::%s' ", - qPrintable(yyFileName), yyLineNo, - className.constData(), functionName.constData()); + yyMsg() << "It is not recommended to call tr() from within a constructor '" + << qPrintable(className) << "::" << qPrintable(functionName) << "'\n"; } #endif prefix.chop(2); @@ -1847,9 +1846,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = fctx->trQualification; } if (!fctx->hasTrFunctions && !fctx->complained) { - qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(context)); + yyMsg() << "Class '" << qPrintable(context) << "' lacks Q_OBJECT macro\n"; fctx->complained = true; } } else { @@ -1870,8 +1867,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); @@ -1925,8 +1921,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!msgid.isEmpty()) - qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n"; //utf8 = false; // Maybe use //%% or something like that line = yyLineNo; yyTok = getToken(); @@ -1993,15 +1988,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (isspace(c)) continue; if (c != '"') { - qWarning("%s:%d: Unexpected character in meta string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unexpected character in meta string\n"; break; } forever { if (p >= yyWord.length()) { whoops: - qWarning("%s:%d: Unterminated meta string\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Unterminated meta string\n"; break; } c = yyWord.unicode()[p++].unicode(); @@ -2054,8 +2047,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) case Tok_Arrow: yyTok = getToken(); if (yyTok == Tok_tr || yyTok == Tok_trUtf8) - qWarning("%s:%d: Cannot invoke tr() like this\n", - qPrintable(yyFileName), yyLineNo); + yyMsg() << "Cannot invoke tr() like this\n"; break; case Tok_ColonColon: if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0 && !yyTokColonSeen) @@ -2123,17 +2115,17 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } if (yyBraceDepth != 0) - qWarning("%s:%d: Unbalanced opening brace in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyBraceLineNo); + yyMsg(yyBraceLineNo) + << "Unbalanced opening brace in C++ code" + " (or abuse of the C++ preprocessor)\n"; else if (yyParenDepth != 0) - qWarning("%s:%d: Unbalanced opening parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyParenLineNo); + yyMsg(yyParenLineNo) + << "Unbalanced opening parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n"; else if (yyBracketDepth != 0) - qWarning("%s:%d: Unbalanced opening bracket in C++ code" - " (or abuse of the C++ preprocessor)\n", - qPrintable(yyFileName), yyBracketLineNo); + yyMsg(yyBracketLineNo) + << "Unbalanced opening bracket in C++ code" + " (or abuse of the C++ preprocessor)\n"; } const ParseResults *CppParser::recordResults(bool isHeader) diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 27988b04..dc66e2b 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -51,6 +51,8 @@ #include <QtCore/QString> #include <QtCore/QTextCodec> +#include <iostream> + #include <ctype.h> QT_BEGIN_NAMESPACE @@ -107,6 +109,11 @@ static QString yyPackage; static QStack<Scope*> yyScope; static QString yyDefaultContext; +std::ostream &yyMsg(int line = 0) +{ + return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": "; +} + static QChar getChar() { if (yyInPos >= yyInStr.size()) @@ -189,10 +196,7 @@ static int getToken() while ( !metAsterSlash ) { yyCh = getChar(); if ( yyCh == EOF ) { - qFatal( "%s: Unterminated Java comment starting at" - " line %d\n", - qPrintable(yyFileName), yyLineNo ); - + yyMsg() << "Unterminated Java comment.\n"; return Tok_Comment; } @@ -228,8 +232,8 @@ static int getToken() else { int sub(yyCh.toLower().toAscii() - 87); if( sub > 15 || sub < 10) { - qFatal( "%s:%d: Invalid Unicode", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Invalid Unicode value.\n"; + break; } unicode += sub; } @@ -251,8 +255,7 @@ static int getToken() } if ( yyCh != QLatin1Char('"') ) - qFatal( "%s:%d: Unterminated string", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Unterminated string.\n"; yyCh = getChar(); @@ -365,9 +368,8 @@ static bool matchString( QString &s ) if (yyTok == Tok_String) s += yyString; else { - qWarning( "%s:%d: String used in translation can only contain strings" - " concatenated with other strings, not expressions or numbers.", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "String used in translation can contain only literals" + " concatenated with other literals, not expressions or numbers.\n"; return false; } yyTok = getToken(); @@ -475,8 +477,8 @@ static void parse( Translator *tor ) yyScope.push(new Scope(yyIdent, Scope::Clazz, yyLineNo)); } else { - qFatal( "%s:%d: Class must be followed by a classname", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "'class' must be followed by a class name.\n"; + break; } while (!match(Tok_LeftBrace)) { yyTok = getToken(); @@ -547,8 +549,7 @@ static void parse( Translator *tor ) case Tok_RightBrace: if ( yyScope.isEmpty() ) { - qFatal( "%s:%d: Unbalanced right brace in Java code\n", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "Excess closing brace.\n"; } else delete (yyScope.pop()); @@ -577,8 +578,7 @@ static void parse( Translator *tor ) yyPackage.append(QLatin1String(".")); break; default: - qFatal( "%s:%d: Package keyword should be followed by com.package.name;", - qPrintable(yyFileName), yyLineNo ); + yyMsg() << "'package' must be followed by package name.\n"; break; } yyTok = getToken(); @@ -591,11 +591,9 @@ static void parse( Translator *tor ) } if ( !yyScope.isEmpty() ) - qFatal( "%s:%d: Unbalanced braces in Java code\n", - qPrintable(yyFileName), yyScope.top()->line ); + yyMsg(yyScope.top()->line) << "Unbalanced opening brace.\n"; else if ( yyParenDepth != 0 ) - qFatal( "%s:%d: Unbalanced parentheses in Java code\n", - qPrintable(yyFileName), yyParenLineNo ); + yyMsg(yyParenLineNo) << "Unbalanced opening parenthesis.\n"; } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6c9157a..a575192 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -57,16 +57,15 @@ static QString m_defaultExtensions; -static void printErr(const QString & out) -{ - qWarning("%s", qPrintable(out)); -} - static void printOut(const QString & out) { std::cerr << qPrintable(out); } +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + static void recursiveFileInfoList(const QDir &dir, const QSet<QString> &nameFilters, QDir::Filters filter, QFileInfoList *fileinfolist) @@ -150,24 +149,25 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil cd.m_sortContexts = !(options & NoSort); if (QFile(fileName).exists()) { if (!tor.load(fileName, cd, QLatin1String("auto"))) { - printErr(cd.error()); + printOut(cd.error()); *fail = true; continue; } tor.resolveDuplicates(); cd.clearErrors(); if (setCodec && fetchedTor.codec() != tor.codec()) - qWarning("lupdate warning: Codec for tr() '%s' disagrees with " - "existing file's codec '%s'. Expect trouble.", - fetchedTor.codecName().constData(), tor.codecName().constData()); + printOut(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()) - qWarning("lupdate warning: Specified target language '%s' disagrees with " - "existing file's language '%s'. Ignoring.", - qPrintable(targetLanguage), qPrintable(tor.languageCode())); + printOut(LU::tr("lupdate warning: Specified target language '%1' disagrees with" + " existing file's language '%2'. Ignoring.\n") + .arg(targetLanguage, tor.languageCode())); if (!sourceLanguage.isEmpty() && sourceLanguage != tor.sourceLanguageCode()) - qWarning("lupdate warning: Specified source language '%s' disagrees with " - "existing file's language '%s'. Ignoring.", - qPrintable(sourceLanguage), qPrintable(tor.sourceLanguageCode())); + printOut(LU::tr("lupdate warning: Specified source language '%1' disagrees with" + " existing file's language '%2'. Ignoring.\n") + .arg(sourceLanguage, tor.sourceLanguageCode())); } else { if (setCodec) tor.setCodec(fetchedTor.codec()); @@ -210,11 +210,11 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil out.normalizeTranslations(cd); if (!cd.errors().isEmpty()) { - printErr(cd.error()); + printOut(cd.error()); cd.clearErrors(); } if (!out.save(fileName, cd, QLatin1String("auto"))) { - printErr(cd.error()); + printOut(cd.error()); *fail = true; } } @@ -296,8 +296,9 @@ static void processProject( if (!tmp.isEmpty()) { codecForSource = tmp.last().toLatin1(); if (!QTextCodec::codecForName(codecForSource)) { - qWarning("lupdate warning: Codec for source '%s' is invalid. " - "Falling back to codec for tr().", codecForSource.constData()); + printOut(LU::tr("lupdate warning: Codec for source '%1' is invalid." + " Falling back to codec for tr().\n") + .arg(QString::fromLatin1(codecForSource))); codecForSource.clear(); } } @@ -452,7 +453,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-target-language")) { ++i; if (i == argc) { - qWarning("The option -target-language requires a parameter."); + printOut(LU::tr("The option -target-language requires a parameter.\n")); return 1; } targetLanguage = args[i]; @@ -460,7 +461,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-source-language")) { ++i; if (i == argc) { - qWarning("The option -source-language requires a parameter."); + printOut(LU::tr("The option -source-language requires a parameter.\n")); return 1; } sourceLanguage = args[i]; @@ -468,7 +469,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-disable-heuristic")) { ++i; if (i == argc) { - qWarning("The option -disable-heuristic requires a parameter."); + printOut(LU::tr("The option -disable-heuristic requires a parameter.\n")); return 1; } arg = args[i]; @@ -479,14 +480,14 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("number")) { options &= ~HeuristicNumber; } else { - qWarning("Invalid heuristic name passed to -disable-heuristic."); + printOut(LU::tr("Invalid heuristic name passed to -disable-heuristic.\n")); return 1; } continue; } else if (arg == QLatin1String("-locations")) { ++i; if (i == argc) { - qWarning("The option -locations requires a parameter."); + printOut(LU::tr("The option -locations requires a parameter.\n")); return 1; } if (args[i] == QLatin1String("none")) { @@ -496,7 +497,7 @@ int main(int argc, char **argv) } else if (args[i] == QLatin1String("absolute")) { options |= AbsoluteLocations; } else { - qWarning("Invalid parameter passed to -locations."); + printOut(LU::tr("Invalid parameter passed to -locations.\n")); return 1; } continue; @@ -522,7 +523,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-codecfortr")) { ++i; if (i == argc) { - qWarning("The -codecfortr option should be followed by a codec name."); + printOut(LU::tr("The -codecfortr option should be followed by a codec name.\n")); return 1; } codecForTr = args[i].toLatin1(); @@ -533,7 +534,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-extensions")) { ++i; if (i == argc) { - qWarning("The -extensions option should be followed by an extension list."); + printOut(LU::tr("The -extensions option should be followed by an extension list.\n")); return 1; } extensions = args[i]; @@ -541,7 +542,7 @@ int main(int argc, char **argv) } else if (arg == QLatin1String("-pro")) { ++i; if (i == argc) { - qWarning("The -pro option should be followed by a filename of .pro file."); + printOut(LU::tr("The -pro option should be followed by a filename of .pro file.\n")); return 1; } proFiles += args[i]; @@ -551,7 +552,7 @@ int main(int argc, char **argv) if (arg.length() == 2) { ++i; if (i == argc) { - qWarning("The -I option should be followed by a path."); + printOut(LU::tr("The -I option should be followed by a path.\n")); return 1; } includePath += args[i]; @@ -560,7 +561,7 @@ int main(int argc, char **argv) } continue; } else if (arg.startsWith(QLatin1String("-")) && arg != QLatin1String("-")) { - qWarning("Unrecognized option '%s'", qPrintable(arg)); + printOut(LU::tr("Unrecognized option '%1'.\n").arg(arg)); return 1; } @@ -568,8 +569,8 @@ int main(int argc, char **argv) if (arg.startsWith(QLatin1String("@"))) { QFile lstFile(arg.mid(1)); if (!lstFile.open(QIODevice::ReadOnly)) { - qWarning("lupdate error: List file '%s' is not readable", - qPrintable(lstFile.fileName())); + printOut(LU::tr("lupdate error: List file '%1' is not readable.\n") + .arg(lstFile.fileName())); return 1; } while (!lstFile.atEnd()) @@ -586,16 +587,16 @@ int main(int argc, char **argv) if (!fi.exists() || fi.isWritable()) { tsFileNames.append(QFileInfo(file).absoluteFilePath()); } else { - qWarning("lupdate warning: For some reason, '%s' is not writable.\n", - qPrintable(file)); + printOut(LU::tr("lupdate warning: For some reason, '%1' is not writable.\n") + .arg(file)); } found = true; break; } } if (!found) { - qWarning("lupdate error: File '%s' has no recognized extension\n", - qPrintable(file)); + printOut(LU::tr("lupdate error: File '%1' has no recognized extension.\n") + .arg(file)); return 1; } } @@ -604,7 +605,7 @@ int main(int argc, char **argv) foreach (const QString &file, files) { QFileInfo fi(file); if (!fi.exists()) { - qWarning("lupdate error: File '%s' does not exists\n", qPrintable(file)); + printOut(LU::tr("lupdate error: File '%1' does not exist.\n").arg(file)); return 1; } if (file.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) @@ -612,7 +613,7 @@ int main(int argc, char **argv) proFiles << file; } else if (fi.isDir()) { if (options & Verbose) - printOut(QObject::tr("Scanning directory '%1'...").arg(file)); + printOut(QObject::tr("Scanning directory '%1'...\n").arg(file)); QDir dir = QDir(fi.filePath()); projectRoots.insert(dir.absolutePath() + QLatin1Char('/')); if (extensionsNameFilters.isEmpty()) { @@ -650,6 +651,7 @@ int main(int argc, char **argv) } } else { sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; + projectRoots.insert(fi.absolutePath() + QLatin1Char('/')); } } numFiles++; @@ -662,16 +664,16 @@ int main(int argc, char **argv) } if (!targetLanguage.isEmpty() && tsFileNames.count() != 1) - std::cerr << "lupdate warning: -target-language usually only " - "makes sense with exactly one TS file.\n"; + printOut(LU::tr("lupdate warning: -target-language usually only" + " makes sense with exactly one TS file.\n")); if (!codecForTr.isEmpty() && tsFileNames.isEmpty()) - std::cerr << "lupdate warning: -codecfortr has no effect without -ts.\n"; + printOut(LU::tr("lupdate warning: -codecfortr has no effect without -ts.\n")); bool fail = false; if (proFiles.isEmpty()) { if (tsFileNames.isEmpty()) - std::cerr << "lupdate warning: no TS files specified. " - "Only diagnostics will be produced.\n"; + printOut(LU::tr("lupdate warning:" + " no TS files specified. Only diagnostics will be produced.\n")); Translator fetchedTor; ConversionData cd; @@ -685,7 +687,8 @@ int main(int argc, char **argv) sourceLanguage, targetLanguage, options, &fail); } else { if (!sourceFiles.isEmpty() || !includePath.isEmpty()) { - qWarning("lupdate error: Both project and source files / include paths specified.\n"); + printOut(LU::tr("lupdate error:" + " Both project and source files / include paths specified.\n")); return 1; } if (!tsFileNames.isEmpty()) { diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index 33276e6..188ac36 100644 --- a/tools/linguist/lupdate/qscript.cpp +++ b/tools/linguist/lupdate/qscript.cpp @@ -53,6 +53,8 @@ #include <QtCore/qtextcodec.h> #include <QtCore/qvariant.h> +#include <iostream> + #include <ctype.h> #include <stdlib.h> #include <stdio.h> @@ -2214,13 +2216,13 @@ case 66: { if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 2) { - qWarning("%s:%d: %s() requires at least two arguments", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least two arguments.\n"; } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - qWarning("%s:%d: %s(): both arguments must be literal strings", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): both arguments must be literal strings.\n"; } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); @@ -2234,12 +2236,12 @@ case 66: { } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 1) { - qWarning("%s:%d: %s() requires at least one argument", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least one argument.\n"; } else { if (args.at(0).type() != QVariant::String) { - qWarning("%s:%d: %s(): text to translate must be a literal string", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): text to translate must be a literal string.\n"; } else { QString context = QFileInfo(fileName).baseName(); QString text = args.at(0).toString(); @@ -2377,8 +2379,8 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; if (!parser.parse(&lexer, filename, &translator)) { - qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(), - qPrintable(parser.errorMessage())); + std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " + << qPrintable(parser.errorMessage()) << std::endl; return false; } diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g index a473500..857c58a 100644 --- a/tools/linguist/lupdate/qscript.g +++ b/tools/linguist/lupdate/qscript.g @@ -90,6 +90,8 @@ #include <QtCore/qtextcodec.h> #include <QtCore/qvariant.h> +#include <iostream> + #include <ctype.h> #include <stdlib.h> #include <stdio.h> @@ -106,7 +108,7 @@ static void recordMessage( fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); - tor->replace(msg); + tor->extend(msg); } @@ -1630,13 +1632,13 @@ case $rule_number: { if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 2) { - qWarning("%s:%d: %s() requires at least two arguments", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least two arguments.\n"; } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - qWarning("%s:%d: %s(): both arguments must be literal strings", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): both arguments must be literal strings.\n"; } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); @@ -1650,12 +1652,12 @@ case $rule_number: { } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { QVariantList args = sym(2).toList(); if (args.size() < 1) { - qWarning("%s:%d: %s() requires at least one argument", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "() requires at least one argument.\n"; } else { if (args.at(0).type() != QVariant::String) { - qWarning("%s:%d: %s(): text to translate must be a literal string", - qPrintable(fileName), identLineNo, qPrintable(name)); + std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " + << qPrintable(name) << "(): text to translate must be a literal string.\n"; } else { QString context = QFileInfo(fileName).baseName(); QString text = args.at(0).toString(); @@ -2009,8 +2011,8 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; if (!parser.parse(&lexer, filename, &translator)) { - qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(), - qPrintable(parser.errorMessage())); + std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " + << qPrintable(parser.errorMessage()) << std::endl; return false; } diff --git a/tools/linguist/phrasebooks/hungarian.qph b/tools/linguist/phrasebooks/hungarian.qph new file mode 100644 index 0000000..0e1dd12 --- /dev/null +++ b/tools/linguist/phrasebooks/hungarian.qph @@ -0,0 +1,752 @@ +<!DOCTYPE QPH> +<QPH language="hu_HU"> +<phrase> + <source>OK</source> + <target>OK</target> +</phrase> +<phrase> + <source>Bookmarks</source> + <target>Könyvjelzők</target> +</phrase> +<phrase> + <source>Remove</source> + <target>Törlés</target> +</phrase> +<phrase> + <source>New Folder</source> + <target>Új könyvtár</target> +</phrase> +<phrase> + <source>Add</source> + <target>Hozzáadás</target> +</phrase> +<phrase> + <source>Previous</source> + <target>Előző</target> +</phrase> +<phrase> + <source>Font</source> + <target>Betűtípus</target> +</phrase> +<phrase> + <source>Help</source> + <target>Segítség</target> +</phrase> +<phrase> + <source>Done</source> + <target>Kész</target> +</phrase> +<phrase> + <source>Install</source> + <target>Telepítés</target> +</phrase> +<phrase> + <source>Cancel</source> + <target>Mégsem</target> +</phrase> +<phrase> + <source>Installation Path:</source> + <target>Telepítési útvonal:</target> +</phrase> +<phrase> + <source>Index</source> + <target>Index</target> +</phrase> +<phrase> + <source>Contents</source> + <target>Tartalom</target> +</phrase> +<phrase> + <source>Search</source> + <target>Keresés</target> +</phrase> +<phrase> + <source>Print Preview...</source> + <target>Nyomtatási kép...</target> +</phrase> +<phrase> + <source>About...</source> + <target>Névjegy...</target> +</phrase> +<phrase> + <source>Toolbars</source> + <target>Eszköztárak</target> +</phrase> +<phrase> + <source>Address:</source> + <target>Cím:</target> +</phrase> +<phrase> + <source>Open Source Edition</source> + <target>Nyíltforrású kiadás</target> +</phrase> +<phrase> + <source>Yes</source> + <target>Igen</target> +</phrase> +<phrase> + <source>No</source> + <target>Nem</target> +</phrase> +<phrase> + <source>Apply</source> + <target>Alkalmaz</target> +</phrase> +<phrase> + <source>Ignore</source> + <target>Kihagyás</target> +</phrase> +<phrase> + <source>Abort</source> + <target>Megszakítás</target> +</phrase> +<phrase> + <source>Play</source> + <target>Lejátszás</target> +</phrase> +<phrase> + <source>Pause</source> + <target>Szünet</target> +</phrase> +<phrase> + <source>File</source> + <target>Fájl</target> + <definition>menu</definition> +</phrase> +<phrase> + <source>file</source> + <target>fájl</target> +</phrase> +<phrase> + <source>directory</source> + <target>könyvtár</target> +</phrase> +<phrase> + <source>Symlink</source> + <target>Szimbolikus link</target> +</phrase> +<phrase> + <source>Delete</source> + <target>Törlés</target> +</phrase> +<phrase> + <source>Rename</source> + <target>Átnevezés</target> +</phrase> +<phrase> + <source>Back</source> + <target>Vissza</target> +</phrase> +<phrase> + <source>Forward</source> + <target>Előre</target> +</phrase> +<phrase> + <source>Finish</source> + <target>Befejezés</target> +</phrase> +<phrase> + <source>Quit</source> + <target>Kilépés</target> +</phrase> +<phrase> + <source>Exit</source> + <target>Kilépés</target> +</phrase> +<phrase> + <source>Close</source> + <target>Bezárás</target> +</phrase> +<phrase> + <source>Close All</source> + <target>Mindent bezár</target> +</phrase> +<phrase> + <source>Error</source> + <target>Hiba</target> +</phrase> +<phrase> + <source>Warning</source> + <target>Figyelmeztetés</target> +</phrase> +<phrase> + <source>Information</source> + <target>Információ</target> +</phrase> +<phrase> + <source>Question</source> + <target>Kérdés</target> +</phrase> +<phrase> + <source>document</source> + <target>dokumentum</target> +</phrase> +<phrase> + <source>author</source> + <target>szerző</target> +</phrase> +<phrase> + <source>subsidiary(-ies)</source> + <target>leányvállalata(i)</target> +</phrase> +<phrase> + <source>Help</source> + <target>Súgó</target> +</phrase> +<phrase> + <source>Undo</source> + <target>Visszavonás</target> +</phrase> +<phrase> + <source>Redo</source> + <target>Újra</target> +</phrase> +<phrase> + <source>Open</source> + <target>Megnyitás</target> +</phrase> +<phrase> + <source>Save</source> + <target>Mentés</target> +</phrase> +<phrase> + <source>Save all</source> + <target>Mindet menti</target> +</phrase> +<phrase> + <source>click</source> + <target>kattintás</target> + <definition>noun</definition> +</phrase> +<phrase> + <source>click</source> + <target>kattintson</target> + <definition>ask</definition> +</phrase> +<phrase> + <source>Recent</source> + <target>Előző</target> + <definition>Recent files/Előző fájlok</definition> +</phrase> +<phrase> + <source>Window</source> + <target>Ablak</target> +</phrase> +<phrase> + <source>Cascade</source> + <target>Lépcsőzetes</target> +</phrase> +<phrase> + <source>Tile</source> + <target>Mozaikszerű</target> +</phrase> +<phrase> + <source>Game</source> + <target>Játék</target> +</phrase> +<phrase> + <source>New Game</source> + <target>Új játék</target> +</phrase> +<phrase> + <source>Untitled</source> + <target>Névtelen</target> +</phrase> +<phrase> + <source>Unknown error</source> + <target>Ismeretlen hiba</target> +</phrase> +<phrase> + <source>New Folder</source> + <target>Új mappa</target> +</phrase> +<phrase> + <source>folder</source> + <target>mappa</target> +</phrase> +<phrase> + <source>New Directory</source> + <target>Új könyvtár</target> +</phrase> +<phrase> + <source>unknown</source> + <target>ismeretlen</target> +</phrase> +<phrase> + <source>Copy</source> + <target>Másolás</target> +</phrase> +<phrase> + <source>Cut</source> + <target>Kivágás</target> +</phrase> +<phrase> + <source>Paste</source> + <target>Beillesztés</target> +</phrase> +<phrase> + <source>Paste special</source> + <target>Speciális beillesztés</target> +</phrase> +<phrase> + <source>Insert</source> + <target>Beszúrás</target> +</phrase> +<phrase> + <source>Copy here</source> + <target>Másolás ide</target> +</phrase> +<phrase> + <source>Minimize</source> + <target>Minimalizálás</target> +</phrase> +<phrase> + <source>Zoom</source> + <target>Nagyítás</target> +</phrase> +<phrase> + <source>&Edit</source> + <target>S&zerkesztés</target> +</phrase> +<phrase> + <source>&View</source> + <target>&Nézet</target> +</phrase> +<phrase> + <source>Application</source> + <target>Alkalmazás</target> +</phrase> +<phrase> + <source>Documentation</source> + <target>Dokumentáció</target> +</phrase> +<phrase> + <source>Network</source> + <target>Hálózat</target> +</phrase> +<phrase> + <source>Current Page</source> + <target>Aktuális oldal</target> +</phrase> +<phrase> + <source>Find</source> + <target>Keresés</target> +</phrase> +<phrase> + <source>Locale</source> + <target>Nyelv</target> +</phrase> +<phrase> + <source>Cannot open '%1'.</source> + <target>'%1' nem nyitható meg.</target> +</phrase> +<phrase> + <source>Cannot find the string '%1'.</source> + <target>A szöveg nem található: '%1'.</target> +</phrase> +<phrase> + <source>A file called '%1' already exists. Please choose another name.</source> + <target>'%1' nevű fájl már létezik. Válasszon egy másik nevet.</target> +</phrase> +<phrase> + <source>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</source> + <target>Ez a program abban a reményben került közreadásra, hogy hasznos lesz, de minden egyéb GARANCIA NÉLKÜL, az ELADHATÓSÁGRA vagy VALAMELY CÉLRA VALÓ ALKALMAZHATÓSÁGRA való származtatott garanciát is beleértve.</target> + <definition>License text in most Qt programs</definition> +</phrase> +<phrase> + <source>Open Link</source> + <target>Link megnyitása</target> +</phrase> +<phrase> + <source>Next</source> + <target>Következő</target> +</phrase> +<phrase> + <source>Case Sensitive</source> + <target>Kis/nagybetű érzékeny</target> +</phrase> +<phrase> + <source>Whole words</source> + <target>Teljes szó</target> +</phrase> +<phrase> + <source>Open Link in New Tab</source> + <target>Link megnyitása új lapon</target> +</phrase> +<phrase> + <source>Download canceled.</source> + <target>Letöltés megszakítva.</target> +</phrase> +<phrase> + <source>The file %1 already exists. Do you want to overwrite it?</source> + <target>A(z) '%1' nevű fájl már létezik. Felülírja?</target> +</phrase> +<phrase> + <source>Qt Assistant</source> + <target>Qt Asszisztens</target> +</phrase> +<phrase> + <source>Preferences...</source> + <target>Beállítások...</target> +</phrase> +<phrase> + <source>&File</source> + <target>&Fájl</target> +</phrase> +<phrase> + <source>Browser</source> + <target>Böngésző</target> +</phrase> +<phrase> + <source>Filters</source> + <target>Szűrők</target> +</phrase> +<phrase> + <source>Delete Folder</source> + <target>Mappa törlése</target> +</phrase> +<phrase> + <source>Rename Folder</source> + <target>Mappa átnevezése</target> +</phrase> +<phrase> + <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://www.trolltech.com/company/model.html">www.trolltech.com/company/model.html</a> for an overview of Qt licensing.</source> + <target>Amennyiben zárt forrású alkalmazás fejlesztéséhez kívánja a Qt-t felhasználni, szüksége lesz a Qt kereskedelmi verziójára. Kérem tekintse meg az <tt>http://www.trolltech.com/company/model.html</tt> oldalt a Qt licenszelésének áttekintéséhez.</target> +</phrase> +<phrase> + <source>New Tab</source> + <target>Új fül</target> +</phrase> +<phrase> + <source>Close Tab</source> + <target>Fül bezárása</target> +</phrase> +<phrase> + <source>Close Other Tabs</source> + <target>A többi fül bezárása</target> +</phrase> +<phrase> + <source>True</source> + <target>Igaz</target> +</phrase> +<phrase> + <source>False</source> + <target>Hamis</target> +</phrase> +<phrase> + <source>Update</source> + <target>Frissítés</target> +</phrase> +<phrase> + <source>Normal</source> + <target>Normál</target> +</phrase> +<phrase> + <source>Bold</source> + <target>Félkövér</target> +</phrase> +<phrase> + <source>Italic</source> + <target>Dőlt</target> +</phrase> +<phrase> + <source>Greek</source> + <target>Görög</target> +</phrase> +<phrase> + <source>Cyrillic</source> + <target>Cirill</target> +</phrase> +<phrase> + <source>Armenian</source> + <target>Örmény</target> +</phrase> +<phrase> + <source>Hebrew</source> + <target>Héber</target> +</phrase> +<phrase> + <source>Arabic</source> + <target>Arab</target> +</phrase> +<phrase> + <source>Syriac</source> + <target>Szír</target> +</phrase> +<phrase> + <source>Permission denied</source> + <target>Hozzáférés megtagadva</target> +</phrase> +<phrase> + <source>Too many open files</source> + <target>Túl sok fájl van nyitva</target> +</phrase> +<phrase> + <source>No such file or directory</source> + <target>Nincs ilyen fájl vagy könyvtár</target> +</phrase> +<phrase> + <source>No space left on device</source> + <target>Nincs több hely az eszközön</target> +</phrase> +<phrase> + <source>Width:</source> + <target>Szélesség:</target> +</phrase> +<phrase> + <source>Height:</source> + <target>Magasság:</target> +</phrase> +<phrase> + <source>Margins</source> + <target>Margók</target> +</phrase> +<phrase> + <source>top margin</source> + <target>felső margó</target> +</phrase> +<phrase> + <source>left margin</source> + <target>bal margó</target> +</phrase> +<phrase> + <source>right margin</source> + <target>jobb margó</target> +</phrase> +<phrase> + <source>bottom margin</source> + <target>alsó margó</target> +</phrase> +<phrase> + <source>Next page</source> + <target>Következő oldal</target> +</phrase> +<phrase> + <source>Previous page</source> + <target>Előző oldal</target> +</phrase> +<phrase> + <source>First page</source> + <target>Első oldal</target> +</phrase> +<phrase> + <source>Last page</source> + <target>Utolsó oldal</target> +</phrase> +<phrase> + <source>Fit width</source> + <target>Szélesség igazítása</target> +</phrase> +<phrase> + <source>Fit page</source> + <target>Oldal igazítása</target> +</phrase> +<phrase> + <source>Zoom in</source> + <target>Nagyítás</target> +</phrase> +<phrase> + <source>Zoom out</source> + <target>Kicsinyítés</target> +</phrase> +<phrase> + <source>Portrait</source> + <target>Álló</target> +</phrase> +<phrase> + <source>Landscape</source> + <target>Fekvő</target> +</phrase> +<phrase> + <source>Print</source> + <target>Nyomtatás</target> +</phrase> +<phrase> + <source>Page setup</source> + <target>Oldalbeállítás</target> +</phrase> +<phrase> + <source>Color</source> + <target>Szín</target> +</phrase> +<phrase> + <source>Grayscale</source> + <target>Szürkeárnyalatos</target> +</phrase> +<phrase> + <source>None</source> + <target>Nincs</target> +</phrase> +<phrase> + <source>...</source> + <target>...</target> +</phrase> +<phrase> + <source>Menu</source> + <target>Menü</target> +</phrase> +<phrase> + <source>Keep</source> + <target>Meghagy</target> +</phrase> +<phrase> + <source>Pause</source> + <target>Megállít</target> +</phrase> +<phrase> + <source>Log</source> + <target>Napló</target> +</phrase> +<phrase> + <source>Mi&nimize</source> + <target>&Kis méret</target> +</phrase> +<phrase> + <source>Press</source> + <target>Nyomja meg</target> +</phrase> +<phrase> + <source>Submit</source> + <target>Küldés</target> +</phrase> +<phrase> + <source>Underline</source> + <target>Aláhúzott</target> +</phrase> +<phrase> + <source>Outline</source> + <target>Áthúzott</target> +</phrase> +<phrase> + <source>Direction</source> + <target>Irány</target> +</phrase> +<phrase> + <source>Configuration</source> + <target>Konfiguráció</target> +</phrase> +<phrase> + <source>None</source> + <target>Semmi</target> +</phrase> +<phrase> + <source>Save As...</source> + <target>Mentés másként...</target> +</phrase> +<phrase> + <source>Context</source> + <target>Környezet</target> +</phrase> +<phrase> + <source>Edit</source> + <target>Szerkesztés</target> +</phrase> +<phrase> + <source>Toolbar</source> + <target>Eszköztár</target> +</phrase> +<phrase> + <source>&Print...</source> + <target>&Nyomtatás...</target> +</phrase> +<phrase> + <source>E&xit</source> + <target>&Kilépés</target> +</phrase> +<phrase> + <source>Sidebar</source> + <target>Oldalsáv</target> +</phrase> +<phrase> + <source>Bookmark</source> + <target>Könyvjelző</target> +</phrase> +<phrase> + <source>Save As</source> + <target>Mentés másként</target> +</phrase> +<phrase> + <source>Select All</source> + <target>Összes kijelölése</target> +</phrase> +<phrase> + <source>Name</source> + <target>Név</target> +</phrase> +<phrase> + <source>Type</source> + <target>Típus</target> +</phrase> +<phrase> + <source>Date</source> + <target>Dátum</target> +</phrase> +<phrase> + <source>Name</source> + <target>Név</target> +</phrase> +<phrase> + <source>Unknown</source> + <target>Ismeretlen</target> +</phrase> +<phrase> + <source>Value</source> + <target>Érték</target> +</phrase> +<phrase> + <source>Default</source> + <target>Alapértelmezett</target> +</phrase> +<phrase> + <source>New</source> + <target>Új</target> +</phrase> +<phrase> + <source>Level</source> + <target>Szint</target> +</phrase> +<phrase> + <source>Location</source> + <target>Hely</target> +</phrase> +<phrase> + <source>Reload</source> + <target>Újratöltés</target> +</phrase> +<phrase> + <source>Pictures</source> + <target>Képek</target> +</phrase> +<phrase> + <source>Battery</source> + <target>Elem</target> +</phrase> +<phrase> + <source>No error</source> + <target>Nincs hiba</target> +</phrase> +<phrase> + <source>Whole words</source> + <target>Teljes szó</target> +</phrase> +<phrase> + <source>(Új bejegyzés)</source> + <target></target> +</phrase> +<phrase> + <source>Horizontal</source> + <target>Vízszintes</target> +</phrase> +<phrase> + <source>Enabled</source> + <target>Engedélyezve</target> +</phrase> +<phrase> + <source>Up</source> + <target>Fel</target> +</phrase> +<phrase> + <source>Down</source> + <target>Le</target> +</phrase> +</QPH> diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph index ae1a9b9..750fda0 100644 --- a/tools/linguist/phrasebooks/russian.qph +++ b/tools/linguist/phrasebooks/russian.qph @@ -826,7 +826,7 @@ </phrase> <phrase> <source>slider</source> - <target>ползунок</target> + <target>регулятор</target> </phrase> <phrase> <source>spin box</source> diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 99a8751..a692332 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -353,6 +353,29 @@ static void slurpComment(QByteArray &msg, const QList<QByteArray> &lines, int & --l; } +static void splitContext(QByteArray *comment, QByteArray *context) +{ + char *data = comment->data(); + int len = comment->size(); + int sep = -1, j = 0; + + for (int i = 0; i < len; i++, j++) { + if (data[i] == '~' && i + 1 < len) + i++; + else if (data[i] == '|') + sep = j; + data[j] = data[i]; + } + if (sep >= 0) { + QByteArray tmp = comment->mid(sep + 1, j - sep - 1); + comment->truncate(sep); + *context = *comment; + *comment = tmp; + } else { + comment->truncate(j); + } +} + static QString makePoHeader(const QString &str) { return QLatin1String("po-header-") + str.toLower().replace(QLatin1Char('-'), QLatin1Char('_')); @@ -411,6 +434,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) lines.append(QByteArray()); int l = 0, lastCmtLine = -1; + bool qtContexts = false; PoItem item; for (; l != lines.size(); ++l) { QByteArray line = lines.at(l); @@ -437,7 +461,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) continue; int idx = hdr.indexOf(':'); if (idx < 0) { - cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'\n") + cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'") .arg(QString::fromLatin1(hdr))); error = true; break; @@ -449,6 +473,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) translator.setLanguageCode(QString::fromLatin1(hdrValue)); } else if (hdrName == "X-Source-Language") { translator.setSourceLanguageCode(QString::fromLatin1(hdrValue)); + } else if (hdrName == "X-Qt-Contexts") { + qtContexts = (hdrValue == "true"); } else if (hdrName == "Plural-Forms") { pluralForms = hdrValue; } else if (hdrName == "MIME-Version") { @@ -456,7 +482,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } 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'\n") + cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'") .arg(QString::fromLatin1(hdrValue))); error = true; // This will avoid a flood of conversion errors. @@ -465,7 +491,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) QByteArray cod = hdrValue.mid(20); QTextCodec *cdc = QTextCodec::codecForName(cod); if (!cdc) { - cd.appendError(QString::fromLatin1("Unsupported codec '%1'\n") + cd.appendError(QString::fromLatin1("Unsupported codec '%1'") .arg(QString::fromLatin1(cod))); error = true; // This will avoid a flood of conversion errors. @@ -477,7 +503,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } } else if (hdrName == "Content-Transfer-Encoding") { if (hdrValue != "8bit") { - cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'\n") + cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'") .arg(QString::fromLatin1(hdrValue))); return false; } @@ -498,7 +524,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) // Keep in sync with savePO static const char * const dfltHdrs[] = { "MIME-Version", "Content-Type", "Content-Transfer-Encoding", - "Plural-Forms", "X-Language", "X-Source-Language" + "Plural-Forms", "X-Language", "X-Source-Language", "X-Qt-Contexts" }; uint cdh = 0; for (int cho = 0; cho < hdrOrder.length(); cho++) { @@ -596,7 +622,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) slurpComment(item.translatorComments, lines, l); break; case '.': - if (line.startsWith("#. ts-context ")) { + if (line.startsWith("#. ts-context ")) { // legacy item.context = line.mid(14); } else if (line.startsWith("#. ts-id ")) { item.id = line.mid(9); @@ -615,8 +641,10 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) codec->toUnicode(extra); } else if (line.startsWith("#| msgctxt ")) { item.oldTscomment = slurpEscapedString(lines, l, 11, "#| ", cd); + if (qtContexts) + splitContext(&item.oldTscomment, &item.context); } else { - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } @@ -633,13 +661,13 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) } else if (line.startsWith("#~ msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd); } else { - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } break; default: - cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; break; @@ -647,6 +675,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) lastCmtLine = l; } else if (line.startsWith("msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 8, QByteArray(), cd); + if (qtContexts) + splitContext(&item.tscomment, &item.context); } else if (line.startsWith("msgid ")) { item.msgId = slurpEscapedString(lines, l, 6, QByteArray(), cd); } else if (line.startsWith("msgid_plural ")) { @@ -655,7 +685,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) item.extra[QLatin1String("po-msgid_plural")] = codec->toUnicode(extra); item.isPlural = true; } else { - cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'\n")) + cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); error = true; } @@ -672,6 +702,16 @@ static void addPoHeader(Translator::ExtraData &headers, QStringList &hdrOrder, headers[makePoHeader(qName)] = value; } +static QString escapeComment(const QString &in, bool escape) +{ + QString out = in; + if (escape) { + out.replace(QLatin1Char('~'), QLatin1String("~~")); + out.replace(QLatin1Char('|'), QLatin1String("~|")); + } + return out; +} + bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) { QString str_format = QLatin1String("-format"); @@ -680,6 +720,13 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QTextStream out(&dev); out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec); + bool qtContexts = false; + foreach (const TranslatorMessage &msg, translator.messages()) + if (!msg.context().isEmpty()) { + qtContexts = true; + break; + } + QString cmt = translator.extra(QLatin1String("po-header_comment")); if (!cmt.isEmpty()) out << cmt << '\n'; @@ -703,6 +750,8 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) } if (!translator.sourceLanguageCode().isEmpty()) addPoHeader(headers, hdrOrder, "X-Source-Language", translator.sourceLanguageCode()); + if (qtContexts) + addPoHeader(headers, hdrOrder, "X-Qt-Contexts", QLatin1String("true")); QString hdrStr; foreach (const QString &hdr, hdrOrder) { hdrStr += hdr; @@ -721,8 +770,6 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) if (!msg.extraComment().isEmpty()) out << poEscapedLines(QLatin1String("#."), true, msg.extraComment()); - if (!msg.context().isEmpty()) - out << QLatin1String("#. ts-context ") << msg.context() << '\n'; if (!msg.id().isEmpty()) out << QLatin1String("#. ts-id ") << msg.id() << '\n'; @@ -770,15 +817,21 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) QString prefix = QLatin1String("#| "); if (!msg.oldComment().isEmpty()) - out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.oldComment()); + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.oldComment(), qtContexts)); if (!msg.oldSourceText().isEmpty()) out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.oldSourceText()); QString plural = msg.extra(QLatin1String("po-old_msgid_plural")); if (!plural.isEmpty()) out << poEscapedString(prefix, QLatin1String("msgid_plural"), noWrap, plural); prefix = QLatin1String((msg.type() == TranslatorMessage::Obsolete) ? "#~ " : ""); - if (!msg.comment().isEmpty()) - out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.comment()); + if (!msg.context().isEmpty()) + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.context(), true) + QLatin1Char('|') + + escapeComment(msg.comment(), true)); + else if (!msg.comment().isEmpty()) + out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, + escapeComment(msg.comment(), qtContexts)); out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.sourceText()); if (!msg.isPlural()) { QString transl = msg.translation(); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 5e1ee1f..a21408c 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -2594,19 +2594,19 @@ void ProFileEvaluator::addProperties(const QHash<QString, QString> &properties) void ProFileEvaluator::logMessage(const QString &message) { if (d->m_verbose && !d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::fileMessage(const QString &message) { if (!d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::errorMessage(const QString &message) { if (!d->m_skipLevel) - qWarning("%s", qPrintable(message)); + fprintf(stderr, "%s\n", qPrintable(message)); } void ProFileEvaluator::setVerbose(bool on) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index e2c4f4a..6678943 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -773,11 +773,11 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData if (saved && cd.isVerbose()) { int generatedCount = finished + unfinished; cd.appendError(QCoreApplication::translate("LRelease", - " Generated %n translation(s) (%1 finished and %2 unfinished)\n", 0, + " Generated %n translation(s) (%1 finished and %2 unfinished)", 0, QCoreApplication::CodecForTr, generatedCount).arg(finished).arg(unfinished)); if (untranslated) cd.appendError(QCoreApplication::translate("LRelease", - " Ignored %n untranslated source text(s)\n", 0, + " Ignored %n untranslated source text(s)", 0, QCoreApplication::CodecForTr, untranslated)); } return saved; diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index c86a9dd..36af8da 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -43,6 +43,8 @@ #include "simtexth.h" +#include <iostream> + #include <stdio.h> #ifdef Q_OS_WIN // required for _setmode, to avoid _O_TEXT streams... @@ -586,22 +588,21 @@ void Translator::reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose) { if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) { + std::cerr << "Warning: dropping duplicate messages in '" << qPrintable(fileName); if (!verbose) { - qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).", - qPrintable(fileName)); + std::cerr << "'\n(try -verbose for more info).\n"; } else { - qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName)); + std::cerr << "':\n"; foreach (int i, dupes.byId) - qWarning("\n* ID: %s", qPrintable(message(i).id())); + std::cerr << "\n* ID: " << qPrintable(message(i).id()) << std::endl; foreach (int j, dupes.byContents) { const TranslatorMessage &msg = message(j); - qWarning("\n* Context: %s\n* Source: %s", - qPrintable(msg.context()), - qPrintable(msg.sourceText())); + std::cerr << "\n* Context: " << qPrintable(msg.context()) + << "\n* Source: " << qPrintable(msg.sourceText()) << std::endl; if (!msg.comment().isEmpty()) - qWarning("* Comment: %s", qPrintable(msg.comment())); + std::cerr << "* Comment: " << qPrintable(msg.comment()) << std::endl; } - qWarning(); + std::cerr << std::endl; } } } @@ -688,7 +689,7 @@ void Translator::normalizeTranslations(ConversionData &cd) cd.appendError(QLatin1String( "Removed plural forms as the target language has less " "forms.\nIf this sounds wrong, possibly the target language is " - "not set or recognized.\n")); + "not set or recognized.")); } QString Translator::guessLanguageCodeFromFileName(const QString &filename) @@ -737,7 +738,7 @@ void Translator::setCodecName(const QByteArray &name) QTextCodec *codec = QTextCodec::codecForName(name); if (!codec) { if (!name.isEmpty()) - qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData()); + std::cerr << "No QTextCodec for " << name.constData() << " available. Using Latin1.\n"; m_codec = QTextCodec::codecForName("ISO-8859-1"); } else { m_codec = codec; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index bb199f0..cfb2178 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -92,7 +92,7 @@ public: bool sortContexts() const { return m_sortContexts; } void appendError(const QString &error) { m_errors.append(error); } - QString error() const { return m_errors.join(QLatin1String("\n")); } + QString error() const { return m_errors.isEmpty() ? QString() : m_errors.join(QLatin1String("\n")) + QLatin1Char('\n'); } QStringList errors() const { return m_errors; } void clearErrors() { m_errors.clear(); } |