Android: Make sure Qm translations get loaded
ClosedPublic

Authored by apol on Aug 1 2018, 12:48 AM.

Details

Summary

Use a similar strategy as D14528 to find qm files.

Test Plan

Analitza parts of KAlgebra are translated too.

Diff Detail

Repository
R240 Extra CMake Modules
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Aug 1 2018, 12:48 AM
Restricted Application added projects: Frameworks, Build System. · View Herald TranscriptAug 1 2018, 12:48 AM
Restricted Application added subscribers: kde-buildsystem, kde-frameworks-devel. · View Herald Transcript
apol requested review of this revision.Aug 1 2018, 12:48 AM
aacid added a subscriber: aacid.Aug 1 2018, 11:03 PM

Is there a way we can get /../qt-reserved-files/share/ in a more natural way? fishing up to .. feels always like it'll break

apol added a comment.Aug 2 2018, 1:22 AM

I don't really see how, with the information we have provided today.

Here I printed the env variables and QStandardPath values at boot.

stdpaths 0 QStandardPaths::StandardLocation(DesktopLocation) ("/data/user/0/org.kde.kalgebramobile/files")
stdpaths 1 QStandardPaths::StandardLocation(DocumentsLocation) ("/storage/emulated/0/Documents", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Documents")
stdpaths 2 QStandardPaths::StandardLocation(FontsLocation) ("/system/fonts")
stdpaths 3 QStandardPaths::StandardLocation(ApplicationsLocation) ("")
stdpaths 4 QStandardPaths::StandardLocation(MusicLocation) ("/storage/emulated/0/Music", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Music", "/storage/emulated/0/Podcasts", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Podcasts", "/storage/emulated/0/Notifications", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Notifications", "/storage/emulated/0/Alarms", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Alarms")
stdpaths 5 QStandardPaths::StandardLocation(MoviesLocation) ("/storage/emulated/0/Movies", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Movies")
stdpaths 6 QStandardPaths::StandardLocation(PicturesLocation) ("/storage/emulated/0/Pictures", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Pictures")
stdpaths 7 QStandardPaths::StandardLocation(TempLocation) ("/data/user/0/org.kde.kalgebramobile/cache")
stdpaths 8 QStandardPaths::StandardLocation(HomeLocation) ("/data/user/0/org.kde.kalgebramobile/files")
stdpaths 9 QStandardPaths::StandardLocation(DataLocation) ("/data/user/0/org.kde.kalgebramobile/files", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files")
stdpaths 10 QStandardPaths::StandardLocation(CacheLocation) ("/data/user/0/org.kde.kalgebramobile/cache", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/cache")
stdpaths 11 QStandardPaths::StandardLocation(GenericDataLocation) ("/storage/emulated/0")
stdpaths 12 QStandardPaths::StandardLocation(RuntimeLocation) ("/data/user/0/org.kde.kalgebramobile/cache")
stdpaths 13 QStandardPaths::StandardLocation(ConfigLocation) ("/data/user/0/org.kde.kalgebramobile/files/settings")
stdpaths 14 QStandardPaths::StandardLocation(DownloadLocation) ("/storage/emulated/0/Download", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files/Download")
stdpaths 15 QStandardPaths::StandardLocation(GenericCacheLocation) ("/data/user/0/org.kde.kalgebramobile/cache")
stdpaths 16 QStandardPaths::StandardLocation(GenericConfigLocation) ("/data/user/0/org.kde.kalgebramobile/files/settings")
stdpaths 17 QStandardPaths::StandardLocation(AppDataLocation) ("/data/user/0/org.kde.kalgebramobile/files", "/storage/emulated/0/Android/data/org.kde.kalgebramobile/files")
env "PATH=/sbin:/system/sbin:/system/bin:/system/xbin:/vendor/bin:/vendor/xbin"
env "DOWNLOAD_CACHE=/data/cache"
env "ANDROID_BOOTLOGO=1"
env "ANDROID_ROOT=/system"
env "ANDROID_ASSETS=/system/app"
env "ANDROID_DATA=/data"
env "ANDROID_STORAGE=/storage"
env "EXTERNAL_STORAGE=/sdcard"
env "ASEC_MOUNTPOINT=/mnt/asec"
env "BOOTCLASSPATH=/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/bouncycastle.jar:/system/framework/apache-xml.jar:/system/framework/legacy-test.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/org.apache.http.legacy.boot.jar:/system/framework/android.hidl.base-V1.0-java.jar:/system/framework/android.hidl.manager-V1.0-java.jar"
env "SYSTEMSERVERCLASSPATH=/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar"
env "ANDROID_SOCKET_zygote_secondary=9"
env "QT_ANDROID_FONTS_MONOSPACE=Droid Sans Mono;Droid Sans;Droid Sans Fallback"
env "QT_ANDROID_FONTS_SERIF=Droid Serif"
env "NECESSITAS_API_LEVEL=2"
env "HOME=/data/user/0/org.kde.kalgebramobile/files"
env "TMPDIR=/data/user/0/org.kde.kalgebramobile/files"
env "QT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback"
env "QT_ANDROID_APP_ICON_SIZE=168"
env "QT_USE_ANDROID_NATIVE_DIALOGS=1"
env "QT_ANDROID_THEME=Theme_Holo_Light/"
env "QT_ANDROID_THEME_DISPLAY_DPI=560"
env "QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED=1"
env "QT_USE_ANDROID_NATIVE_STYLE=1"
env "MINISTRO_ANDROID_STYLE_PATH=/data/user/0/org.kde.kalgebramobile/qt-reserved-files/android-style/560/"
env "QT_ANDROID_THEMES_ROOT_PATH=/data/user/0/org.kde.kalgebramobile/qt-reserved-files/android-style/"
env "QML2_IMPORT_PATH=/data/data/org.kde.kalgebramobile/qt-reserved-files//qml"
env "QML_IMPORT_PATH=/data/data/org.kde.kalgebramobile/qt-reserved-files//imports"
env "QT_PLUGIN_PATH=/data/data/org.kde.kalgebramobile/qt-reserved-files//plugins"
env "QT_QUICK_CONTROLS_STYLE=Material"
env "LANGUAGE="

We could possibly use $QT_PLUGIN_PATH/../locale but it's not better.

We could patch Qt, but we'd need to wait until Qt 5.12 to have it translated.

aacid added a comment.Aug 2 2018, 11:03 PM

Ok, second option, we are actually installing these files ourselves, right?

Can we install them somewhere "nicer"? like maybe QStandardPaths::StandardLocation(DataLocation) + optionally "/share" ?

Ok, second option, we are actually installing these files ourselves, right?

It is where androiddeployqt puts things (I guess to avoid conflict with javastuff)

apol added a comment.Aug 29 2018, 10:15 PM

It is where Qt installs things indeed. I've done a couple of failed attempts at finding other ways to get this different. In the best scenario anyway we'll have to add an if(ANDROID) elsewhere if it's not here.

I'd say we can iterate it in the future but the patch as is shouldn't be too problematic and it actually maps how our Android builds work at the moment.

For completion, it's QtLoader.java that puts everything in qt-reserved-files. I'll ask why's the current status on the qt-android mailing list, but I wouldn't want this to stop our Android builds to have translations.

aacid accepted this revision.Sep 7 2018, 8:36 PM

ok then i guess :)

This revision is now accepted and ready to land.Sep 7 2018, 8:36 PM
This revision was automatically updated to reflect the committed changes.