News for hackers. Stuff that matters.
Re:On the removal of Come Back Alive by mickael-kerjean on Friday February 25, 2022 @07:36AM (#30466620)
it shows the video if /ru/.test(navigator.language)
Re:On the removal of Come Back Alive by orbital-decay on Friday February 25, 2022 @07:41AM (#30466650)
This method is super inaccurate, since visitors from many countries (including Ukraine) could use Russian as their preferred language. You might probably want to use IP geolocation instead.
Re:On the removal of Come Back Alive by mickael-kerjean on Friday February 25, 2022 @08:13AM (#30466863)
Re:On the removal of Come Back Alive by app4soft on Friday February 25, 2022 @11:07AM (#30468733)
Thank You, man!

I'm Ukrainian[0] and YOUR SUPPORT for Ukrainian people in such terrifying times WOULD BE NEVER FORGOTTEN by me & by all Ukrainians actually fighting just for freedom FOREVER!

[0] https://news.ycombinator.com/item?id=30395897

Re:On the removal of Come Back Alive by capableweb on Friday February 25, 2022 @07:49AM (#30466709)
No method is perfect, obviously. But in this case you probably want to use a bunch of heuristics, placing them in a OR statement would probably get you as close as possible.

- Check preferred language (won't work for Russians who prefer English, and will show for non-Russians who prefer Russians)

- Check where IP is coming from (won't work for Russians on the border if public node is on other side of bordering-countries, won't work for Russians who use VPNs)

- Check preferred locale (won't work for Russians who has a different preferred locale, will show for non-Russians who use Russian locale)

- Finally, ask the user where they are from (worse UX, won't work for people who are lying)

Using all of them gets you pretty close to "perfect" but again, nothing is 100% perfect.

Re:On the removal of Come Back Alive by unfocussed_mike on Friday February 25, 2022 @07:58AM (#30466764)
Side note: Russian is Zelenskyy's first language.
Re:On the removal of Come Back Alive by alam2000 on Saturday February 26, 2022 @08:04PM (#30484181)
Yeah.. you can use the free IP2Location LITE https://lite.ip2location.com to pinpoint the location by IP address.