bskyweb: basic i18n setup

Uses Cookies, then HTTP Accept-Language, then default, to negotiate
language setting.

The cookie name is 'lang', and the value can be any string which would
be valid in Accept-Language. This includes a trivial 2-char ISO code.

Language setting is returned as 2-char ISO code (though could be
more flexible in the future if needed).

HTML language is configured (attr), and a secondary per-language
scripts.html file is included.

As a hack Makefile generates the scripts_*.html files; typescript build
system will need to populate those appropriately as part of 'make
build-web' to finish integration.
This commit is contained in:
bryan newbold
2023-11-22 14:33:25 -08:00
parent 08333002cc
commit 034e6bdf66
5 changed files with 53 additions and 3 deletions
+7 -2
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, viewport-fit=cover">
@@ -172,6 +172,11 @@
}
</style>
{% include "scripts.html" %}
{% if lang == "en" %}{% include "scripts_en.html" %}{% endif %}
{% if lang == "ja" %}{% include "scripts_ja.html" %}{% endif %}
{% if lang == "pt" %}{% include "scripts_pt.html" %}{% endif %}
{% if lang == "de" %}{% include "scripts_de.html" %}{% endif %}
{% if lang == "hi" %}{% include "scripts_hi.html" %}{% endif %}
<link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png">