From 758367ba697ab02cb481c65af8c6d5599fceeb33 Mon Sep 17 00:00:00 2001 From: om Date: Sun, 9 Oct 2022 22:13:21 +0200 Subject: [PATCH] Detect language based on URL If the outer website is english/danish, the chatapp will use the same language. --- img/chatapp.svg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/img/chatapp.svg b/img/chatapp.svg index 3c04f47..e7fa152 100644 --- a/img/chatapp.svg +++ b/img/chatapp.svg @@ -68,7 +68,14 @@ 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_dialog_fn = null; /// SVG 1.1 doesn't do proper text splitting into several lines.