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:
1 parent
e7f23ba13f
commit
645816d5a8
168 files changed
+12142
-1422
No files matched your search
@@ -10,6 +10,7 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function targetLabel(e: AuditLogEntry): string {
|
||||
if (!e.targetType) return "—";
|
||||
@@ -73,7 +74,7 @@ export default function AuditLogView() {
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<div className="text-secondary">The table behind the change log: every change made in the app, every sign-in and sign-out, with who did it and from where.</div>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -85,12 +86,12 @@ export default function AuditLogView() {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<AuditLogEntry> label="When" sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AuditLogEntry> label={t("When")} sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AuditLogEntry> label="Actor" sortKeyName="actorLabel" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AuditLogEntry> label="Category" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AuditLogEntry> label="Action" sortKeyName="action" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AuditLogEntry> label="Target" sortKeyName="targetType" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>Details</th>
|
||||
<SortableTh<AuditLogEntry> label={t("Target")} sortKeyName="targetType" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("Details")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { removeWithUndo } from "../utils/undoable";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { EmptyRow } from "../components/EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TYPE_LABELS = { server: "Server", integration: "Integration", device: "Network device", internet: "Internet" } as const;
|
||||
const GROUP_LABELS = { server: "Servers", integration: "Integrations", device: "Network devices", internet: "Internet" } as const;
|
||||
@@ -235,7 +236,7 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
|
||||
<tr>
|
||||
<th>This</th>
|
||||
<th>needs</th>
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -257,7 +258,7 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
|
||||
{canEdit && (
|
||||
<td>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(d)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</td>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const SOURCE_LABELS: Record<string, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -108,7 +109,7 @@ export default function DiagLogView() {
|
||||
<div className="card-body">
|
||||
<div className="row g-2 align-items-end">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Source</label>
|
||||
<label className="form-label">{t("Source")}</label>
|
||||
<select className="form-select" value={filterSource} onChange={(e) => setFilterSource(e.target.value)}>
|
||||
<option value="">All sources</option>
|
||||
{Object.entries(SOURCE_LABELS).map(([value, label]) => (
|
||||
@@ -131,7 +132,7 @@ export default function DiagLogView() {
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,7 +151,7 @@ export default function DiagLogView() {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<DiagLogEntry> label="Time" sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DiagLogEntry> label="Source" sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DiagLogEntry> label={t("Source")} sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DiagLogEntry> label="Operation" sortKeyName="operation" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DiagLogEntry> label="Result" sortKeyName="ok" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DiagLogEntry>
|
||||
@@ -173,7 +174,7 @@ export default function DiagLogView() {
|
||||
<td className="text-secondary">{e.operation}</td>
|
||||
<td>
|
||||
{e.ok ? (
|
||||
<span className="badge bg-green-lt text-green">OK</span>
|
||||
<span className="badge bg-green-lt text-green">{t("OK")}</span>
|
||||
) : (
|
||||
<span className="badge bg-red-lt text-red">Error</span>
|
||||
)}
|
||||
@@ -194,13 +195,13 @@ export default function DiagLogView() {
|
||||
{totalPages > 1 && (
|
||||
<div className="card-footer d-flex align-items-center justify-content-between">
|
||||
<button className="btn btn-outline-secondary" onClick={() => goToPage(page - 1)} disabled={page === 0}>
|
||||
← Prev
|
||||
{t("← Prev")}
|
||||
</button>
|
||||
<span className="text-secondary">
|
||||
Page {page + 1} of {totalPages}
|
||||
</span>
|
||||
<button className="btn btn-outline-secondary" onClick={() => goToPage(page + 1)} disabled={page >= totalPages - 1}>
|
||||
Next →
|
||||
{t("Next →")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
import { EmptyRow } from "../components/EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function statusBadge(d: DomainRecord) {
|
||||
switch (d.status) {
|
||||
@@ -167,7 +168,7 @@ export default function DomainsView({ user }: { user: CurrentUser }) {
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -179,7 +180,7 @@ export default function DomainsView({ user }: { user: CurrentUser }) {
|
||||
<SortableTh<DomainRecord> label="Expires" sortKeyName="expiresAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DomainRecord> label="Registrar" sortKeyName="registrar" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DomainRecord> label="Last checked" sortKeyName="lastCheckedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -220,7 +221,7 @@ export default function DomainsView({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
{d.origin === "manual" && (
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(d)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function friendlyUserAgent(ua: string | null): string {
|
||||
if (!ua) return "—";
|
||||
@@ -103,7 +104,7 @@ export default function SessionsView() {
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<div className="text-secondary">Everyone currently signed in, across every device. Ending a session signs that device out at once.</div>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -115,7 +116,7 @@ export default function SessionsView() {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<SessionSummary> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SessionSummary> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SessionSummary> label="Email" sortKeyName="email" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SessionSummary> label="Role" sortKeyName="role" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SessionSummary> label="IP" sortKeyName="ip" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
@@ -134,7 +135,7 @@ export default function SessionsView() {
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<th className="w-1">Actions</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in new issue
Block a user