NMF-earth / nmf-app

Understand and reduce your carbon footprint 🌱 iOS & Android.
https://nmf.earth
GNU General Public License v3.0
496 stars 156 forks source link

Implement language switching #289

Closed adrianxx321 closed 3 years ago

adrianxx321 commented 3 years ago

This is referring to the feature as requested in #249, i.e, to have language switching mechanism when the app is running.

First of all, apologize if I have been overdoing it as I introduced a new screen under settings that allows for languages selection. I admit the changes that I've made is quite a lot, but no worries as most of the changes involved are just adding the translation entries for the associated translation files.

Right now, the behaviour of language switching is of only minimal, like what is mentioned in the ticket #249 where I couldn't actually change the language for the entire app, but I believe having able to see the name of the month changed (see screenshot below) should indicate that I've implemented the desired mechanism. By the way, even though I observed the language is currently set once in the App.tsx, I didn't make any change to it. Instead, I just added a new entry under userPreferences store to keep track of the language selected which will be reflected in the new language settings screen, and then from the languages screen when the language is changed, I used the setLanguage property as provided in the LocalizationContext, thereby achieving the desired mechanism.

Below are the screenshot showing the sign of language being changed as well as a demo in GIF to better show that behaviour.

Screenshot 2021-07-29 at 10 35 41 AM Screen Recording 2021-07-29 at 10 37 21 AM

Last but not least, I am proud to be able to contribute to the localisation feature of this app. I strongly believe that once we figure out the way of making language switching to cover the rest of the UI, at one day, this app will definitely have significantly greater worldwide reachability, to help save our planet!

Thank you.

PierreBresson commented 3 years ago

@adrianxx321 thanks for the help 🤗