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

Allow country & language selection from the settings #849

Closed
1 of 2 tasks
Tracked by #960
teolemon opened this issue Jan 4, 2022 · 8 comments · Fixed by #1729
Closed
1 of 2 tasks
Tracked by #960

Allow country & language selection from the settings #849

teolemon opened this issue Jan 4, 2022 · 8 comments · Fixed by #1729
Assignees
Milestone

Comments

@teolemon
Copy link
Member

teolemon commented Jan 4, 2022

What

Why

  • Users who travel
  • Debugging
  • Taking localized screenshots
  • Making localized demos

Part of

V1 screenshot

image
image

@teolemon teolemon added ✨ enhancement New feature or request ⚙️ Settings labels Jan 4, 2022
@teolemon teolemon changed the title Allow country selection from the settings Allow country & language selection from the settings Jan 4, 2022
@monsieurtanuki
Copy link
Contributor

@teolemon Some remarks:

  • "Allow country selection from the settings": that may make sense for muggles that travel, fair enough
  • "Allow language selection from the settings": so far we take the default locale of the device (Localizations.localeOf(context).languageCode), and I don't see the obvious use case for muggles - especially because it would mean reloading the whole product database. Shouldn't we better keep that one for wizards only, I mean in dev mode?

@monsieurtanuki monsieurtanuki self-assigned this Jan 5, 2022
@M123-dev
Copy link
Member

M123-dev commented Jan 5, 2022

Yes, I am also in favour of keeping the language private

@jasmeet0817
Copy link
Contributor

jasmeet0817 commented Jan 5, 2022 via email

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jan 5, 2022
Impacted files:
* `country_selector.dart`: fixed an async bug; added facultative default country, decoration and padding
* `user_preferences_profile.dart`: added a "select country" item
* `welcome_page.dart`: added decoration and padding as parameters to `CountrySelector`
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jan 5, 2022
Impacted files:
* `country_selector.dart`: now the initial value is required
* `welcome_page.dart`: specify the now required initial value
monsieurtanuki added a commit that referenced this issue Jan 5, 2022
Impacted files:
* `country_selector.dart`: fixed an async bug; added facultative default country, decoration and padding
* `user_preferences_profile.dart`: added a "select country" item
* `welcome_page.dart`: added decoration and padding as parameters to `CountrySelector`
@monsieurtanuki
Copy link
Contributor

The public country part was done in #861.

@M123-dev M123-dev added this to the V 1 milestone Jan 5, 2022
@monsieurtanuki
Copy link
Contributor

For the record you can already change the app language: just change the smartphone language.
Doing so you'll be as clean as possible (e.g. no default labels in another language).

@Roto15
Copy link

Roto15 commented Mar 30, 2022

In my opinion it will be good to have the possibility to choose the language of the app from the settings because they are not so many languages that are fully translated.If someone want to add or edit a product its better that the information is correctly entered.

@UgoKo-Rubeast
Copy link
Contributor

UgoKo-Rubeast commented May 1, 2022

I'm now working on this issue to confirm whether the app language is able to be changed, but I failed and this is my implementation.
#1729
Is there any way to change the language? I found this following post about how to change the language manually. Should we do like that and add shared_preferences dependence?
https://medium.com/flutter-community/flutter-internationalization-the-easy-way-using-provider-and-json-c47caa4212b2

@M123-dev
Copy link
Member

M123-dev commented May 1, 2022

Heyy @UgoKo-Rubeast, we are already using shared_preferences, when I remember right it is not in the dependencies since it's build-in into flutter or something like that,

I've just had a look at your #1729, and you are right, what you are doing there is updating the product preferences and not the main app. The article you send looks promising but as the language selection should probably be hidden for most users I don't think we need a provider for that, manually restarting the app should be more then enouph.

What I would recommend:

  • Add a ListTile to the dev-settings which is set to "Automatically" initially.
  • If someone changes it store it in the preferences.
  • And in the MaterialApp, check if something is stored in the preferences, if not use the standard language.

@teolemon teolemon linked a pull request May 2, 2022 that will close this issue
M123-dev pushed a commit that referenced this issue May 9, 2022
* feature/849-add-language-selection

* feature/849-add-language-selection add language selection to dev mode

* feature/849-add-language-selection add context.select to main.dart for watching locale

* feature/849-add-language-selection flutter format

* feature/849-add-language-selection add app language reset to dev mode

* feature/849-add-language-selection change app language reset from platform.localeName to null

Co-authored-by: Pierre Slamich <[email protected]>
Repository owner moved this from Todo (ready 2 dev) to Done in 🤳🥫 The Open Food Facts mobile app (Android & iOS) May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants