-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: add language selection on settings page #842
feat: add language selection on settings page #842
Conversation
@futurepaul I'm curious about how I should override the i18n context, is it already being done on another part of the code? |
As we discussed, it would need a new language field and function update, right ? Something like this: mutiny-web/src/state/megaStore.tsx Lines 327 to 334 in c680ab2
|
yeah that looks right to me. you set it in the state, and then you reference that value from the global state to pass to the config during i18npovider (https://github.com/MutinyWallet/mutiny-web/blob/master/src/components/I18nProvider.tsx) it looks like i18n has its cachuserlanguage thing but probably don't need to bother with it would rather just have it stored in megastore https://github.com/i18next/i18next-browser-languageDetector |
nice! thx |
ba17300
to
1bf2d77
Compare
yep, I've tried using the cache and detection options, but doesn't to work 🤔, I'll try getting it directly from megaStore then lol |
I see the issue here! you need to modify the detection in the i18n config as such
This will allow the localStorage item to be found |
Nice! I've tried that, but the problem remained I think mainly because it wasn't being refreshed 🤔 |
2b57676
to
d24d5de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really close! great work, just some small things and then make sure to run pnpm pre-commit
to clean up any prettier formatting
d24d5de
to
c51f59b
Compare
@benalleng I was talking with @benthecarman about adding some non-blocking step on CI for showing that some translations are missing, wdyt ? |
Definitely! I think we should probably make a new PR for that CI check though |
I'll add some playwright tests on this PR as well, and then we are good to go :) |
c51f59b
to
b74eb18
Compare
b74eb18
to
1048318
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the element chat we came to some consensus that we might want to change the key names for thie Language
interface as it might be a little confusing with the value
being the "label" in the ui and the label
being the "value" sent to i18next. @futurepaul suggested we replace label
with shortName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made another pass after I had a chance to look at #875 and the value
<=> label
stuff was most of the problem with the select options being weird but I did catch one small change in addition to that
1048318
to
9aa390b
Compare
1534c08
to
605a19a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to butt heads on this! But switching back and forth with the value and findLanguageByValue() is still causing problems.
If you start in another language it still always displays english as the default
605a19a
to
111b042
Compare
No worries, I think I covered everything now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK great work on this!
fixes #830
closes #875