Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App does not use system language preference when expected #978

Open
achou11 opened this issue Feb 14, 2025 · 1 comment · May be fixed by #1011
Open

App does not use system language preference when expected #978

achou11 opened this issue Feb 14, 2025 · 1 comment · May be fixed by #1011
Assignees
Labels
bug Something isn't working

Comments

@achou11
Copy link
Member

achou11 commented Feb 14, 2025

Describe the bug

The flow in which we should be calculating the language to use in the app is generally as follows:

  1. If you explicitly selected a language in the app using the language settings, use that
  2. Use the the language preference based on the system preferences
  3. Use English

Assuming (1) is has not been done, switching the system language to a choice that the app does support does not update the the language in the app. This is the case the app is already opened and even after restarting the app.

To Reproduce
Steps to reproduce the behavior:

  1. Do a fresh install
  2. Open your Settings app (do not close CoMapeo)
  3. Go to System -> Languages
  4. Change the primary (or preferred, depending on Android version) language to something other than the current choice that is supported by the app
  5. Go back to the app. You'll notice that the app does not update to make use of the newly selected system language
  6. Restart the app. Upon re-opening, you'll notice that the app does not make use of the newly selected system language.

Expected behavior

In the case that the user has NEVER explicitly selected a language within the app's settings UI, the chosen language based on the user's system preferences should be reflected in the app.

Screenshots

system-language-issue.mp4

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: Pixel 6
  • OS: Android 15
  • Version: 1.2.0

Additional context

I think I already identified the issue in the code. It's related to our usage of persisted state for initializing and determining the active language that the app uses

https://github.com/digidem/comapeo-mobile/blob/309c374022d1bc46bfade1376761fd80113bb351/src/frontend/hooks/persistedState/usePersistedLocale.ts

@achou11 achou11 added the bug Something isn't working label Feb 14, 2025
@achou11 achou11 linked a pull request Feb 26, 2025 that will close this issue
@achou11
Copy link
Member Author

achou11 commented Feb 27, 2025

Part of the issue here is that we don't have a way of understanding why the active language is being used. For example, I see that English is my selected language, but I have no idea if that's because my system preferences are being used, or if it's because at some point, I pressed the English option and our app persisted that in storage.

Most apps I use have an option in their language selection UIs along the lines of Follow system preferences and usually that's the default. Would be great to have something similar for ours or update the UI to communicate that somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant