feat(i18n): data-driven language picker + locale config
Make the supported-language list a single source of truth so community translations show up with no code change: add res/xml/locales_config.xml (en, de) and reference it via android:localeConfig, which also surfaces the per-app language entry in Android 13+ system settings. Rewrite AppLanguage to parse locales_config.xml for the supported BCP-47 tags and expose currentTag/apply/displayName (autonyms), dropping the hardcoded LanguagePref enum; the Settings picker is now built from that list. Remove the now-unused settings_language_german/english strings. Adding a language is now: drop in values-<tag>/strings.xml and add one <locale> line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
app/src/main/res/xml/locales_config.xml
Normal file
13
app/src/main/res/xml/locales_config.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
The languages Calendula ships translations for. This is the single source of
|
||||
truth: each entry must have a matching res/values-<tag>/strings.xml, and is
|
||||
surfaced automatically in both the in-app language picker (parsed at runtime
|
||||
by AppLanguage) and the system per-app language settings (Android 13+, via
|
||||
android:localeConfig in the manifest). To add a community translation, drop
|
||||
in the values-<tag> folder and add one <locale> line here.
|
||||
-->
|
||||
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<locale android:name="en" />
|
||||
<locale android:name="de" />
|
||||
</locale-config>
|
||||
Reference in New Issue
Block a user