feat(api): localize console pages and api error messages
The language comes from the user setting, then the lang cookie, then Accept-Language, falling back to English. Errors keep a stable code and carry a translated message. Closes #42 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
dde7b890b8
commit
70190446ff
12 files changed
+698
-211
No files matched your search
@@ -8,7 +8,7 @@
|
||||
window.api = api;
|
||||
|
||||
const message = (err) =>
|
||||
err.response?.data?.message ?? "Verbindung fehlgeschlagen.";
|
||||
err.response?.data?.message ?? document.body.dataset.msgNetwork;
|
||||
|
||||
const showError = (form, text) => {
|
||||
const el = form.querySelector("[data-error]");
|
||||
@@ -50,6 +50,12 @@
|
||||
});
|
||||
|
||||
document.addEventListener("click", async (ev) => {
|
||||
const locale = ev.target.closest("[data-locale]");
|
||||
if (locale) {
|
||||
await api.post("/locale", { locale: locale.dataset.locale }).catch(() => {});
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
if (ev.target.closest("[data-logout]")) {
|
||||
await api.post("/auth/logout").catch(() => {});
|
||||
location.assign("/login");
|
||||
|
||||
Reference in new issue
Block a user