feat: load locale from settings stored under extension's storage
Is your feature request related to a problem? Please describe.
currently, we use browser_language_detector to detect language, store language under local storage and load the locale from the local storage.
https://github.com/getAlby/lightning-browser-extension/pull/711 saves locale in extension storage but we don't load this locale for use.
We can override the normal behaviour of browser_language_detector and load locale which is stored under extension storage. we can create a custom detector for that https://github.com/i18next/i18next-browser-languageDetector/issues/140
Describe the solution you'd like
- Create a custom detector, which loads locale from extension's storage (for existing user)
- fallback to local storage if it's not an existing user or there is no locale present in extension storage (when new user use alby)
detection: {
// order and from where user language should be detected
order: ['customDetector', 'querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag']
}
Additional context we have to discuss the cases when custom locale present in extension storage will be used!
In the current setup.
- create a new wallet, go under settings, uncheck
WebEnhancementbutton - remove existing Alby, open the same wallet using lndhub URL, see
WebEnhancementbut still checked!
in this case, we are not loading saved settings. clarification is needed in which cases we can load locale stored in extension's storage and how currently saved settings are loaded back
Are you working on this? (Yes/No)
maybe @secondl1ght can also look into this and @pavanjoshi914 can help with potential questions? @secondl1ght interested?
Sure I can look into this, @pavanjoshi914 do you want to pair on this if I have any questions?
sure ❤️
Hey @pavanjoshi914 I put in a PR for this #869
Please have a look at #1265
Please give a try