summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-10-02 06:40:17 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-10-02 06:40:17 (GMT)
commit17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690 (patch)
treeee9a982c144fb636ec22cdf7dd27de37725ff320 /tools/linguist
parentb148b182b5b48d60c2b57d8b74ad0f30272bb578 (diff)
parent7ea326d796a6d2ecb13b961c576c82a797d84706 (diff)
downloadQt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.zip
Qt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.tar.gz
Qt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.tar.bz2
Merge commit 'qt-mainline/4.6' into kinetic-declarativeui
Conflicts: configure.exe
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/lconvert/main.cpp8
-rw-r--r--tools/linguist/linguist/linguist.pro17
-rw-r--r--tools/linguist/lupdate/cpp.cpp6
-rw-r--r--tools/linguist/lupdate/main.cpp9
-rw-r--r--tools/linguist/shared/xliff.cpp15
5 files changed, 33 insertions, 22 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 67553a0..6f5f86a 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -234,10 +234,6 @@ int main(int argc, char *argv[])
return usage(args);
tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name));
- if (!targetLanguage.isEmpty())
- tr.setLanguageCode(targetLanguage);
- if (!sourceLanguage.isEmpty())
- tr.setSourceLanguageCode(sourceLanguage);
if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) {
qWarning() << qPrintable(cd.error());
@@ -256,6 +252,10 @@ int main(int argc, char *argv[])
tr.replaceSorted(tr2.message(j));
}
+ if (!targetLanguage.isEmpty())
+ tr.setLanguageCode(targetLanguage);
+ if (!sourceLanguage.isEmpty())
+ tr.setSourceLanguageCode(sourceLanguage);
if (noObsolete)
tr.stripObsoleteMessages();
if (noFinished)
diff --git a/tools/linguist/linguist/linguist.pro b/tools/linguist/linguist/linguist.pro
index 00ebec1..c902aeb 100644
--- a/tools/linguist/linguist/linguist.pro
+++ b/tools/linguist/linguist/linguist.pro
@@ -95,11 +95,12 @@ FORMS += statistics.ui \
finddialog.ui
RESOURCES += linguist.qrc
-TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/linguist_ja.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_pl.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_ru.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_untranslated.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_zh_CN.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_zh_TW.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_de.ts \
- $$[QT_INSTALL_TRANSLATIONS]/linguist_fr.ts
+TR_DIR = $$PWD/../../../translations
+TRANSLATIONS = \
+ $$TR_DIR/linguist_de.ts \
+ $$TR_DIR/linguist_fr.ts \
+ $$TR_DIR/linguist_ja.ts \
+ $$TR_DIR/linguist_pl.ts \
+ $$TR_DIR/linguist_ru.ts \
+ $$TR_DIR/linguist_zh_CN.ts \
+ $$TR_DIR/linguist_zh_TW.ts
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index ed41edb..7a616e3 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -1031,6 +1031,10 @@ QStringList CppParser::stringListifySegments(const QList<HashString> &segments)
}
struct QualifyOneData {
+ QualifyOneData(const NamespaceList &ns, int nsc, const HashString &seg, NamespaceList *rslvd)
+ : namespaces(ns), nsCount(nsc), segment(seg), resolved(rslvd)
+ {}
+
const NamespaceList &namespaces;
int nsCount;
const HashString &segment;
@@ -1069,7 +1073,7 @@ bool CppParser::qualifyOneCallbackUsing(const Namespace *ns, void *context) cons
bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment,
NamespaceList *resolved) const
{
- QualifyOneData data = { namespaces, nsCnt, segment, resolved, QSet<HashStringList>() };
+ QualifyOneData data(namespaces, nsCnt, segment, resolved);
if (visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackOwn, &data))
return true;
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index 24da253..d570e02 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -114,12 +114,11 @@ static void printUsage()
" Name of a .pro file. Useful for files with .pro\n"
" file syntax but different file suffix\n"
" -source-language <language>[_<region>]\n"
- " Specify/override the language of the source strings. Defaults to\n"
- " POSIX if not specified and the file does not name it yet.\n"
+ " Specify the language of the source strings for new files.\n"
+ " Defaults to POSIX if not specified.\n"
" -target-language <language>[_<region>]\n"
- " Specify/override the language of the translation.\n"
- " The target language is guessed from the file name if this option\n"
- " is not specified and the file contents name no language yet.\n"
+ " Specify the language of the translations for new files.\n"
+ " Guessed from the file name if not specified.\n"
" -version\n"
" Display the version of lupdate and exit.\n"
).arg(m_defaultExtensions));
diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp
index d81f3e8..989279f 100644
--- a/tools/linguist/shared/xliff.cpp
+++ b/tools/linguist/shared/xliff.cpp
@@ -500,7 +500,9 @@ bool XLIFFHandler::startElement(const QString& namespaceURI,
} else if (localName == QLatin1String("file")) {
m_fileName = atts.value(QLatin1String("original"));
m_language = atts.value(QLatin1String("target-language"));
+ m_language.replace(QLatin1Char('-'), QLatin1Char('_'));
m_sourceLanguage = atts.value(QLatin1String("source-language"));
+ m_sourceLanguage.replace(QLatin1Char('-'), QLatin1Char('_'));
} else if (localName == QLatin1String("group")) {
if (atts.value(QLatin1String("restype")) == QLatin1String(restypeContext)) {
m_context = atts.value(QLatin1String("resname"));
@@ -773,14 +775,19 @@ bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd)
<< "\" xmlns:trolltech=\"" << TrollTsNamespaceURI << "\">\n";
++indent;
writeExtras(ts, indent, translator.extras(), drops);
+ QString sourceLanguageCode = translator.sourceLanguageCode();
+ if (sourceLanguageCode.isEmpty() || sourceLanguageCode == QLatin1String("C"))
+ sourceLanguageCode = QLatin1String("en");
+ else
+ sourceLanguageCode.replace(QLatin1Char('_'), QLatin1Char('-'));
+ QString languageCode = translator.languageCode();
+ languageCode.replace(QLatin1Char('_'), QLatin1Char('-'));
foreach (const QString &fn, fileOrder) {
writeIndent(ts, indent);
ts << "<file original=\"" << fn << "\""
<< " datatype=\"" << dataType(messageOrder[fn].begin()->first()) << "\""
- << " source-language=\""
- << (translator.sourceLanguageCode().isEmpty() ?
- QByteArray("en") : translator.sourceLanguageCode().toLatin1()) << "\""
- << " target-language=\"" << translator.languageCode() << "\""
+ << " source-language=\"" << sourceLanguageCode.toLatin1() << "\""
+ << " target-language=\"" << languageCode.toLatin1() << "\""
<< "><body>\n";
++indent;