Try the application's directory as well
This commit is contained in:
parent
111c019edd
commit
5e503cbe64
24
src/main.cpp
24
src/main.cpp
@ -15,6 +15,12 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
void LoadTranslation(const QString& prefix, const QString& path) {
|
||||||
|
QTranslator* t = new QTranslator;
|
||||||
|
t->load(prefix + "_" + QLocale::system().name(), path);
|
||||||
|
QCoreApplication::installTranslator(t);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QCoreApplication::setApplicationName("Clementine");
|
QCoreApplication::setApplicationName("Clementine");
|
||||||
QCoreApplication::setApplicationVersion("0.1");
|
QCoreApplication::setApplicationVersion("0.1");
|
||||||
@ -41,20 +47,10 @@ int main(int argc, char *argv[]) {
|
|||||||
Q_INIT_RESOURCE(translations);
|
Q_INIT_RESOURCE(translations);
|
||||||
|
|
||||||
// Translations
|
// Translations
|
||||||
QTranslator qt_translator;
|
LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
qt_translator.load("qt_" + QLocale::system().name(),
|
LoadTranslation("clementine", ":/translations");
|
||||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
LoadTranslation("clementine", a.applicationDirPath());
|
||||||
a.installTranslator(&qt_translator);
|
LoadTranslation("clementine", QDir::currentPath());
|
||||||
|
|
||||||
QTranslator clementine_translator;
|
|
||||||
clementine_translator.load("clementine_" + QLocale::system().name(), ":/translations");
|
|
||||||
a.installTranslator(&clementine_translator);
|
|
||||||
|
|
||||||
// Also look for translations in the current directory so translators don't
|
|
||||||
// need to recompile Clementine to test their translations
|
|
||||||
QTranslator pwd_translator;
|
|
||||||
clementine_translator.load("clementine_" + QLocale::system().name(), QDir::currentPath());
|
|
||||||
a.installTranslator(&clementine_translator);
|
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user