Skip to content

Commit

Permalink
Warn that translation changes require restart in new language
Browse files Browse the repository at this point in the history
  • Loading branch information
scribblemaniac committed Apr 28, 2024
1 parent d904335 commit 488c609
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/src/generalpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GNU General Public License for more details.

#include <QMessageBox>
#include <QSettings>
#include <QTranslator>

#include "pencildef.h"
#include "preferencemanager.h"
Expand Down Expand Up @@ -197,9 +198,19 @@ void GeneralPage::languageChanged(int i)
QString strLocale = ui->languageCombo->itemData(i).toString();
mManager->set(SETTING::LANGUAGE, strLocale);

QMessageBox::warning(this,
tr("Restart Required"),
tr("The language change will take effect after a restart of Pencil2D"));
QLocale locale = strLocale.isEmpty() ? QLocale::system() : QLocale(strLocale);
std::unique_ptr<QTranslator> newlangTr(new QTranslator(this));
if (newlangTr->load(locale, "pencil", "_", ":/i18n/"))
{
QMessageBox::warning(this,
newlangTr->translate(staticMetaObject.className(), "Restart Required"),
newlangTr->translate(staticMetaObject.className(), "The language change will take effect after a restart of Pencil2D"));
} else {
Q_ASSERT(false);
QMessageBox::warning(this,
tr("Restart Required"),
tr("The language change will take effect after a restart of Pencil2D"));
}
}

void GeneralPage::backgroundChanged(QAbstractButton* button)
Expand Down

0 comments on commit 488c609

Please sign in to comment.