Skip to content

Commit

Permalink
Merge #838: qt6: Handle deprecated QLocale::nativeCountryName
Browse files Browse the repository at this point in the history
9123a28 qt6: Handle deprecated `QLocale::nativeCountryName` (Hennadii Stepanov)

Pull request description:

  Split from bitcoin/bitcoin#30997.

  [`QLocale::nativeCountryName()`](https://doc.qt.io/qt-6/qlocale-obsolete.html#nativeCountryName) has been deprecated since Qt 6.6.

  [`QLocale::nativeTerritoryName()`](https://doc.qt.io/qt-6/qlocale.html#nativeTerritoryName) was introduced in Qt 6.2.

  This PR ensures compatibility across all supported Qt versions.

  No behaviour change for the current codebase, which uses Qt 5.

  ---

  This PR can be tested on macOS using the first commit from bitcoin/bitcoin#30997 and Homebrew's `qt` package.

ACKs for top commit:
  promag:
    Code review ACK 9123a28.
  jarolrod:
    ACK 9123a28

Tree-SHA512: 937258ab90f41077b0c9b1489e05104e3558b5da522b9dcd07fe373826aa671b2388539425f38c43fcde22419cdb8694cdcb04574d92b773acdb80f9a4fb1c02
  • Loading branch information
hebasto committed Oct 3, 2024
2 parents 772928a + 9123a28 commit f117f3f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,15 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
/** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") +
#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
locale.nativeTerritoryName() +
#else
locale.nativeCountryName() +
#endif
QString(" (") + langStr + QString(")"), QVariant(langStr));

}
else
{
Expand Down

0 comments on commit f117f3f

Please sign in to comment.