English: "[18:23] *** Channel modes: no messages from outside, topic protection" German: "[20:15] *** Kanalmodi: no messages from outside, topic protection" As can be seen, the mode descriptions aren't translated in the view. This is despite the messages having been extracted into the gettext templates and translated by the translator, and applies to all languages. I.e. the i18n() calls in the method building up the mode description hash table in common.cpp are ineffective.
commit c46b1b0e94c19a9df5f044ad65645034c17358f0 Author: Travis McHenry <wordsizzle@gmail.com> Date: Mon Mar 1 20:46:02 2010 -0700 Fix the translations for the channel modes Previously the channel modes were loaded into the hash at runtime. Now, we load it when it's needed, coincidentally after KInstance has been started, so the i18n() calls now work. BUG:226377 diff --git a/src/common.cpp b/src/common.cpp index 87aac43..f8e740c 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -31,7 +31,7 @@ namespace Konversation "([-.\\d\\w]+@[-.\\d\\w]{2,}\\.[\\w]{2,})"); static QRegExp tdlPattern("(.*)\\.(\\w+),$"); - QHash<QChar,QString> initChanModesHash() + void initChanModesHash() { QHash<QChar,QString> myHash; @@ -47,14 +47,15 @@ namespace Konversation myHash.insert('c', i18n("no colors allowed")); myHash.insert('l', i18n("user throttling")); - return myHash; + m_modesHash = myHash; } - const QHash<QChar,QString> ChanModes::m_hash = initChanModesHash(); - QHash<QChar,QString> getChannelModesHash() { - return ChanModes::m_hash; + if(m_modesHash.isEmpty()) + initChanModesHash(); + + return m_modesHash; } QString removeIrcMarkup(const QString& text) diff --git a/src/common.h b/src/common.h index c0b56ca..c30c9ab 100644 --- a/src/common.h +++ b/src/common.h @@ -49,11 +49,6 @@ namespace Konversation CreateNewConnection }; - struct ChanModes - { - static const QHash<QChar,QString> m_hash; - }; - struct TextUrlData { QList<QPair<int, int> > urlRanges; @@ -74,6 +69,7 @@ namespace Konversation bool isUtf8(const QByteArray& text); uint colorForNick(const QString& nickname); + static QHash<QChar,QString> m_modesHash; QHash<QChar,QString> getChannelModesHash(); QString sterilizeUnicode(const QString& s);