summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/utils.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-06-19 14:29:32 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-06-30 08:47:39 +0000
commit360a8c20aa1c1c6980a033956ff79bac54d246e5 (patch)
tree3d8648c632230685915ab329d280973323023321 /src/libs/installer/utils.cpp
parent0f114d791574e6cd6fa17b65d34f97e5a670d854 (diff)
Unify handling of translations
Mimic the logic implemented in installerbase/QTranslator::load() by - using QLocale().uiLanguages() - splitting up the locales into candidates (first en-US, then en ...) - implicitly assuming the default is English Task-number: QTIFW-390 Change-Id: I294288d5fc739ebf12c93a0e1a43d613b3834721 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/utils.cpp')
-rw-r--r--src/libs/installer/utils.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libs/installer/utils.cpp b/src/libs/installer/utils.cpp
index eccd1602d..199c544ed 100644
--- a/src/libs/installer/utils.cpp
+++ b/src/libs/installer/utils.cpp
@@ -114,6 +114,23 @@ bool QInstaller::startDetached(const QString &program, const QStringList &argume
return success;
}
+// Returns ["en-us", "en"] for "en-us"
+QStringList QInstaller::localeCandidates(const QString &locale_)
+{
+ QStringList candidates;
+ QString locale = locale_;
+ candidates.reserve(locale.count(QLatin1Char('-')));
+ forever {
+ candidates.append(locale);
+ int r = locale.lastIndexOf(QLatin1Char('-'));
+ if (r <= 0)
+ break;
+ locale.truncate(r);
+ }
+ return candidates;
+}
+
+
static bool verb = false;
void QInstaller::setVerbose(bool v)
@@ -400,3 +417,5 @@ QString QInstaller::windowsErrorString(int errorCode)
}
#endif
+
+