Skip to content

Commit f117f3f

Browse files
committed
Merge #838: qt6: Handle deprecated QLocale::nativeCountryName
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
2 parents 772928a + 9123a28 commit f117f3f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/qt/optionsdialog.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,15 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
166166
/** check if the locale name consists of 2 parts (language_country) */
167167
if(langStr.contains("_"))
168168
{
169-
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
170-
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
169+
/** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
170+
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") +
171+
#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
172+
locale.nativeTerritoryName() +
173+
#else
174+
locale.nativeCountryName() +
175+
#endif
176+
QString(" (") + langStr + QString(")"), QVariant(langStr));
177+
171178
}
172179
else
173180
{

0 commit comments

Comments
 (0)