Detect language based on URL #4

Merged
om merged 2 commits from feature/automatic-language-switch into master 2022-10-13 19:07:39 +00:00
3 changed files with 3 additions and 8 deletions
Showing only changes of commit 2d13672dde - Show all commits

View file

@ -31,7 +31,7 @@ vil være mistænkte for børnemisbrug.
<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">
Lær mere om ChatControllen og hvorfor det er en dårlig idé, i vores interaktive ChatControl film ude til venstre.
</p>

View file

@ -32,7 +32,7 @@ will be treated as suspects for child abuse.
</p>
<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">
Learn more about Chat Control and why it is a bad idea by watching our
interactive film on the left.

View file

@ -69,12 +69,7 @@ const typing_speed = 50;
var conversation_count = 0;
var current_dialog = null;
var current_language = "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_language = new URLSearchParams(location.search).get('lang') ?? 'da';
var current_dialog_fn = null;

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB