Mercurial > minori
diff src/gui/locale.cc @ 295:b82841e76e79
*: better support on Windows
things now look much better in dark mode
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 12 May 2024 20:24:09 -0400 |
parents | 862d0d8619f6 |
children | b1f625b0227c |
line wrap: on
line diff
--- a/src/gui/locale.cc Sun May 12 18:16:08 2024 -0400 +++ b/src/gui/locale.cc Sun May 12 20:24:09 2024 -0400 @@ -7,16 +7,20 @@ #include <QString> #include <QTranslator> -#include <QDebug> - -#include <iostream> +#include <QtGlobal> namespace Locale { std::string GetLocaleFullName(const QLocale& locale) { QString res = QLocale::languageToString(locale.language()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + /* silence deprecation warning for locale.country() */ + if (locale.territory() != QLocale::AnyTerritory) + res += " (" + QLocale::territoryToString(locale.territory()) + ")"; +#else if (locale.country() != QLocale::AnyCountry) res += " (" + QLocale::countryToString(locale.country()) + ")"; +#endif return Strings::ToUtf8String(res); } @@ -82,7 +86,7 @@ const QString path = qApp->applicationDirPath(); if (!SwitchTranslator(_translator_qt, path + QString("/translations/qt_%1.qm").arg(name))) { /* Sometimes Qt will have proper translations for the language, but not the specific - country. In that case, we still want to use that language. */ + * country. In that case, we still want to use that language. */ const int underscore_index = name.lastIndexOf("_"); if (!underscore_index) return false;