mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Android build: prepare and copy translations into the APK
And then load them at runtime. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
80fcd710ee
commit
e47327c87a
2 changed files with 15 additions and 2 deletions
|
|
@ -41,13 +41,20 @@ void init_qt_late()
|
||||||
// on Linux this tends to be en-US, but on the Mac it's just en
|
// on Linux this tends to be en-US, but on the Mac it's just en
|
||||||
if (!uiLang.startsWith("en") || uiLang.startsWith("en-GB")) {
|
if (!uiLang.startsWith("en") || uiLang.startsWith("en-GB")) {
|
||||||
qtTranslator = new QTranslator;
|
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);
|
application->installTranslator(qtTranslator);
|
||||||
} else {
|
} 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;
|
ssrfTranslator = new QTranslator;
|
||||||
if (ssrfTranslator->load(loc, "subsurface", "_") ||
|
if (ssrfTranslator->load(loc, "subsurface", "_") ||
|
||||||
|
ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
|
||||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
|
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
|
||||||
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
|
ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
|
||||||
application->installTranslator(ssrfTranslator);
|
application->installTranslator(ssrfTranslator);
|
||||||
|
|
|
||||||
|
|
@ -367,6 +367,12 @@ rm -rf android-mobile
|
||||||
cp -a $SUBSURFACE_SOURCE/android-mobile .
|
cp -a $SUBSURFACE_SOURCE/android-mobile .
|
||||||
sed -i -e "s/@SUBSURFACE_MOBILE_VERSION@/\"$SUBSURFACE_MOBILE_VERSION\"/;s/@BUILD_NR@/$BUILD_NR/" android-mobile/AndroidManifest.xml
|
sed -i -e "s/@SUBSURFACE_MOBILE_VERSION@/\"$SUBSURFACE_MOBILE_VERSION\"/;s/@BUILD_NR@/$BUILD_NR/" android-mobile/AndroidManifest.xml
|
||||||
|
|
||||||
|
# now make the translations
|
||||||
|
make translations
|
||||||
|
mkdir -p assets/translations
|
||||||
|
cp -a translations/*.qm assets/translations
|
||||||
|
cp -a ${QT5_ANDROID}/android_${QT_ARCH}/translations/*.qm assets/translations
|
||||||
|
|
||||||
# now build Subsurface and use the rest of the command line arguments
|
# now build Subsurface and use the rest of the command line arguments
|
||||||
make $@
|
make $@
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue