Op ma 5 feb 2024 om 01:51 schreef Dirk Hohndel <[email protected]>: > Taking this back to the mailing list... > > On Feb 4, 2024, at 08:44, Dirk Hohndel wrote: > > On Feb 4, 2024, at 02:07, Peter Zaal <[email protected]> wrote: > > > Couple of questions and thinks I noticed: > - How do I actually switch to another language? I think the old site had a > "en|de|nl|es" switch on top. That would be really helpful. I have no idea > how to switch now. I tried to add /nl/... in the url, that worked (and the > url is updated to ...?lang=nl), but it doesn't stick. As soon as I select > another page it's the English version again. Also it doesn't use the > browser settings; I see my browser (Edge on Windows) sending the > Accept-Language: nl,en header. But most useful would be to allow the user > to select itself with a language selection switch. > > > This is all really confusing to me - but of course I didn't test with > Windows. > Coming from a Mac or Linux box, the language preference of your browser is > used. > If you don't want that, then both the /nl/ and ?lang=nl should work, and > they should be persistent - they are part of the browser session. > I quite literally have two different 'profiles' on Firefox here on my Mac, > one sets preferred language to English, the other to German, and depending > with which one I go to the site, that's the language I get - and I can > still override this with /es/ and get Spanish... until I override it with > something else or close the browser tab. > > I now do have a Windows box. I replaced Edge with Firefox right away, but > of course you can't uninstall it, so it's still there and I'll try. > > > Today has been a fascinating day of appreciation (for all the people > stepping up to help out) and learning - about all kinds of weird things; > most relevant for this conversation the wild and creative ways in which > different browsers on different OSs do what seems to be the same thing very > differently. > > Long story short - I think the site should now respect your browser's > language preference (and if it doesn't I really wanna know about it and > figure out what headers YOUR browser sends to my server -- I have tested > this with Safari, Firefox, Chrome, and MSFT Crap... sorry, they named it > Edge for some reason... across macOS, Linux, and Windows (obviously not > every browser on every OS, but at least two browsers on each of them). > > On top of that, you should now be able to simply append "?lang=CODE" with > the appropriate language code and that will work. And of course the old > "prefix the language code in front of the URL" thing also works. > > So for someone with a German browser, > https://subsurface-divelog.org/current-release should open the page for > the Aktuelle "wöchentliche" Version - and using > https://subsurface-divelog.org/nl/current-release should get them Huidige > "wekelijkse" versie. And each subsequent link within the site will carry > with it the corresponding language indicator. So if you once pick a > language different than what your browser tells us it prefers, subsequently > you should stay in that language if you follow site-internal links. > > I will admit that getting this to work was decidedly NOT FUN. > > Please test. Please show me examples where it's still broken. I tried very > hard to catch all links, but I'm not 100% sure that none escaped my > grep-patterns. > > Thanks > > /D >
In the end it is not so much on the OS, as it is on what headers a specific browser sends, and how the website interprets and responds to that. But I think (and hope) I figured out the problem. Both Edge and Chrome (on my Windows) did not open the local language pages (cookies deleted etc). But when I started the browser in In-Private/Incognito modus, then it did show the local pages! There is a difference in the Accept-Language header! In in-private/incogito mode it is: "Accept-Language: nl", and in normal mode it is "Accept-Language: nl,en;q=0.9,en-US;q=0.8,nl-NL;q=0.7" (Chrome) and "Accept-Language: nl,en;q=0.9,en-GB;q=0.8,en-US;q=0.7" (Edge). So it looks like the quality (q) value is messing up things and not handled correctly server-side. Another small thing is that the local pages are using the 'full' language-region code, so e.g. /nl_NL/...That is probably because that's how the languages are declared in the languages array in server.py. But that might be ok, in that way multiple regions are supported as well. Manually entering and using only the language code also works. The language code now sticks, I don't know why it didn't before... Peter
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
