summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-09-30 15:48:52 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-09-30 15:48:52 (GMT)
commit2e16dff13d260e8ba07534b36ac635c9e625e442 (patch)
tree31f43e71ce3bb3bdb372f23850b64e5a5afa72c6 /tools/linguist
parent12eae101aa19fd7a4c7862188c16134ca51f3fd4 (diff)
parent3b8c67a07acd049035ac67c6ff981939f357473c (diff)
downloadQt-2e16dff13d260e8ba07534b36ac635c9e625e442.zip
Qt-2e16dff13d260e8ba07534b36ac635c9e625e442.tar.gz
Qt-2e16dff13d260e8ba07534b36ac635c9e625e442.tar.bz2
Merge branch '4.5' into 4.6
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/shared/xliff.cpp15
1 files changed, 11 insertions, 4 deletions
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;