Attempt to fix language issues #258
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it fix?
For #251
It doesn't happen just in that case, you can also see it if you navigate to the
Observer's guide
screen. This is happening because the forms, observer's guide and about are the 3 fragments in the navigation graph and when you go to one and then return to the others they get recreated. This seems to make the fragments to revert to the default locale(which is english) and ignore the locale we set(I don't understand why this happens). I tried something and it seems to work:LocaleManager.wrapContext()
in the base fragment to again apply the selected locale to the fragments.VisitedPollingStationsActivity
I removed the label from the manifest(is applied before our locale is set and it relies on the system resources) and I set the title manually.PollingStationsDetailsFragment
and itsViewModel
I modified thepollingStationLiveData
to return a pair of the needed values and let the fragment get the string. The ViewModel was using the application Context which is not going to have our locale applied to it. Here there's still a bug because I didn't changed the error strings(as above for pollingStationLiveData )when the user doesn't select area/gender/time because themessageIdToastLiveData
is from the super class and it is also used in other places as well.My changes seem to solve the bug but I'm not very comfortable with the code because I don't really get what is happening(and I don't know if I introduced bugs elsewhere). I made the PR so you could have a solution if you want it.
How has it been tested?
I've played around with the app and it seems to keep the selected language.