Adding ability to switch language files at runtime to resolve #2743
* Removing .qm files from Windows build as they are inbuilt as of a7adfe251
* Moving translation change code to the OpenRGBSettingsPage
* Adding a changeEvent() to applicable Widgets to facilitate language updates
* Workaround added to TabLabel to accomodate translation context origin
* Added zh_TW locale to OpenRGB.pro
* Updated all translations to include the latest untranslated strings
This commit is contained in:
parent
530d667328
commit
2e02f1d782
86 changed files with 6249 additions and 5299 deletions
|
|
@ -1,16 +1,34 @@
|
|||
#include "TabLabel.h"
|
||||
#include <QFontMetrics>
|
||||
|
||||
Ui::TabLabel::TabLabel(QString icon, QString name) :
|
||||
Ui::TabLabel::TabLabel(QString icon, QString name, char* original, char* context) :
|
||||
QWidget(nullptr),
|
||||
ui(new Ui::TabLabelUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->icon->setText("<img src=':/" + icon + "' height='16' width='16' />");
|
||||
ui->name->setText(name);
|
||||
label = original;
|
||||
ctxt = context;
|
||||
}
|
||||
|
||||
Ui::TabLabel::~TabLabel()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Ui::TabLabel::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Storing the base string in label |
|
||||
| enables switching between multiple languages |
|
||||
| The context needs to be stored as the translation |
|
||||
| file requires the originating context |
|
||||
\*-----------------------------------------------------*/
|
||||
QApplication* app = static_cast<QApplication *>(QApplication::instance());
|
||||
|
||||
ui->name->setText(app->translate(ctxt, label));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue