Remove unneeded workaround for dash separated language strings
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 4 Nov 2024 07:17:20 +0000 (16:17 +0900)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 22 Nov 2024 10:14:38 +0000 (11:14 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/application.cpp

index ebcaa25fc0aa82dd5516db757a5dd7b247323a8d..3510bbb8601fc183da065eb5dba1fcca5e8840e3 100644 (file)
@@ -967,10 +967,8 @@ QString substLang(const QString &lang)
 
 void Application::setupTranslations()
 {
-    QStringList uiLanguages;
-    uiLanguages = QLocale::system().uiLanguages();
-
-    QString enforcedLocale = Theme::instance()->enforcedLocale();
+    auto uiLanguages = QLocale::system().uiLanguages(QLocale::TagSeparator::Underscore);
+    const auto enforcedLocale = Theme::instance()->enforcedLocale();
     if (!enforcedLocale.isEmpty()) {
         uiLanguages.prepend(enforcedLocale);
     }
@@ -979,8 +977,7 @@ void Application::setupTranslations()
     auto *qtTranslator = new QTranslator(this);
     auto *qtkeychainTranslator = new QTranslator(this);
 
-    for (QString lang : qAsConst(uiLanguages)) {
-        lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973
+    for (auto &lang : qAsConst(uiLanguages)) {
         lang = substLang(lang);
         const auto trPath = applicationTrPath();
         const auto trFolder = QDir{trPath};