PreMiD / Extension-old

🧩 Source code of the official PreMiD extension.
https://premid.app/
Mozilla Public License 2.0
75 stars 28 forks source link

[Bug] Presences not working when Presence getStrings() non-English localization string #191

Closed Kotoki1337 closed 1 month ago

Kotoki1337 commented 3 years ago

This issue causes users with non-English browsers to be unable to use most of the Presences that presence.getStrings() non-English strings

Some Presences have solved this issue using .catch fallback to English like:

But some not:

To Reproduce

  1. Change browser language to Chinese Simplified or Chinese Traditional (The choice of language depends on whether the string has been translated or not?)
  2. Install SoundCloud or other Presence that calls getStrings() but does not fallback to English by default
  3. Try to trigger Presence, Presence not working
  4. Switch the browser language back to English
  5. Return to the previous page (Step 3), Presence should be working now.

Solution

Alright, so I know we can don't even bother to use localized strings if it's just paused and playing! But lots of the simple Presence is called localized strings, and if we want to fix them all we must change them all one by one. Extensions should probably fall back to English by themselves if the localization string for the user's browser language does not exist, instead of directly causing Presence to not work

Bas950 commented 3 years ago

Pretty sure it was related to the whole setting being undefined. But that could happen to any browser not depending on language. Didn't know it was an actual thing on Chinese...

Kotoki1337 commented 3 years ago

Pretty sure it was related to the whole setting being undefined. But that could happen to any browser not depending on language. Didn't know it was an actual thing on Chinese...

So I think the extension should return the English string itself when it finds a string that is not defined, at least let Presence working in the situation I'm talking about. There will always have some languages where there are no active translators resulting in the localization string not being defined