Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make it possible to load translations for multiple libraries

Closes #508
  • Loading branch information...
commit ffefa90763df6efe67602f72e9060ab1788c898a 1 parent 4c440df
@amoskvin amoskvin authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 libraries/razorqt/libtranslate.h
View
9 libraries/razorqt/libtranslate.h
@@ -31,19 +31,22 @@
#include <QtCore/QTranslator>
#include <QtCore/QCoreApplication>
#include <QtCore/QLocale>
+#include <QtCore/QSet>
inline void libTranslate(const QString &name)
{
- static bool alreadyLoaded = false;
- if (alreadyLoaded)
+ static QSet<QString> loadedLibs;
+
+ if (loadedLibs.contains(name))
return;
+ loadedLibs.insert(name);
+
QString locale = QLocale::system().name();
QTranslator *translator = new QTranslator(qApp);
translator->load(QString("%1/%2_%3.qm").arg(TRANSLATIONS_DIR, name, locale));
QCoreApplication::installTranslator(translator);
- alreadyLoaded = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.