Detect language based on URL

If the outer website is english/danish, the chatapp will use the same
language.
This commit is contained in:
om 2022-10-09 22:13:21 +02:00
parent bf2cf81c9d
commit 758367ba69

View file

@ -68,7 +68,14 @@ 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 = "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;
/// SVG 1.1 doesn't do proper text splitting into several lines. /// SVG 1.1 doesn't do proper text splitting into several lines.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB