| 178 | } |
| 179 | |
| 180 | void PreferencesDialog::populateTranslationComboBox() |
| 181 | { |
| 182 | NotepadNextApplication *app = qobject_cast<NotepadNextApplication *>(qApp); |
| 183 | |
| 184 | // Add the system default at the top |
| 185 | ui->comboBoxTranslation->addItem(tr("<System Default>"), QStringLiteral("")); |
| 186 | |
| 187 | // TODO: sort this list and keep the system default at the top |
| 188 | for (const auto &localeName : app->getTranslationManager()->availableTranslations()) |
| 189 | { |
| 190 | QLocale locale(localeName); |
| 191 | const QString localeDisplay = TranslationManager::FormatLocaleTerritoryAndLanguage(locale); |
| 192 | ui->comboBoxTranslation->addItem(localeDisplay, localeName); |
| 193 | } |
| 194 | |
| 195 | // Select the current one |
| 196 | int index = ui->comboBoxTranslation->findData(settings->translation()); |
| 197 | if (index != -1) { |
| 198 | ui->comboBoxTranslation->setCurrentIndex(index); |
| 199 | } |
| 200 | } |
nothing calls this directly
no test coverage detected