Use URLSearchParams for more robust lang selection

This commit is contained in:
om 2022-10-10 07:30:58 +02:00
parent 758367ba69
commit 2d13672dde
3 changed files with 3 additions and 8 deletions

View file

@ -31,7 +31,7 @@ vil være mistænkte for børnemisbrug.
<div id="app-area"> <div id="app-area">
<object id="movie" data="../img/chatapp.svg" type="image/svg+xml"></object> <object id="movie" data="../img/chatapp.svg?lang=da" type="image/svg+xml"></object>
<p id="movie-sidetext"> <p id="movie-sidetext">
Lær mere om ChatControllen og hvorfor det er en dårlig idé, i vores interaktive ChatControl film ude til venstre. Lær mere om ChatControllen og hvorfor det er en dårlig idé, i vores interaktive ChatControl film ude til venstre.
</p> </p>

View file

@ -32,7 +32,7 @@ will be treated as suspects for child abuse.
</p> </p>
<div id="app-area"> <div id="app-area">
<object id="movie" data="../img/chatapp.svg" type="image/svg+xml"></object> <object id="movie" data="../img/chatapp.svg?lang=en" type="image/svg+xml"></object>
<p id="movie-sidetext"> <p id="movie-sidetext">
Learn more about Chat Control and why it is a bad idea by watching our Learn more about Chat Control and why it is a bad idea by watching our
interactive film on the left. interactive film on the left.

View file

@ -69,12 +69,7 @@ const typing_speed = 50;
var conversation_count = 0; var conversation_count = 0;
var current_dialog = null; var current_dialog = null;
var current_language = "da"; var current_language = new URLSearchParams(location.search).get('lang') ?? 'da';
if(location.protocol.startsWith('http')) { // avoid X-origin errors
if(parent.location.href.match(/\ben\b/)) {
current_language = 'en';
}
} // else: Just stick to danish
var current_dialog_fn = null; var current_dialog_fn = null;

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB