summaryrefslogtreecommitdiffstats
path: root/tools/linguist/shared
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-20 15:35:41 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-20 15:48:25 (GMT)
commit68595bbc28ba0d1cd78557c61011dc004a4a507c (patch)
tree6c9c963f8e9d405fd18e399f8d5bff6c8f89293e /tools/linguist/shared
parentae653c8ff92c23c3f9ebbdb753a1e0edea95be7e (diff)
downloadQt-68595bbc28ba0d1cd78557c61011dc004a4a507c.zip
Qt-68595bbc28ba0d1cd78557c61011dc004a4a507c.tar.gz
Qt-68595bbc28ba0d1cd78557c61011dc004a4a507c.tar.bz2
fix encodings, take N
Task-number: QTBUG-4499 Task-number: QTBUG-5276
Diffstat (limited to 'tools/linguist/shared')
-rw-r--r--tools/linguist/shared/translator.cpp11
-rw-r--r--tools/linguist/shared/translator.h5
2 files changed, 11 insertions, 5 deletions
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 05fc6e5..8a071d3 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -67,7 +67,7 @@ QString QObject::tr(const char *sourceText, const char *, int n)
#endif
Translator::Translator() :
- m_codecName("ISO-8859-1"),
+ m_codec(QTextCodec::codecForName("ISO-8859-1")),
m_locationsType(AbsoluteLocations)
{
}
@@ -713,12 +713,17 @@ void Translator::setCodecName(const QByteArray &name)
if (!codec) {
if (!name.isEmpty())
qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData());
- m_codecName = "ISO-8859-1";
+ m_codec = QTextCodec::codecForName("ISO-8859-1");
} else {
- m_codecName = codec->name();
+ 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/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index e36f822..353cf9d 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -151,7 +151,8 @@ public:
void reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose);
void setCodecName(const QByteArray &name);
- QByteArray codecName() const { return m_codecName; }
+ QByteArray codecName() const;
+ QTextCodec *codec() const { return m_codec; }
QString languageCode() const { return m_language; }
QString sourceLanguageCode() const { return m_sourceLanguage; }
@@ -211,7 +212,7 @@ private:
typedef QList<TranslatorMessage> TMM; // int stores the sequence position.
TMM m_messages;
- QByteArray m_codecName;
+ QTextCodec *m_codec;
LocationsType m_locationsType;
// A string beginning with a 2 or 3 letter language code (ISO 639-1