Add a Swedish interface with a per-person language switch

A small translation system (the English text is its own key, so anything
without a Swedish entry stays English) and a Language switch in the user menu,
saved on the account (users.language) and following the browser when no choice
has been made. Swedish covers the menu, shared parts (search, tables, dialogs,
relative times), the sign-in page and the everyday pages: Dashboard, Alerts,
Servers, Updates, Maintenance, My work, Coming up, To do, Integrations and the
display settings. Server-written messages stay English for now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-12 21:49:49 +01:00
1 parent e7f23ba13f
commit 645816d5a8
168 files changed
+12142 -1422

No files matched your search

+20 -19
View File
@@ -9,6 +9,7 @@ import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../../components/EmptyState";
import WebhookDeliveries from "./WebhookDeliveries";
import { t } from "../../i18n";
const EVENT_WORDS: Record<WebhookEventName, string> = {
"alert.opened": "A problem begins",
@@ -74,10 +75,10 @@ export default function ApiSettings() {
}
}
async function removeToken(t: MetricsToken) {
if (!(await confirmDialog({ title: "Remove metrics token", message: `Remove "${t.label}"? Whatever scrapes with it stops working at once.`, confirmLabel: "Remove", danger: true }))) return;
async function removeToken(item_: MetricsToken) {
if (!(await confirmDialog({ title: "Remove metrics token", message: `Remove "${item_.label}"? Whatever scrapes with it stops working at once.`, confirmLabel: "Remove", danger: true }))) return;
try {
await api.metricsTokens.remove(t.id);
await api.metricsTokens.remove(item_.id);
load();
} catch (err) {
setError(readableError(err));
@@ -179,7 +180,7 @@ export default function ApiSettings() {
- targets: ["${window.location.host}"]`}
</pre>
<button className="btn btn-sm" onClick={() => setNewSecret(null)}>
Done
{t("Done")}
</button>
</div>
)}
@@ -193,25 +194,25 @@ export default function ApiSettings() {
<table className="table table-vcenter">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Made</th>
<th>Last used</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
{tokens?.map((t) => (
<tr key={t.id}>
{tokens?.map((item_) => (
<tr key={item_.id}>
<td>
{t.label} <span className="text-secondary small">{t.tokenPrefix}…</span>
{item_.label} <span className="text-secondary small">{item_.tokenPrefix}…</span>
</td>
<td className="text-secondary">
{t.createdBy ?? "—"}, <TimeAgo value={t.createdAt} fromDb />
{item_.createdBy ?? "—"}, <TimeAgo value={item_.createdAt} fromDb />
</td>
<td className="text-secondary">{t.lastUsedAt ? <TimeAgo value={t.lastUsedAt} /> : "Never"}</td>
<td className="text-secondary">{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : "Never"}</td>
<td>
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeToken(t)}>
Remove
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeToken(item_)}>
{t("Remove")}
</button>
</td>
</tr>
@@ -248,7 +249,7 @@ export default function ApiSettings() {
<div className="row g-3">
<div className="col-md-4">
<label className="form-label" htmlFor="wh-label">
Name
{t("Name")}
</label>
<input id="wh-label" className="form-control" required maxLength={60} placeholder="Home Assistant" value={hookLabel} onChange={(e) => setHookLabel(e.target.value)} />
</div>
@@ -293,7 +294,7 @@ export default function ApiSettings() {
{busy ? "Adding…" : "Add"}
</button>
<button type="button" className="btn" onClick={() => setAdding(false)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -302,10 +303,10 @@ export default function ApiSettings() {
<table className="table table-vcenter">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Sends</th>
<th>Last</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -336,7 +337,7 @@ export default function ApiSettings() {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={() => void testHook(h)}>
Test
{t("Test")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => setLogOf(h)}>
Sent
@@ -345,7 +346,7 @@ export default function ApiSettings() {
{h.enabled ? "Turn off" : "Turn on"}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeHook(h)}>
Remove
{t("Remove")}
</button>
</div>
</td>