Commit e689cb46 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app/App): better translations support

parent 46a1bf4f
......@@ -27,20 +27,21 @@
App *App::m_instance = nullptr;
App::App (int &argc, char **argv) : QApplication(argc, argv) {
QString current_locale = QLocale::system().name();
if (m_english_translator.load(LANGUAGES_PATH "en"))
if (m_english_translator.load(QLocale(QLocale::English), LANGUAGES_PATH))
installTranslator(&m_english_translator);
else
qWarning("Unable to install english translator.");
// Try to use default locale.
if (m_default_translator.load(QString(LANGUAGES_PATH) + current_locale)) {
QLocale current_locale = QLocale::system();
if (m_default_translator.load(current_locale, LANGUAGES_PATH)) {
installTranslator(&m_default_translator);
m_locale = current_locale;
} else
m_locale = current_locale.name();
} else {
qWarning() << QStringLiteral("Unable to found translations for locale: %1.")
.arg(current_locale);
.arg(current_locale.name());
}
setWindowIcon(QIcon(WINDOW_ICON_PATH));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment