mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 22:58:15 +00:00
feat(app/App): better translations support
This commit is contained in:
parent
46a1bf4fff
commit
e689cb46a5
1 changed files with 8 additions and 7 deletions
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue