Sfoglia il codice sorgente

Merge pull request #8449 from Docteh/translate_placeholder

retranslate the game list placeholder
Mai M 4 anni fa
parent
commit
d796341d33
2 ha cambiato i file con 16 aggiunte e 1 eliminazioni
  1. 13 1
      src/yuzu/game_list.cpp
  2. 3 0
      src/yuzu/game_list.h

+ 13 - 1
src/yuzu/game_list.cpp

@@ -870,7 +870,7 @@ GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent}
     layout->setAlignment(Qt::AlignCenter);
     image->setPixmap(QIcon::fromTheme(QStringLiteral("plus_folder")).pixmap(200));
 
-    text->setText(tr("Double-click to add a new folder to the game list"));
+    RetranslateUI();
     QFont font = text->font();
     font.setPointSize(20);
     text->setFont(font);
@@ -891,3 +891,15 @@ void GameListPlaceholder::onUpdateThemedIcons() {
 void GameListPlaceholder::mouseDoubleClickEvent(QMouseEvent* event) {
     emit GameListPlaceholder::AddDirectory();
 }
+
+void GameListPlaceholder::changeEvent(QEvent* event) {
+    if (event->type() == QEvent::LanguageChange) {
+        RetranslateUI();
+    }
+
+    QWidget::changeEvent(event);
+}
+
+void GameListPlaceholder::RetranslateUI() {
+    text->setText(tr("Double-click to add a new folder to the game list"));
+}

+ 3 - 0
src/yuzu/game_list.h

@@ -166,6 +166,9 @@ protected:
     void mouseDoubleClickEvent(QMouseEvent* event) override;
 
 private:
+    void changeEvent(QEvent* event) override;
+    void RetranslateUI();
+
     QVBoxLayout* layout = nullptr;
     QLabel* image = nullptr;
     QLabel* text = nullptr;