$TITLE_ESCAPED<\\/h1>/g" /var/www/html/index-classic.html
sed -i "s/LibreSpeed<\\/title>/$TITLE_ESCAPED<\\/title>/g" /var/www/html/index.html
- sed -i "s/LibreSpeed - Free and Open Source Speedtest<\\/title>/$TITLE_ESCAPED - Free and Open Source Speedtest<\\/title>/g; s/
Free and Open Source Speedtest\\.<\\/h1>/
$TITLE_ESCAPED<\\/h1>/g" /var/www/html/index-modern.html
+ sed -i "s/LibreSpeed - Free and Open Source Speedtest<\\/title>/$TITLE_ESCAPED - Free and Open Source Speedtest<\\/title>/g; s/
Free and Open Source Speedtest\\.<\\/h1>/
$TITLE_ESCAPED<\\/h1>/g" /var/www/html/index-modern.html
fi
# Replace modern page tagline if TAGLINE is set
@@ -133,7 +133,7 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
TAGLINE_ONE_LINE=${TAGLINE_ONE_LINE//$'\n'/ }
TAGLINE_HTML_ESCAPED=$(html_escape "$TAGLINE_ONE_LINE")
TAGLINE_ESCAPED=$(sed_escape "$TAGLINE_HTML_ESCAPED")
- sed -i "s/
No Flash, No Java, No Websockets, No Bullsh\\*t<\\/p>/
$TAGLINE_ESCAPED<\\/p>/g" /var/www/html/index-modern.html
+ sed -i "s/
No Flash, No Java, No Websockets, No Bullsh\\*t<\\/p>/
$TAGLINE_ESCAPED<\\/p>/g" /var/www/html/index-modern.html
fi
# Support legacy EMAIL env var as fallback for GDPR_EMAIL
diff --git a/frontend/README.md b/frontend/README.md
index b19be33..3233d80 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -18,6 +18,20 @@ page fetches them relative to itself:
- `../settings.json` overrides selected `speedtest_worker.js` settings.
- `index.html` and `../index-modern.html` show how the frontend is wired up.
+## Localization
+
+The modern page ships with English, Swedish, Portuguese and Spanish. The language is the saved choice, then the first
+supported language of the browser, then English; the selector in the footer changes it and saves the choice in the
+browser.
+
+- `javascript/i18n.js` loads `locales/.json` (flat JSON, dotted keys) and fills the elements marked with
+ `data-i18n="key"` (text) or `data-i18n-attr="attribute:key"` (attributes). The English text stays in the HTML as the
+ fallback.
+- Texts written by `javascript/index.js` go through `LibreSpeedI18n.t(key, fallback, { name: value })`.
+- To add a language, copy `locales/en.json` to `locales/.json`, translate it and add `{ id, name }` to `LANGUAGES` in
+ `javascript/i18n.js`. `tests/e2e/i18n.spec.js` checks that every catalog has the same keys as the English one.
+- Setting `TITLE` or `TAGLINE` in the Docker image replaces the translated title, heading and tagline with that text.
+
## Notes
- The modern frontend expects modern browser features and does not support old
diff --git a/frontend/index.html b/frontend/index.html
index 8a804d7..1fc6080 100755
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -8,13 +8,14 @@
/>
+
- LibreSpeed - Free and Open Source Speedtest
+ LibreSpeed - Free and Open Source Speedtest
@@ -22,30 +23,30 @@
-