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

Change Language while on the app #267

Merged
merged 7 commits into from
May 16, 2024
Merged

Change Language while on the app #267

merged 7 commits into from
May 16, 2024

Conversation

npfrei
Copy link
Contributor

@npfrei npfrei commented May 15, 2024

This allows users to change language from the preferences screen. The code is present in the main activity file as it needs to call the recreate method, which is only doable in an activity

@JeremyHugentobler JeremyHugentobler self-requested a review May 15, 2024 11:58
Copy link
Contributor

@ecornamu ecornamu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job my G

Copy link
Contributor

@CassioManuguerra CassioManuguerra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nehemie,
this PR is looking great, this is a very crucial functionality because else our language setting is just useless. Your code is working seamlessly which is very nice, the functionality is well adjusted. On a testing side, your code features more than 80% branch coverage, and same for line coverage. Good job !
I have a few remarks though,

  • you haven't tested toLocale for french and german, two easy lines of code to get and for good testing purpose
  • you under-commented your code, again if someone has to go back to it at some point or even for other people coming to look at the code, it really is important to have a minimum of comment to save a lot of time for the others

Thank you for fixing the few comments I put on your code, great code quality overall, good luck ! :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are able to comment a bit more this part of the code it would be great :)

Comment on lines +16 to +20
fun toLocale(): String {
return when (this) {
ENGLISH -> "en"
FRENCH -> "fr"
GERMAN -> "de"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to test for each language in case for one the toLocale would be incorrect :)

@npfrei npfrei linked an issue May 16, 2024 that may be closed by this pull request
@CassioManuguerra CassioManuguerra self-requested a review May 16, 2024 10:36
Copy link

sonarcloud bot commented May 16, 2024

Copy link
Contributor

@CassioManuguerra CassioManuguerra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the comments and testing up to 90% of coverage, code looks great, approving now !

@npfrei npfrei merged commit 4dd8c19 into main May 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Language preference change the language of the app
3 participants