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

[Feature] Change Language in Welcome screen

Open rolznz opened this issue 2 years ago • 7 comments

Feature description

In the welcome screen I don't see any way to change the extension language. I also tried changing my language from my chrome settings to Spanish, then going back to the extension tab and refreshing, but the welcome page was still in English. Trying to open the extension options will just re-open the welcome screen since the setup hasn't been completed yet.

Describe the solution

Either the language should update when you change your language in the browser settings, or there should be a way to change the language in the welcome screen (like a dropdown in the top right corner)

rolznz avatar Dec 14 '22 14:12 rolznz

Hm, when this was built this worked I believe.
This should take of of using the correct language: https://github.com/getAlby/lightning-browser-extension/blob/master/src/i18n/i18nConfig.ts#L60
If this doesn't work (anymore) this is a bug.

escapedcat avatar Dec 14 '22 14:12 escapedcat

@rolznz @escapedcat I debugged this: the applied LanguageDetector in i18nConfig.ts works as expected and switches to the browser settings preferred language (I tested in Chrome and it uses the first in list). The problem is, in SettingsContext we listen for the settings.locale changes (see https://github.com/getAlby/lightning-browser-extension/blob/master/src/app/context/SettingsContext.tsx#L132) and update the language accordingly, back to English, in case the user selected English before in the settings page.

So I guess we have to choose our priority: either just detect the browser language on page load (app start) or explicitly let the user select (and store) the language on settings page. I guess this has more priority, as it is implemented. In this case I would leave as is (let the browser detection do its work and then the SettingsContext useEffect set settings.local) and just add a language selector to the welcome page.

In case a user installs for the first time and never manually selected a language in the settings before, I guess the i18nConfig detected language is prioritized.

lujakob avatar Jan 28 '23 17:01 lujakob

In case you agree I could implement it. Question left would be how to style it? Placing language selector at the top right corner could be an option? Just not sure if the select style from the settings page is ideal? Maybe anyone else has suggestions..

lujakob avatar Jan 28 '23 17:01 lujakob

I guess it would make sense to offer a language-select as well. tbh we could remove the browser language detection as well then.

Did some digging:

We had a select. It was introduced here: https://github.com/getAlby/lightning-browser-extension/pull/711/files#diff-784da3b6df7bd2be24bdb6e8b8e068eb2760d9f773695e6c2b431729fda0971c Initally we only showed this because we didn't have any translations back then. The plan was to enabel this, once we do have translations.

Then it was removed here: https://github.com/getAlby/lightning-browser-extension/pull/1397/files#diff-784da3b6df7bd2be24bdb6e8b8e068eb2760d9f773695e6c2b431729fda0971cL132-L139 It looks like we didn't do this on purpose though. The change is not mentioned in the PR description nor in the commit-messages. @bumi you remember if this was done on purpose? If not we could just re-add this, right?

escapedcat avatar Jan 29 '23 14:01 escapedcat

Hey can u assign it to me, i would to work on it 😄😃

AryanParashar24 avatar Oct 05 '23 16:10 AryanParashar24

I think what makes sense is: default to use the browser language, but still allow a user to manually select a language on the welcome screen.

Maybe @stackingsaunter would best review this first before we implement it.

rolznz avatar Oct 06 '23 03:10 rolznz

@rolznz I like this suggestion, let's do this.

Is the removed solution still applicable? Could you perhaps screenshot it for me (I can't figure out how to find and install that version :P)

stackingsaunter avatar Dec 02 '23 22:12 stackingsaunter