feat: add German language support (DE/EN/FR) - #17
Conversation
- Add full German translations for all namespaces (common, auth, recipes, editor, importRecipe, settings, privacy) - Add `german` key to existing EN and FR settings translations - Auto-detect device language: de → Deutsch, en → English, else → Français - Extend language type to "fr" | "en" | "de" in PreferencesProvider - Add Deutsch option to language SegmentedControl in SettingsScreen Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Note: PR #18 adds a language switcher directly to the login screen (fixes #16). It is based on <SegmentedControl<"fr" | "en" | "de">along with the additional option: { label: t("settings.german"), value: "de" } |
Auto-detected language was silently overridden by a stale AsyncStorage value from an older app version. A new `preferences.language.userSet` flag is now written only when the user actively changes the language — startup only restores the stored value if this flag is present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thank you so much for taking the time to add the German translation. Your fix for the AsyncStorage stale value overriding the system locale is brilliant. The userSet flag makes perfect sense and is a much cleaner way to handle the fallback logic. I just pulled the branch locally and tested it on my simulator: everything works flawlessly. The language switch is smooth and the persistence bug is fully resolved. Merging this right away. Thanks again for this massive contribution to AvoCook! |
feat: add German language support (DE/EN/FR)
Summary
de) translations for all namespaces:common,auth,recipes,editor,importRecipe,settings,privacygermankey to the existing English and Frenchsettingstranslationslanguagetype from"fr" | "en"to"fr" | "en" | "de"inPreferencesProviderand persists the selection viaAsyncStorageFiles changed
src/i18n/index.tsgermankey added to EN + FR; updated language detectionsrc/features/preferences/PreferencesProvider.tsx"fr" | "en" | "de"; init and validation logic updatedsrc/screens/SettingsScreen.tsxSegmentedControlBug fix: auto-detection overridden by stale AsyncStorage value
Problem: On first launch after installing the update, the app could show the wrong language (e.g. English) even on a German device. The
PreferencesProviderreads any previously stored language fromAsyncStorageand applies it unconditionally — including values written by an older version of the app that had no German support. Since those older values were never explicitly chosen by the user (they were set automatically), the stored"en"would silently override the device locale.Fix: A separate
preferences.language.userSetflag is now written toAsyncStorageonly when the user actively changes the language viasetLanguage. On startup, the stored language is only restored if this flag istrue. If no explicit choice has been recorded, the device locale is used as intended.Testing
Tested on Apple iPhone with Expo Go — app correctly launches in German on a German-locale device. Language switching in Settings also works as expected.
This implementation was generated with Claude Code.