Repository navigation
feat(i18n): downloadable language packs - #898
Merged
Merged
Conversation
The auto-translated setup_not_active_title had lost the space next to %s in 25 locales (e.g. "LeanType aktivieren" became "LeanTypeaktivieren") and was empty in Russian.
Translated UI strings can ship as resource-only APKs that the app loads on Android 11+ with ResourcesLoader. - LanguagePacks loads packs from device-protected storage into the app and activity resources. A pack is used only when its package name and resources.arsc checksum match the running build. - "App translation" row on the Languages screen: download, import from file, remove. - tools/build_language_pack.py builds a pack for a given app APK, reusing its resource IDs. - -PenglishOnly leaves values-*/strings*.xml out of the APK; locale folders keep their typing config.
aapt2 compile --legacy accepts the same strings as the app build (bn failed otherwise). Packs no longer carry the English defaults (--no-resource-removal keeps strings without a default), which halves their size: 7.5 MB for all 55 locales.
A pack may hold nothing but a manifest and a resource table with string, plurals and array resources, so it cannot replace layouts, drawables or other values. Packs that no longer fit the app build are deleted at startup instead of being skipped.
Eight locales lost formatted="false" on strings with a literal %, so aapt2 read them as format specifiers (strict compile failed on bn).
LeanBitLab
marked this pull request as ready for review
November 22, 2026 13:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prototype for moving the translated UI strings out of the APK (about 4.9 MB of
resources.arsc) into downloadable language packs. Packs are built and published by LeanType-Language-Packs (manual workflow, run with a release tag after this is in a release).How it works
strings*.xml, built bytools/build_language_pack.pyfor a given app APK. It reuses that APK's resource IDs (aapt2 --stable-idsfromaapt2 dump resources), so no Gradle change is needed and it also works for the reproducible F-Droid APK.resources.arscand its locale. The app loads a pack only when package name and checksum match the running build (betas reuse versionCodes, so versionCode is not enough).LanguagePacksloads packs from device-protected storage (works before first unlock) withResourcesLoaderon Android 11+, into the app resources (shared by the keyboard service) and every activity.LeanType-Language-Packs/releases/download/<versionName>-<crc>/<locale>.apk. The offline flavor opens the releases page instead.-PenglishOnlyleavesvalues-*/strings*.xmlout of the APK. Locale folders keep their typing config (bools.xmletc.). Default builds are unchanged.Separate commits:
setup_not_active_titlehad lost the space next to%sin 25 locales and was empty in Russian; eight locales lostformatted="false"on strings with a literal%(strict aapt2 compile failed on bn).Tested (device, Android API 37, English-only standard debug build)
No pack: app shows English, row says "not installed".
Download: 404 handled (no release yet), message shown.
Import of a German pack: Settings switches to German; still German after a force-stop (pack loads at startup).
Remove: pack deleted, back to English.
Release build (R8, resource shrinking, release key), English-only: imported German pack loads, Settings and the keyboard's clipboard panel are German, the keyboard process loads the pack after a force-stop.
Offline flavor (debug, English-only): Download opens the releases page, import switches to German.
A pack with a color resource and a pack from the previous build are both rejected and deleted.
Follow-ups (separate PRs)
ResourcesLoader)