lingua-libre / SignIt

🌻 Lingua Libre SignIt web-browser extension translates selected word in French Sign Language via an elegant pop up so you learn sign language while reading online.
https://addons.mozilla.org/en-US/firefox/addon/lingua-libre-signit/
MIT License
11 stars 13 forks source link

Passing message to execute functions, changing icons and removing unnecessary headings #71

Closed kabir-afk closed 1 month ago

kabir-afk commented 1 month ago

Changes Made:

  1. 76594aa - Removed unnecessary headings
  2. 72bff78 - Updated CSS background images for navigation icons
  3. fec65d9 - Added messages for functions relying on "backgroundPage"
  4. 2add156 - Refactored code based on new messages

Description

While first 2 changes are minor , I would like to elaborate on the 3rd and 4th ones. Apparently we borrowed some functions from background-script.js , for example:- backgroundPage.normalize or backgroundPage.checkActiveTabInjections. But in Chrome MV3 we cant do such things. In order to mimic this behavior I came across various methods which I am going to discuss down below:-

Different browsers have namespace differences as well as different API function coverage..for example while in FF we can still make use of _backgroundPage.getBackground(), but we can't do it in Chrome because of the MV3 limitations. And browser type checking for different browsers isn't certainly scalable or efficient. This is also one of the reasons why above approach is better as it is pretty universal to all the browsers and doesn't require much change.

If we can make this work , then it'll be better overall , no more unnecessary messages and compatible across both sw.js and background-script.js. We won't need to change the way messages are received as there will be no messages to begin with. It will also not hinder with the problem mentioned above. Maybe I might have done something wrong but again we should keep trying.

kabir-afk commented 1 month ago

Btw , translate wikibot hasn't changed the pnb.json file to urdu.json...should I add that ?

hugolpz commented 1 month ago

Btw , translate wikibot hasn't changed the pnb.json file to urdu.json...should I add that ?

Nope, i asked Translatewiki, they will guide us.

kabir-afk commented 1 month ago

Well L201-210 relied on signlanguages which further relied on the getSignLanguagesWithVideos function, which has an API endpoint issue. So I commented it out in order to proceed forward, otherwise it would have been stuck there the whole time