ChristopherKlay / StadiaEnhanced

Various new features for Google Stadia
GNU General Public License v3.0
261 stars 31 forks source link

Add ability to set the current language as default #133

Closed francoislg closed 3 years ago

francoislg commented 3 years ago

:wave:

I tried the extension today and was pleased to see there was a Language picker! One of the thing that I found very annoying with Stadia is that it loads the page with your account language without allowing us to set a default.

So here it is! If you change the language, the "Always load with" option will be shown. If you select it, if no hl is set, it will set it to your saved language.

This effectively means that you can now set a default language :smile:

It also works if you manually change the hl parameter in the URL.

While not really necessary for this feature, I also added some visual feedback when the current language matches the row.

Let me know if there is anything wrong :smile:

I also didn't take care of translation for the new button, should I implement it right now?

ChristopherKlay commented 3 years ago

The reason i didn't support changing the default language is that there's possible errors from Stadias side.

Force-reloading pages that for example call the achievement/player statistic properties (i.e. the overview of games on someones profile) can cause errors upon page load, to the point where all users (including saved accounts people switch between) get logged out entirely and the whole service not working for a moment. Likely a restriction on the amount of callbacks for said data, that terminates the entire current session.

Force-reloading exactly those pages every time a profile gets opened via for example a third party side (Stadia Hunters, StadiaStats) or even just someone sharing their profile (social media, messaging, lfg's, ..), would easily trigger the same issue, sadly. It is also why the "profile" link is possible (only the last 3 games are loaded - which rarely causes issues), but a direct link to the profile overview (where statistics are displayed) isn't possible (and had to be removed from a previous version) due to sometimes running into those errors after just 2-3 uses already.

The issue of Stadia loading the language set via the Google account, is much better solved by the user simply appending the language code (i.e. &hl=en) to the URL in their bookmarks/shortcuts (which also works in the upcoming browser version for smartphones and the like). That way around the restrictions on callbacks of userdata are never an issue.

If you find a way to avoid the issue (it can easily be reproduced by for example opening the full profile of someone and refreshing the page a couple of times), i'd definitely love to see it - it would likely solve the shortcut to the full profile issue as well.

Highlighting the current language in the language selector however is a great idea - the extension shouldn't rely on the user understanding the current language code in the first place and a visual representation of the current language (even if it's just default) is very useful.

francoislg commented 3 years ago

Thanks for your feedback! Didn't know about any of these!

My main concern is when installing Stadia as a PWA (this thing here)

image

I found no way to inject a query parameter like you mention here :/

So let's focus on the "Force-Reload" issue, can we get around that? I tried to just remove this line.

What happens with this change:

Do you see this as a good compromise?

francoislg commented 3 years ago

:point_up: I removed the line that forces the refresh and added a translation string, let me know what you think of it :)

ChristopherKlay commented 3 years ago

I really hope i'm not sounding too negative; But i would like to keep the extension on a consistent level. In fact, i previously had to remove features, simply because while they worked, they broke the entire aspect of the extension being something that you are not supposed to notice - it should extend the service, without feeling like a taped on layer, or making the existing layer act weird. Only partly changing translations while the user navigates the site, would break that heavily.

I sadly believe unless there is a way to change the current language without forcing a refresh, or Google solves the issues with request limitations on user data, this won't be able to be implemented.

I will definitely look into changing / adding those parameters in the use-case of a PWA however.

francoislg commented 3 years ago

Alright, no worries :)