summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@nokia.com>2009-09-30 15:03:59 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-09-30 15:11:03 (GMT)
commit3b8c67a07acd049035ac67c6ff981939f357473c (patch)
tree94ef785d80ae8f3cdfa123ec32cac46690ef4aad /tools
parent343eb73edaa4a05860bf8749a2ff70359f45eb78 (diff)
downloadQt-3b8c67a07acd049035ac67c6ff981939f357473c.zip
Qt-3b8c67a07acd049035ac67c6ff981939f357473c.tar.gz
Qt-3b8c67a07acd049035ac67c6ff981939f357473c.tar.bz2
Fix locale encoding in XLIFF files
xlf uses xx-YY notation instead of xx_YY Reviewed-by: ossi
Diffstat (limited to 'tools')
-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 b0c7546..696c930 100644
--- a/tools/linguist/shared/xliff.cpp
+++ b/tools/linguist/shared/xliff.cpp
@@ -498,7 +498,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"));
@@ -768,14 +770,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;