lightning-browser-extension icon indicating copy to clipboard operation
lightning-browser-extension copied to clipboard

feat: load locale from settings stored under extension's storage

Open pavanjoshi914 opened this issue 3 years ago • 5 comments

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

  1. Create a custom detector, which loads locale from extension's storage (for existing user)
  2. 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.

  1. create a new wallet, go under settings, uncheck WebEnhancement button
  2. remove existing Alby, open the same wallet using lndhub URL, see WebEnhancement but 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)

pavanjoshi914 avatar Mar 25 '22 10:03 pavanjoshi914

maybe @secondl1ght can also look into this and @pavanjoshi914 can help with potential questions? @secondl1ght interested?

bumi avatar Apr 14 '22 04:04 bumi

Sure I can look into this, @pavanjoshi914 do you want to pair on this if I have any questions?

secondl1ght avatar Apr 14 '22 04:04 secondl1ght

sure ❤️

pavanjoshi914 avatar Apr 14 '22 04:04 pavanjoshi914

Hey @pavanjoshi914 I put in a PR for this #869

secondl1ght avatar May 08 '22 01:05 secondl1ght

Please have a look at #1265

escapedcat avatar Aug 11 '22 07:08 escapedcat

Please give a try

escapedcat avatar Aug 16 '22 07:08 escapedcat