Skip to content

Enable Language setting in Settings screen #198

Description

@Noro18

Description

The "Language" setting allows users to change the app language. Currently commented out and only shows a Toast — not actually functional.

File: `app/src/main/java/com/example/ordermanagementcake/ui/settings/SettingsScreen.kt` (lines 112-114)

Expected Behavior

Users can select a language from the dialog and the app switches to that language immediately (or on restart).

Implementation

  1. Uncomment the `SettingsItem("Language", ...)` entry in `preferenceItems`.
  2. Replace the Toast in `LanguageDialog.onLanguageSelected` with actual locale switching logic.
  3. Persist the selected language preference using `DataStore` or `SharedPreferences`.
  4. On app launch, read the saved locale and apply it via `LocaleListCompat` (from AndroidX AppCompat) or custom configuration override.
  5. Update the apps `Context.createConfigurationContext()` or use `AppCompatDelegate.setApplicationLocales()` to apply the change.
  6. Consider adding a default/system option to revert to the device locale.

Additional Context

  • `LanguageDialog` exists at `app/src/main/java/com/example/ordermanagementcake/ui/setting_options/LanguageDialog.kt` — review and update as needed.
  • Ensure string resources exist for all supported languages (Tetum, Portuguese, English, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions