Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLeitwolf112026-10-16 06:05:28 +0300
committerLeitwolf112026-10-16 06:05:28 +0300
commit3c3c9b10e1ccf218831789bcc59d488200ed12c6 (patch)
tree2fd10afca40f933ee2f8af6869d11bc182e76eda
parent0b4634261957c81626cf134d3126ae3d3a04735a (diff)
downloadwebsite-3c3c9b10e1ccf218831789bcc59d488200ed12c6.tar.gz
Correct stale statements on tala.run and rename the vxs storage keys
An audit of the site against the compiler repository found statements that no longer hold, in all four languages: - the overview named BUILD.kts as the project definition, while Tazel reads one of five names; it now says a project file, BUILD.kts or one of four other names; - the overview and the getting-started guide named Windows and macOS as the only development hosts. Ubuntu 26.04 LTS and Fedora 43 are official hosts too, and the guide says which toolchain they use; - the getting-started guide listed the counterparts of the examples in C#, C++ and Java; the examples also have Rust ones; - the project-file page wrote build/debug/Example without the .exe a Windows build has. The talac, Tazel and syntax pages were checked against Documents/CLI.md, Documents/PROJECT_FILES.md and Spec/Language and are otherwise accurate. Of the 43 links in the repository, only the address inside the Fira Sans licence text no longer answers; that text is third-party and verbatim. The browser storage keys still carried the former name of the language: vxs-locale-choice, vxs-theme and vxs-forum-theme become tala-locale-choice, tala-theme and tala-forum-theme. A value under a former key moves to the current one on the first page load, so no visitor loses a choice; a forum test covers the move. The npm package is renamed from @visual-xsharp/website to @progmasoft/tala-website, and the forum assets get a new version query so Cloudflare serves the new script.
-rw-r--r--Documents/LOCALIZATION.md8
-rw-r--r--forum/index.html4
-rw-r--r--forum/site.js12
-rw-r--r--frontend/package-lock.json4
-rw-r--r--frontend/package.json2
-rw-r--r--frontend/src/content/tazel.ts8
-rw-r--r--frontend/src/pages/GettingStartedPage.vue24
-rw-r--r--frontend/src/pages/OverviewPage.vue19
-rw-r--r--frontend/src/preferences.ts19
-rw-r--r--frontend/tests/forum.test.mjs16
10 files changed, 77 insertions, 39 deletions
diff --git a/Documents/LOCALIZATION.md b/Documents/LOCALIZATION.md
index e139050..f78d09e 100644
--- a/Documents/LOCALIZATION.md
+++ b/Documents/LOCALIZATION.md
@@ -18,7 +18,7 @@ A page has one URL in every language. The language is a preference kept in the b
The rules are pure functions in `frontend/src/locales.ts`:
-1. **The visitor's choice.** A language stored under `vxs-locale-choice` in local storage always wins.
+1. **The visitor's choice.** A language stored under `tala-locale-choice` in local storage always wins.
2. **The browser.** Without a stored choice, the first entry of `navigator.languages` whose primary language is
published is used. `de-AT` selects German, and `iw`, the former code for Hebrew, selects Hebrew.
3. **The fallback.** A browser that prefers no published language gets `en-US`.
@@ -44,11 +44,15 @@ A language becomes the stored choice only when a visitor changes it in the menu.
Earlier versions wrote the language under `vxs-locale` on every visit, which made a real choice indistinguishable
from the former English default. That key is no longer read.
+The keys once carried the former name of the language: `vxs-locale-choice`, `vxs-theme` and `vxs-forum-theme`. A
+value stored under one of them moves to `tala-locale-choice`, `tala-theme` or `tala-forum-theme` the first time a page
+loads, and the former key is removed.
+
## The forum page
The forum notice has no language menu. `forum/site.js` shows its one notice in the first browser language that has a
translation and in English otherwise, and stores nothing about language. It keeps its own theme key,
-`vxs-forum-theme`.
+`tala-forum-theme`.
## Hebrew and text direction
diff --git a/forum/index.html b/forum/index.html
index f64722a..95f2dc0 100644
--- a/forum/index.html
+++ b/forum/index.html
@@ -8,9 +8,9 @@
<meta name="robots" content="noindex, nofollow" />
<meta name="theme-color" content="#11101a" />
<link rel="icon" type="image/svg+xml" href="/tala-mark.svg" />
- <link rel="stylesheet" href="/site.css?v=2026-10-15" />
+ <link rel="stylesheet" href="/site.css?v=2026-10-16" />
<title>The forum isn't open yet. · Tala</title>
- <script src="/site.js?v=2026-10-15" defer></script>
+ <script src="/site.js?v=2026-10-16" defer></script>
</head>
<body>
<header>
diff --git a/forum/site.js b/forum/site.js
index c641a86..2342110 100644
--- a/forum/site.js
+++ b/forum/site.js
@@ -69,11 +69,19 @@ function renderLanguage() {
themeButton.setAttribute("aria-label", selected.themeLabel);
}
+// The key carried the former name of the language; a stored theme moves to
+// the current key once.
+const themeKey = "tala-forum-theme";
+const formerTheme = localStorage.getItem("vxs-forum-theme");
+if (formerTheme !== null && localStorage.getItem(themeKey) === null) {
+ localStorage.setItem(themeKey, formerTheme);
+}
+localStorage.removeItem("vxs-forum-theme");
document.documentElement.dataset.theme =
- localStorage.getItem("vxs-forum-theme") === "light" ? "light" : "dark";
+ localStorage.getItem(themeKey) === "light" ? "light" : "dark";
themeButton.addEventListener("click", () => {
const next = document.documentElement.dataset.theme === "dark" ? "light" : "dark";
document.documentElement.dataset.theme = next;
- localStorage.setItem("vxs-forum-theme", next);
+ localStorage.setItem(themeKey, next);
});
renderLanguage();
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 7109f7e..32fbef4 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,11 +1,11 @@
{
- "name": "@visual-xsharp/website",
+ "name": "@progmasoft/tala-website",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "@visual-xsharp/website",
+ "name": "@progmasoft/tala-website",
"version": "1.0.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
diff --git a/frontend/package.json b/frontend/package.json
index 8ab4207..bbee868 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,5 +1,5 @@
{
- "name": "@visual-xsharp/website",
+ "name": "@progmasoft/tala-website",
"version": "1.0.0",
"private": true,
"type": "module",
diff --git a/frontend/src/content/tazel.ts b/frontend/src/content/tazel.ts
index 0b32f14..a69e4a0 100644
--- a/frontend/src/content/tazel.ts
+++ b/frontend/src/content/tazel.ts
@@ -302,7 +302,7 @@ const projectFile: DocTopic = {
{ kind: "code", code: minimal },
{
kind: "text",
- text: "This compiles every .tala file below Sources/ and writes build/debug/Example. entry names a class by its namespace; that class provides the parameterless public static void Main(). Neither file names nor directories have to mirror namespaces.",
+ text: "This compiles every .tala file below Sources/ and writes build/debug/Example (Example.exe on Windows). entry names a class by its namespace; that class provides the parameterless public static void Main(). Neither file names nor directories have to mirror namespaces.",
},
{ kind: "heading", text: "Compiler settings" },
{
@@ -345,7 +345,7 @@ const projectFile: DocTopic = {
{ kind: "code", code: minimal },
{
kind: "text",
- text: "Das kompiliert jede .tala-Datei unter Sources/ und schreibt build/debug/Example. entry benennt eine Klasse mit ihrem Namespace; diese Klasse stellt das parameterlose public static void Main() bereit. Weder Dateinamen noch Verzeichnisse müssen Namespaces abbilden.",
+ text: "Das kompiliert jede .tala-Datei unter Sources/ und schreibt build/debug/Example (unter Windows Example.exe). entry benennt eine Klasse mit ihrem Namespace; diese Klasse stellt das parameterlose public static void Main() bereit. Weder Dateinamen noch Verzeichnisse müssen Namespaces abbilden.",
},
{ kind: "heading", text: "Compiler-Einstellungen" },
{
@@ -388,7 +388,7 @@ const projectFile: DocTopic = {
{ kind: "code", code: minimal },
{
kind: "text",
- text: "Так компилируется каждый .tala-файл в Sources/ и записывается build/debug/Example. entry называет класс вместе с его пространством имён; этот класс содержит public static void Main() без параметров. Ни имена файлов, ни каталоги не обязаны повторять пространства имён.",
+ text: "Так компилируется каждый .tala-файл в Sources/ и записывается build/debug/Example (в Windows — Example.exe). entry называет класс вместе с его пространством имён; этот класс содержит public static void Main() без параметров. Ни имена файлов, ни каталоги не обязаны повторять пространства имён.",
},
{ kind: "heading", text: "Настройки компилятора" },
{
@@ -431,7 +431,7 @@ const projectFile: DocTopic = {
{ kind: "code", code: minimal },
{
kind: "text",
- text: "כך מהודר כל קובץ ‎.tala שתחת Sources/‎ ונכתב build/debug/Example. ‏entry מציין מחלקה יחד עם מרחב השמות שלה; המחלקה הזו מספקת את public static void Main() ללא פרמטרים. לא שמות הקבצים ולא התיקיות צריכים לשקף את מרחבי השמות.",
+ text: "כך מהודר כל קובץ ‎.tala שתחת Sources/‎ ונכתב build/debug/Example (ב-Windows‏ Example.exe). ‏entry מציין מחלקה יחד עם מרחב השמות שלה; המחלקה הזו מספקת את public static void Main() ללא פרמטרים. לא שמות הקבצים ולא התיקיות צריכים לשקף את מרחבי השמות.",
},
{ kind: "heading", text: "הגדרות המהדר" },
{
diff --git a/frontend/src/pages/GettingStartedPage.vue b/frontend/src/pages/GettingStartedPage.vue
index 5a71eed..f4a4519 100644
--- a/frontend/src/pages/GettingStartedPage.vue
+++ b/frontend/src/pages/GettingStartedPage.vue
@@ -15,12 +15,12 @@ const text = {
lead: "Tala is in active development. For now, the repository is the reliable entry point for building the compiler and checking which language features run end to end.",
step1: "1. Get the repository",
step1Text:
- "Clone the compiler repository with its submodules. Use a supported Windows 10/11 or recent macOS development host.",
+ "Clone the compiler repository with its submodules. Use a supported development host: Windows 10/11, macOS Sequoia or Tahoe, Ubuntu 26.04 LTS or Fedora 43.",
step2: "2. Check the toolchain",
step2Text:
"The repository's Go development command checks local requirements. The compiler uses GHC2024 for its Haskell front end, Clang/LLVM for C++20 native stages, Bazel for native builds, and Temurin JDK 25 for Tazel, the build system.",
platform:
- "The supported development hosts are Windows 10/11 and macOS Sequoia/Tahoe. On Windows, standalone LLVM clang-cl and LLD are used with Windows SDK and MSVC CRT/STL libraries. On macOS, install the Xcode Command Line Tools; the full Xcode application is not required.",
+ "The supported development hosts are Windows 10/11, macOS Sequoia/Tahoe, Ubuntu 26.04 LTS and Fedora 43. On Windows, standalone LLVM clang-cl and LLD are used with Windows SDK and MSVC CRT/STL libraries. On macOS, install the Xcode Command Line Tools; the full Xcode application is not required. On Ubuntu and Fedora, Clang, LLD and the LLVM development packages of the distribution are used.",
toolchainHelp:
"If the check reports missing tools, the optional bootstrap can install prerequisites through the host package manager. Open a new terminal afterward so PATH changes take effect. LLVM_ROOT may point to the LLVM development installation prefix; do not put a machine-specific path in project files.",
bootstrap: "Optional host bootstrap",
@@ -55,7 +55,7 @@ const text = {
},
{
title: "Example programs",
- detail: "Source examples next to C# 13, C++20, and Java 21 counterparts.",
+ detail: "Source examples next to C# 13, C++20, Java 21 and Rust counterparts.",
href: "https://github.com/Progmasoft/tala/tree/main/Examples",
},
],
@@ -74,12 +74,12 @@ const text = {
lead: "Tala wird aktiv entwickelt. Das Repository ist derzeit der zuverlässige Einstieg, um den Compiler zu bauen und den tatsächlich funktionierenden Sprachumfang zu prüfen.",
step1: "1. Repository holen",
step1Text:
- "Klonen Sie das Compiler-Repository mit seinen Submodulen. Unterstützt werden Windows 10/11 und aktuelle macOS-Entwicklungsrechner.",
+ "Klonen Sie das Compiler-Repository mit seinen Submodulen. Unterstützt werden Entwicklungsrechner mit Windows 10/11, macOS Sequoia oder Tahoe, Ubuntu 26.04 LTS oder Fedora 43.",
step2: "2. Toolchain prüfen",
step2Text:
"Der Go-Entwicklungsbefehl prüft lokale Voraussetzungen. Das Frontend verwendet GHC2024, die nativen C++20-Stufen Clang/LLVM und Bazel; Tazel, das Build-System, nutzt Temurin JDK 25.",
platform:
- "Unterstützte Entwicklungsrechner sind Windows 10/11 und macOS Sequoia/Tahoe. Unter Windows werden eigenständiges LLVM clang-cl und LLD mit Windows SDK sowie MSVC-CRT/STL-Bibliotheken verwendet. Unter macOS genügen die Xcode Command Line Tools; die vollständige Xcode-Anwendung ist nicht erforderlich.",
+ "Unterstützte Entwicklungsrechner sind Windows 10/11, macOS Sequoia/Tahoe, Ubuntu 26.04 LTS und Fedora 43. Unter Windows werden eigenständiges LLVM clang-cl und LLD mit Windows SDK sowie MSVC-CRT/STL-Bibliotheken verwendet. Unter macOS genügen die Xcode Command Line Tools; die vollständige Xcode-Anwendung ist nicht erforderlich. Unter Ubuntu und Fedora werden Clang, LLD und die LLVM-Entwicklungspakete der Distribution verwendet.",
toolchainHelp:
"Falls Werkzeuge fehlen, kann der optionale Bootstrap die Voraussetzungen über den Paketmanager installieren. Öffnen Sie danach ein neues Terminal, damit PATH-Änderungen greifen. LLVM_ROOT darf auf das LLVM-Entwicklungspaket zeigen; schreiben Sie keinen rechnerbezogenen Pfad in Projektdateien.",
bootstrap: "Optionaler Host-Bootstrap",
@@ -114,7 +114,7 @@ const text = {
},
{
title: "Beispielprogramme",
- detail: "Beispiele neben Fassungen in C# 13, C++20 und Java 21.",
+ detail: "Beispiele neben Fassungen in C# 13, C++20, Java 21 und Rust.",
href: "https://github.com/Progmasoft/tala/tree/main/Examples",
},
],
@@ -133,12 +133,12 @@ const text = {
lead: "Tala находится в активной разработке. Пока что репозиторий — надёжная отправная точка, чтобы собрать компилятор и проверить, какие возможности языка работают от начала до конца.",
step1: "1. Получите репозиторий",
step1Text:
- "Клонируйте репозиторий компилятора вместе с подмодулями. Используйте поддерживаемую машину разработки с Windows 10/11 или актуальной macOS.",
+ "Клонируйте репозиторий компилятора вместе с подмодулями. Используйте поддерживаемую машину разработки: Windows 10/11, macOS Sequoia или Tahoe, Ubuntu 26.04 LTS или Fedora 43.",
step2: "2. Проверьте набор инструментов",
step2Text:
"Команда разработки на Go из репозитория проверяет локальные требования. Компилятор использует GHC2024 для фронтенда на Haskell, Clang/LLVM для нативных стадий на C++20, Bazel для нативных сборок и Temurin JDK 25 для Tazel, системы сборки.",
platform:
- "Поддерживаемые машины разработки — Windows 10/11 и macOS Sequoia/Tahoe. В Windows используются отдельные LLVM clang-cl и LLD вместе с Windows SDK и библиотеками MSVC CRT/STL. В macOS установите Xcode Command Line Tools; полное приложение Xcode не требуется.",
+ "Поддерживаемые машины разработки — Windows 10/11, macOS Sequoia/Tahoe, Ubuntu 26.04 LTS и Fedora 43. В Windows используются отдельные LLVM clang-cl и LLD вместе с Windows SDK и библиотеками MSVC CRT/STL. В macOS установите Xcode Command Line Tools; полное приложение Xcode не требуется. В Ubuntu и Fedora используются Clang, LLD и пакеты разработки LLVM из дистрибутива.",
toolchainHelp:
"Если проверка сообщает об отсутствующих инструментах, необязательная начальная настройка может установить их через менеджер пакетов системы. После этого откройте новый терминал, чтобы изменения PATH вступили в силу. LLVM_ROOT может указывать на каталог установки LLVM для разработки; не записывайте путь, относящийся к конкретной машине, в файлы проекта.",
bootstrap: "Необязательная начальная настройка системы",
@@ -173,7 +173,7 @@ const text = {
},
{
title: "Примеры программ",
- detail: "Примеры исходного кода рядом с вариантами на C# 13, C++20 и Java 21.",
+ detail: "Примеры исходного кода рядом с вариантами на C# 13, C++20, Java 21 и Rust.",
href: "https://github.com/Progmasoft/tala/tree/main/Examples",
},
],
@@ -192,12 +192,12 @@ const text = {
lead: "Tala נמצאת בפיתוח פעיל. לעת עתה המאגר הוא נקודת הכניסה האמינה לבניית המהדר ולבדיקה אילו יכולות של השפה פועלות מקצה לקצה.",
step1: "1. השגת המאגר",
step1Text:
- "שכפלו את מאגר המהדר יחד עם תת־המודולים שלו. השתמשו במחשב פיתוח נתמך עם Windows 10/11 או עם גרסה עדכנית של macOS.",
+ "שכפלו את מאגר המהדר יחד עם תת־המודולים שלו. השתמשו במחשב פיתוח נתמך: Windows 10/11, ‏macOS Sequoia או Tahoe, ‏Ubuntu 26.04 LTS או Fedora 43.",
step2: "2. בדיקת שרשרת הכלים",
step2Text:
"פקודת הפיתוח של המאגר, הכתובה ב-Go, בודקת את הדרישות המקומיות. המהדר משתמש ב-GHC2024 ל-frontend הכתוב ב-Haskell, ב-Clang/LLVM לשלבי ה-native ב-C++20, ב-Bazel לבניית חלקי ה-native וב-Temurin JDK 25 ל-Tazel, מערכת הבנייה.",
platform:
- "מחשבי הפיתוח הנתמכים הם Windows 10/11 ו-macOS Sequoia/Tahoe. ב-Windows נעשה שימוש ב-clang-cl וב-LLD עצמאיים של LLVM יחד עם Windows SDK וספריות ה-CRT/STL של MSVC. ב-macOS יש להתקין את Xcode Command Line Tools; יישום Xcode המלא אינו נדרש.",
+ "מחשבי הפיתוח הנתמכים הם Windows 10/11, ‏macOS Sequoia/Tahoe, ‏Ubuntu 26.04 LTS ו-Fedora 43. ב-Windows נעשה שימוש ב-clang-cl וב-LLD עצמאיים של LLVM יחד עם Windows SDK וספריות ה-CRT/STL של MSVC. ב-macOS יש להתקין את Xcode Command Line Tools; יישום Xcode המלא אינו נדרש. ב-Ubuntu וב-Fedora נעשה שימוש ב-Clang, ב-LLD ובחבילות הפיתוח של LLVM מההפצה.",
toolchainHelp:
"אם הבדיקה מדווחת על כלים חסרים, ה-bootstrap האופציונלי יכול להתקין את הדרישות דרך מנהל החבילות של המערכת. לאחר מכן פתחו מסוף חדש כדי ששינויי PATH ייכנסו לתוקף. LLVM_ROOT יכול להצביע על תחילית ההתקנה של חבילת הפיתוח של LLVM; אין לכתוב נתיב ייחודי למחשב בקובצי הפרויקט.",
bootstrap: "הכנת מחשב אופציונלית",
@@ -232,7 +232,7 @@ const text = {
},
{
title: "תוכניות לדוגמה",
- detail: "דוגמאות קוד לצד מקבילות ב-C#‎ 13, ב-C++20 וב-Java 21.",
+ detail: "דוגמאות קוד לצד מקבילות ב-C#‎ 13, ב-C++20, ב-Java 21 וב-Rust.",
href: "https://github.com/Progmasoft/tala/tree/main/Examples",
},
],
diff --git a/frontend/src/pages/OverviewPage.vue b/frontend/src/pages/OverviewPage.vue
index 32b49ba..2c4ccf0 100644
--- a/frontend/src/pages/OverviewPage.vue
+++ b/frontend/src/pages/OverviewPage.vue
@@ -72,7 +72,8 @@ const text = {
},
{
label: "Project definition",
- value: "BUILD.kts, evaluated by Tazel, the build system",
+ value:
+ "A project file, BUILD.kts or one of four other names, evaluated by Tazel, the build system",
},
{
label: "Website",
@@ -95,7 +96,7 @@ const text = {
},
{
q: "Does Tala require a particular IDE?",
- a: "No. The supported developer workflow uses command-line tools on Windows and macOS; the Xide project is a future interface, not a prerequisite.",
+ a: "No. The supported developer workflow uses command-line tools on Windows, macOS and Linux; the Xide project is a future interface, not a prerequisite.",
},
],
items: [
@@ -187,7 +188,8 @@ const text = {
},
{
label: "Projektdefinition",
- value: "BUILD.kts, ausgewertet von Tazel, dem Build-System",
+ value:
+ "Eine Projektdatei, BUILD.kts oder einer von vier weiteren Namen, ausgewertet von Tazel, dem Build-System",
},
{
label: "Website",
@@ -210,7 +212,7 @@ const text = {
},
{
q: "Benötigt Tala eine bestimmte IDE?",
- a: "Nein. Der unterstützte Entwicklungsweg nutzt Kommandozeilenwerkzeuge unter Windows und macOS; Xide ist eine künftige Oberfläche, keine Voraussetzung.",
+ a: "Nein. Der unterstützte Entwicklungsweg nutzt Kommandozeilenwerkzeuge unter Windows, macOS und Linux; Xide ist eine künftige Oberfläche, keine Voraussetzung.",
},
],
items: [
@@ -302,7 +304,8 @@ const text = {
},
{
label: "Описание проекта",
- value: "BUILD.kts, который выполняет Tazel, система сборки",
+ value:
+ "Файл проекта — BUILD.kts или одно из четырёх других имён, — который выполняет Tazel, система сборки",
},
{
label: "Сайт",
@@ -325,7 +328,7 @@ const text = {
},
{
q: "Нужна ли для Tala определённая IDE?",
- a: "Нет. Поддерживаемый процесс разработки использует инструменты командной строки в Windows и macOS; проект Xide — будущий интерфейс, а не обязательное условие.",
+ a: "Нет. Поддерживаемый процесс разработки использует инструменты командной строки в Windows, macOS и Linux; проект Xide — будущий интерфейс, а не обязательное условие.",
},
],
items: [
@@ -417,7 +420,7 @@ const text = {
},
{
label: "הגדרת הפרויקט",
- value: "BUILD.kts, ש-Tazel, מערכת הבנייה, מריצה",
+ value: "קובץ פרויקט, BUILD.kts או אחד מארבעה שמות אחרים, ש-Tazel, מערכת הבנייה, מריצה",
},
{
label: "האתר",
@@ -440,7 +443,7 @@ const text = {
},
{
q: "האם Tala דורשת סביבת פיתוח מסוימת?",
- a: "לא. תהליך הפיתוח הנתמך משתמש בכלי שורת פקודה ב-Windows וב-macOS; הפרויקט Xide הוא ממשק עתידי, לא דרישה מוקדמת.",
+ a: "לא. תהליך הפיתוח הנתמך משתמש בכלי שורת פקודה ב-Windows, ב-macOS וב-Linux; הפרויקט Xide הוא ממשק עתידי, לא דרישה מוקדמת.",
},
],
items: [
diff --git a/frontend/src/preferences.ts b/frontend/src/preferences.ts
index a809bab..59b8d0d 100644
--- a/frontend/src/preferences.ts
+++ b/frontend/src/preferences.ts
@@ -16,10 +16,23 @@ export type Theme = "dark" | "light";
// Holds a language only after the visitor picked one in the menu. The earlier
// `vxs-locale` key was written on every visit, so it cannot tell a choice
// from the former English default and is no longer read.
-const localeChoiceKey = "vxs-locale-choice";
+const localeChoiceKey = "tala-locale-choice";
+const themeKey = "tala-theme";
+
+// The keys carried the former name of the language. A value stored under the
+// former key moves to the current one once, so no visitor loses a choice.
+function migrate(key: string, former: string): void {
+ const value = localStorage.getItem(former);
+ if (value !== null && localStorage.getItem(key) === null) {
+ localStorage.setItem(key, value);
+ }
+ localStorage.removeItem(former);
+}
+migrate(localeChoiceKey, "vxs-locale-choice");
+migrate(themeKey, "vxs-theme");
function storedTheme(): Theme {
- return localStorage.getItem("vxs-theme") === "light" ? "light" : "dark";
+ return localStorage.getItem(themeKey) === "light" ? "light" : "dark";
}
export const locale = ref<Locale>(
@@ -49,7 +62,7 @@ watch(
theme,
(value) => {
document.documentElement.dataset.theme = value;
- localStorage.setItem("vxs-theme", value);
+ localStorage.setItem(themeKey, value);
},
{ immediate: true },
);
diff --git a/frontend/tests/forum.test.mjs b/frontend/tests/forum.test.mjs
index 5a78ed5..e66bc2c 100644
--- a/frontend/tests/forum.test.mjs
+++ b/frontend/tests/forum.test.mjs
@@ -43,6 +43,9 @@ function loadForum(navigator = { languages: ["en-US"] }, initialStorage = {}) {
setItem(key, value) {
values.set(key, value);
},
+ removeItem(key) {
+ values.delete(key);
+ },
};
const document = {
title: "",
@@ -116,16 +119,23 @@ test("forum has no language menu and ignores a language stored by an older page"
});
test("forum restores the saved light preference", () => {
- const { document } = loadForum({ languages: ["en"] }, { "vxs-forum-theme": "light" });
+ const { document } = loadForum({ languages: ["en"] }, { "tala-forum-theme": "light" });
+ assert.equal(document.documentElement.dataset.theme, "light");
+});
+
+test("forum moves a theme saved under the former key to the current one", () => {
+ const { document, values } = loadForum({ languages: ["en"] }, { "vxs-forum-theme": "light" });
assert.equal(document.documentElement.dataset.theme, "light");
+ assert.equal(values.get("tala-forum-theme"), "light");
+ assert.equal(values.has("vxs-forum-theme"), false);
});
test("forum theme button toggles and persists in both directions", () => {
const { document, elements, values } = loadForum();
elements.get("theme").click();
assert.equal(document.documentElement.dataset.theme, "light");
- assert.equal(values.get("vxs-forum-theme"), "light");
+ assert.equal(values.get("tala-forum-theme"), "light");
elements.get("theme").click();
assert.equal(document.documentElement.dataset.theme, "dark");
- assert.equal(values.get("vxs-forum-theme"), "dark");
+ assert.equal(values.get("tala-forum-theme"), "dark");
});