diff options
author | Lioncash <mathew1800@gmail.com> | 2021-06-09 01:32:12 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2021-06-09 01:33:23 +0200 |
commit | b3eb08254b83eb10e116564a891acd8bb8b7c776 (patch) | |
tree | d169037ae2146096d0648f76f3286b68fc5a4819 /src/yuzu | |
parent | Merge pull request #6426 from lat9nq/context-menu-start (diff) | |
download | yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar.gz yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar.bz2 yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar.lz yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar.xz yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.tar.zst yuzu-b3eb08254b83eb10e116564a891acd8bb8b7c776.zip |
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/configuration/configure_ui.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 0a28c87c0..9674119e1 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -17,17 +17,30 @@ namespace { constexpr std::array default_icon_sizes{ - std::make_pair(0, QT_TR_NOOP("None")), - std::make_pair(32, QT_TR_NOOP("Small (32x32)")), - std::make_pair(64, QT_TR_NOOP("Standard (64x64)")), - std::make_pair(128, QT_TR_NOOP("Large (128x128)")), - std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")), + std::make_pair(0, QT_TRANSLATE_NOOP("ConfigureUI", "None")), + std::make_pair(32, QT_TRANSLATE_NOOP("ConfigureUI", "Small (32x32)")), + std::make_pair(64, QT_TRANSLATE_NOOP("ConfigureUI", "Standard (64x64)")), + std::make_pair(128, QT_TRANSLATE_NOOP("ConfigureUI", "Large (128x128)")), + std::make_pair(256, QT_TRANSLATE_NOOP("ConfigureUI", "Full Size (256x256)")), }; +// clang-format off constexpr std::array row_text_names{ - QT_TR_NOOP("Filename"), QT_TR_NOOP("Filetype"), QT_TR_NOOP("Title ID"), - QT_TR_NOOP("Title Name"), QT_TR_NOOP("None"), + QT_TRANSLATE_NOOP("ConfigureUI", "Filename"), + QT_TRANSLATE_NOOP("ConfigureUI", "Filetype"), + QT_TRANSLATE_NOOP("ConfigureUI", "Title ID"), + QT_TRANSLATE_NOOP("ConfigureUI", "Title Name"), + QT_TRANSLATE_NOOP("ConfigureUI", "None"), }; +// clang-format on + +QString GetTranslatedIconSize(size_t index) { + return QCoreApplication::translate("ConfigureUI", default_icon_sizes[index].second); +} + +QString GetTranslatedRowTextName(size_t index) { + return QCoreApplication::translate("ConfigureUI", row_text_names[index]); +} } // Anonymous namespace ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { @@ -121,11 +134,11 @@ void ConfigureUi::RetranslateUI() { ui->retranslateUi(this); for (int i = 0; i < ui->icon_size_combobox->count(); i++) { - ui->icon_size_combobox->setItemText(i, tr(default_icon_sizes[i].second)); + ui->icon_size_combobox->setItemText(i, GetTranslatedIconSize(static_cast<size_t>(i))); } for (int i = 0; i < ui->row_1_text_combobox->count(); i++) { - const QString name = tr(row_text_names[i]); + const QString name = GetTranslatedRowTextName(static_cast<size_t>(i)); ui->row_1_text_combobox->setItemText(i, name); ui->row_2_text_combobox->setItemText(i, name); @@ -152,8 +165,9 @@ void ConfigureUi::InitializeLanguageComboBox() { } void ConfigureUi::InitializeIconSizeComboBox() { - for (const auto& size : default_icon_sizes) { - ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first); + for (size_t i = 0; i < default_icon_sizes.size(); i++) { + const auto size = default_icon_sizes[i].first; + ui->icon_size_combobox->addItem(GetTranslatedIconSize(i), size); } } @@ -170,7 +184,7 @@ void ConfigureUi::UpdateFirstRowComboBox(bool init) { ui->row_1_text_combobox->clear(); for (std::size_t i = 0; i < row_text_names.size(); i++) { - const QString row_text_name = QString::fromUtf8(row_text_names[i]); + const QString row_text_name = GetTranslatedRowTextName(i); ui->row_1_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); } @@ -189,7 +203,7 @@ void ConfigureUi::UpdateSecondRowComboBox(bool init) { ui->row_2_text_combobox->clear(); for (std::size_t i = 0; i < row_text_names.size(); ++i) { - const QString row_text_name = QString::fromUtf8(row_text_names[i]); + const QString row_text_name = GetTranslatedRowTextName(i); ui->row_2_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); } |