summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-05-03 17:20:53 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-05-03 17:20:53 -0700
commite47327c87a1b456852e8594eedc2882a7e1c9bb4 (patch)
tree4b47bbe3b89e605cdf85fb139c40ee215a7b5bea /core
parent80fcd710eef489cd2c7038e53400bdc30a1f6ca1 (diff)
downloadsubsurface-e47327c87a1b456852e8594eedc2882a7e1c9bb4.tar.gz
Android build: prepare and copy translations into the APK
And then load them at runtime. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/qt-init.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/qt-init.cpp b/core/qt-init.cpp
index 3dffc6f31..3d07899ce 100644
--- a/core/qt-init.cpp
+++ b/core/qt-init.cpp
@@ -41,13 +41,20 @@ void init_qt_late()
// on Linux this tends to be en-US, but on the Mac it's just en
if (!uiLang.startsWith("en") || uiLang.startsWith("en-GB")) {
qtTranslator = new QTranslator;
- if (qtTranslator->load(loc, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
+ QString translationLocation;
+#ifdef Q_OS_ANDROID
+ translationLocation = QLatin1Literal("assets:/translations");
+#else
+ translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+#endif
+ if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
application->installTranslator(qtTranslator);
} else {
- qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
}
ssrfTranslator = new QTranslator;
if (ssrfTranslator->load(loc, "subsurface", "_") ||
+ ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
application->installTranslator(ssrfTranslator);