i18n on the web - deepseek translations

This commit is contained in:
Priec
2026-08-14 20:35:37 +02:00
parent 2dc0d94ba0
commit 8f1bfdbe0c
91 changed files with 4679 additions and 1237 deletions

View File

@@ -10,7 +10,7 @@
#}
{% extends "ui/base.html" %}
{% block title %}Access{% endblock %}
{% block title %}{{ nav.tr("perm-tab-access") }}{% endblock %}
{% macro apply(role, mode, pairs, label, style, hint) %}
<form hx-post="/permissions/grants/apply" hx-target="#permission-status">
@@ -25,66 +25,66 @@
<main>
<section class="heading">
<div>
<p class="eyebrow">Permissions</p>
<h1>Access</h1>
<p>What a role may do with the data. Everyone holding the role gets exactly this.</p>
<p class="eyebrow">{{ nav.tr("perm-eyebrow") }}</p>
<h1>{{ nav.tr("perm-tab-access") }}</h1>
<p>{{ nav.tr("grants-description") }}</p>
</div>
</section>
{% include "pages/permissions/tabs.html" %}
{% if page.updated %}<p class="notice">Access updated. It applies to the next request every holder of the role makes.</p>{% endif %}
{% if page.updated %}<p class="notice">{{ nav.tr("grants-updated-notice") }}</p>{% endif %}
{% if page.roles.is_empty() %}
<section class="panel">
<h2>No role to edit</h2>
<p class="hint">There is no role here you outrank. <a href="/permissions/roles">Create one</a> first.</p>
<h2>{{ nav.tr("grants-no-role") }}</h2>
<p class="hint">{{ nav.tr("grants-no-role-hint")|safe }}</p>
</section>
{% else %}
<section class="panel">
<h2>Role</h2>
<h2>{{ nav.tr("grants-role-heading") }}</h2>
<form method="get" action="/permissions/grants" class="form-grid">
<label>Editing
<label>{{ nav.tr("grants-editing") }}
<select name="role" onchange="this.form.submit()">
{% for role in page.roles %}
<option value="{{ role.name }}" {% if page.selected(role.name.as_str()) %}selected{% endif %}>{{ role.name }}{% if !role.parent.is_empty() %} → inherits {{ role.parent }}{% endif %}</option>
<option value="{{ role.name }}" {% if page.selected(role.name.as_str()) %}selected{% endif %}>{{ role.name }}{% if !role.parent.is_empty() %} {{ nav.tr("grants-inherits-prefix") }} {{ role.parent }}{% endif %}</option>
{% endfor %}
</select>
</label>
</form>
<p class="hint">
{% if !page.selected_parent.is_empty() %}
<strong>{{ page.selected_role }}</strong> inherits everything <strong>{{ page.selected_parent }}</strong> has. Inherited access shows below but is changed on the parent.
{{ nav.tr_args("grants-inherits-parent", [("role", page.selected_role.clone()), ("parent", page.selected_parent.clone())])|safe }}
{% else %}
<strong>{{ page.selected_role }}</strong> inherits from nothing, so what you see below is all it has.
{{ nav.tr_args("grants-inherits-none", [("role", page.selected_role.clone())])|safe }}
{% endif %}
{% if page.selected_is_structural %}
This role designs the system and may never write row data, so only the read column is open.
{{ nav.tr("grants-structural-hint") }}
{% endif %}
</p>
<h3 class="panel-subhead">Shortcuts</h3>
<p class="hint">These grant the wildcard objects, so they keep covering profiles and tables created later.</p>
<h3 class="panel-subhead">{{ nav.tr("grants-shortcuts") }}</h3>
<p class="hint">{{ nav.tr("grants-shortcuts-hint") }}</p>
<div class="actions shortcut-row">
{% call apply(page.selected_role, "grant", page.everything_read_pairs(), "Read everything", "secondary", "Read on every profile, journal and exchange rate") %}{% endcall %}
{% call apply(page.selected_role, "grant", page.everything_pairs(), "Full access to everything", "secondary", "Every action the role may hold, on every profile") %}{% endcall %}
{% call apply(page.selected_role, "grant", page.everything_read_pairs(), nav.tr("roles-access-read"), "secondary", nav.tr("grants-read-everything-hint")) %}{% endcall %}
{% call apply(page.selected_role, "grant", page.everything_pairs(), nav.tr("grants-full-access-everything"), "secondary", nav.tr("grants-full-everything-hint")) %}{% endcall %}
{% if page.has_direct() %}
{% call apply(page.selected_role, "revoke", page.direct_pairs(), "Remove all access", "danger", "Revoke every grant this role holds directly") %}{% endcall %}
{% call apply(page.selected_role, "revoke", page.direct_pairs(), nav.tr("grants-remove-all-access"), "danger", nav.tr("grants-remove-all-hint")) %}{% endcall %}
{% endif %}
</div>
</section>
{% for group in page.groups %}
<section class="panel">
<h2>{% if group.global %}Everything, everywhere{% else %}Profile: {{ group.title }}{% endif %}<span class="count">{{ group.rows.len() }}</span></h2>
<h2>{% if group.global %}{{ nav.tr("grants-everything-everywhere") }}{% else %}{{ nav.tr("grants-profile-prefix") }} {{ group.title }}{% endif %}<span class="count">{{ group.rows.len() }}</span></h2>
<div class="actions shortcut-row">
{% if group.has_wildcards() %}
{% call apply(page.selected_role, "grant", group.read_pairs(), "Read only", "secondary", "Read on everything in here") %}{% endcall %}
{% call apply(page.selected_role, "grant", group.all_pairs(), "Full access", "secondary", "Every action the role may hold, on everything in here") %}{% endcall %}
{% call apply(page.selected_role, "grant", group.read_pairs(), nav.tr("grants-read-only"), "secondary", nav.tr("grants-read-only-hint")) %}{% endcall %}
{% call apply(page.selected_role, "grant", group.all_pairs(), nav.tr("grants-full-access"), "secondary", nav.tr("grants-full-access-hint")) %}{% endcall %}
{% endif %}
{% if group.has_direct() %}
{% call apply(page.selected_role, "revoke", group.direct_pairs(), "Clear", "danger", "Revoke everything this role holds directly in here") %}{% endcall %}
{% call apply(page.selected_role, "revoke", group.direct_pairs(), nav.tr("grants-clear"), "danger", nav.tr("grants-clear-hint")) %}{% endcall %}
{% endif %}
</div>
@@ -92,9 +92,9 @@
<table class="builder-table grant-matrix">
<thead>
<tr>
<th>Object</th>
<th>{{ nav.tr("grants-th-object") }}</th>
{% for action in page.actions() %}<th>{{ action }}</th>{% endfor %}
<th>Row</th>
<th>{{ nav.tr("grants-th-row") }}</th>
</tr>
</thead>
<tbody>
@@ -108,21 +108,21 @@
{% for cell in row.cells %}
<td class="grant-cell">
{% if !cell.allowed %}
<span class="cell-closed" title="Not available for this role">·</span>
<span class="cell-closed" title="{{ nav.tr("grants-cell-unavailable") }}">·</span>
{% else if cell.direct %}
{% call apply(page.selected_role, "revoke", row.one_pair(cell.action.as_str()), "✓", "cell-on", "Held directly — click to revoke") %}{% endcall %}
{% call apply(page.selected_role, "revoke", row.one_pair(cell.action.as_str()), "✓", "cell-on", nav.tr("grants-cell-direct")) %}{% endcall %}
{% else if cell.inherited %}
<span class="cell-inherited" title="inherited: covered by the parent role or a wider grant"></span>
<span class="cell-inherited" title="{{ nav.tr("grants-cell-inherited") }}"></span>
{% else %}
{% call apply(page.selected_role, "grant", row.one_pair(cell.action.as_str()), "+", "cell-off", "Click to grant") %}{% endcall %}
{% call apply(page.selected_role, "grant", row.one_pair(cell.action.as_str()), "+", "cell-off", nav.tr("grants-cell-grant")) %}{% endcall %}
{% endif %}
</td>
{% endfor %}
<td class="grant-cell">
<div class="actions">
{% call apply(page.selected_role, "grant", row.all_pairs(), "All", "secondary", "Grant every action available on this object") %}{% endcall %}
{% call apply(page.selected_role, "grant", row.all_pairs(), nav.tr("grants-all"), "secondary", nav.tr("grants-all-hint")) %}{% endcall %}
{% if row.has_direct() %}
{% call apply(page.selected_role, "revoke", row.direct_pairs(), "None", "danger", "Revoke this object's direct grants") %}{% endcall %}
{% call apply(page.selected_role, "revoke", row.direct_pairs(), nav.tr("grants-none"), "danger", nav.tr("grants-none-hint")) %}{% endcall %}
{% endif %}
</div>
</td>

View File

@@ -1,75 +1,71 @@
{# GET /permissions/roles — crate::pages::permissions::roles::ui::RolesTemplate #}
{% extends "ui/base.html" %}
{% block title %}Roles{% endblock %}
{% block title %}{{ nav.tr("perm-tab-roles") }}{% endblock %}
{% block content %}
<main>
<section class="heading">
<div>
<p class="eyebrow">Permissions</p>
<h1>Roles</h1>
<p>A role is a named set of permissions. People are given roles; roles are given access.</p>
<p class="eyebrow">{{ nav.tr("perm-eyebrow") }}</p>
<h1>{{ nav.tr("perm-tab-roles") }}</h1>
<p>{{ nav.tr("roles-description") }}</p>
</div>
</section>
{% include "pages/permissions/tabs.html" %}
{% if page.updated %}<p class="notice">Roles updated. Signed-in sessions stay valid and pick up the change on their next request.</p>{% endif %}
{% if page.updated %}<p class="notice">{{ nav.tr("roles-updated-notice") }}</p>{% endif %}
<section class="panel">
<h2>New role</h2>
<p class="hint">
Inheriting from another role starts the new one with everything that role has, and keeps it in step
as that role changes. Starter access is a shortcut for the two common cases; anything narrower is a
few clicks on the Access tab.
</p>
<h2>{{ nav.tr("roles-new-heading") }}</h2>
<p class="hint">{{ nav.tr("roles-new-hint") }}</p>
<form hx-post="/permissions/roles/create" hx-target="#permission-status" class="form-grid">
<label>Name<input name="name" required maxlength="50" placeholder="sales"></label>
<label>Inherits from
<label>{{ nav.tr("roles-name") }}<input name="name" required maxlength="50" placeholder="sales"></label>
<label>{{ nav.tr("roles-inherits-from") }}
<select name="parent">
<option value="">Nothing — starts empty</option>
<option value="">{{ nav.tr("roles-inherits-none") }}</option>
{% for parent in page.parents %}<option value="{{ parent }}">{{ parent }}</option>{% endfor %}
</select>
</label>
<label>Starter access
<label>{{ nav.tr("roles-starter-access") }}
<select name="access">
<option value="none">None — grant it on the Access tab</option>
<option value="read">Read everything</option>
<option value="full">Read and write everything</option>
<option value="none">{{ nav.tr("roles-access-none") }}</option>
<option value="read">{{ nav.tr("roles-access-read") }}</option>
<option value="full">{{ nav.tr("roles-access-full") }}</option>
</select>
</label>
<div class="form-actions"><button type="submit">Create role</button></div>
<div class="form-actions"><button type="submit">{{ nav.tr("roles-create-button") }}</button></div>
</form>
</section>
<section class="panel">
<h2>Existing roles<span class="count">{{ page.roles.len() }}</span></h2>
<h2>{{ nav.tr("roles-existing") }}<span class="count">{{ page.roles.len() }}</span></h2>
<div class="table-scroll">
<table class="builder-table">
<thead><tr><th>Role</th><th>Kind</th><th>Inherits from</th><th>People</th><th>Access</th><th>Remove</th></tr></thead>
<thead><tr><th>{{ nav.tr("roles-th-role") }}</th><th>{{ nav.tr("roles-th-kind") }}</th><th>{{ nav.tr("roles-th-inherits") }}</th><th>{{ nav.tr("roles-th-people") }}</th><th>{{ nav.tr("roles-th-access") }}</th><th>{{ nav.tr("roles-th-remove") }}</th></tr></thead>
<tbody>
{% for role in page.roles %}
<tr>
<td>{{ role.name }}{% if role.built_in %} <span class="tag">built in</span>{% endif %}</td>
<td>{{ role.name }}{% if role.built_in %} <span class="tag">{{ nav.tr("roles-built-in") }}</span>{% endif %}</td>
<td>{{ role.kind }}</td>
<td>{% if role.parent.is_empty() %}<span class="hint"></span>{% else %}{{ role.parent }}{% endif %}</td>
<td>{% match role.users %}{% when Some with (count) %}{{ count }}{% when None %}<span class="hint"></span>{% endmatch %}</td>
<td>
{% if role.editable %}
<a class="link-action" href="/permissions/grants?role={{ role.name }}">Edit access</a>
<a class="link-action" href="/permissions/grants?role={{ role.name }}">{{ nav.tr("roles-edit-access") }}</a>
{% else %}
<span class="hint">outranks you</span>
<span class="hint">{{ nav.tr("perm-role-reason-outranks-you") }}</span>
{% endif %}
</td>
<td>
{% if role.removable() %}
<form hx-post="/permissions/roles/remove" hx-target="#permission-status">
<input type="hidden" name="role" value="{{ role.name }}">
<button type="submit" class="danger">Remove</button>
<button type="submit" class="danger">{{ nav.tr("common-remove") }}</button>
</form>
{% else %}
<span class="hint">{{ role.keeps_reason() }}</span>
<span class="hint">{{ role.keeps_reason(nav.locale) }}</span>
{% endif %}
</td>
</tr>

View File

@@ -7,20 +7,20 @@
someone, and deciding what it may do are three different decisions, and doing
them on one screen was what made the old page hard to read.
#}
<nav class="tabs" aria-label="permission sections">
<nav class="tabs" aria-label="{{ nav.tr("perm-tabs-aria") }}">
{% if page.tabs.can_manage_roles %}
<a href="/permissions/roles" class="tab {% if page.tabs.is("roles") %}selected{% endif %}" {% if page.tabs.is("roles") %}aria-current="page"{% endif %}>
<span>Roles</span><small>Create roles and their inheritance</small>
<span>{{ nav.tr("perm-tab-roles") }}</span><small>{{ nav.tr("perm-tab-roles-sub") }}</small>
</a>
{% endif %}
{% if page.tabs.can_manage_users %}
<a href="/permissions/users" class="tab {% if page.tabs.is("users") %}selected{% endif %}" {% if page.tabs.is("users") %}aria-current="page"{% endif %}>
<span>People</span><small>Give a user a role</small>
<span>{{ nav.tr("perm-tab-people") }}</span><small>{{ nav.tr("perm-tab-people-sub") }}</small>
</a>
{% endif %}
{% if page.tabs.can_manage_roles %}
<a href="/permissions/grants" class="tab {% if page.tabs.is("grants") %}selected{% endif %}" {% if page.tabs.is("grants") %}aria-current="page"{% endif %}>
<span>Access</span><small>What a role may do</small>
<span>{{ nav.tr("perm-tab-access") }}</span><small>{{ nav.tr("perm-tab-access-sub") }}</small>
</a>
{% endif %}
</nav>

View File

@@ -1,30 +1,28 @@
{# GET /permissions/users — crate::pages::permissions::users::ui::UsersTemplate #}
{% extends "ui/base.html" %}
{% block title %}People{% endblock %}
{% block title %}{{ nav.tr("perm-tab-people") }}{% endblock %}
{% block content %}
<main>
<section class="heading">
<div>
<p class="eyebrow">Permissions</p>
<h1>People</h1>
<p>Give a user a role. What that role may do is decided once, on the Access tab.</p>
<p class="eyebrow">{{ nav.tr("perm-eyebrow") }}</p>
<h1>{{ nav.tr("perm-tab-people") }}</h1>
<p>{{ nav.tr("users-description") }}</p>
</div>
</section>
{% include "pages/permissions/tabs.html" %}
{% if page.updated %}<p class="notice">Updated. The person's next request uses the new role; they do not have to sign in again.</p>{% endif %}
{% if page.updated %}<p class="notice">{{ nav.tr("users-updated-notice") }}</p>{% endif %}
<section class="panel">
<h2>Users<span class="count">{{ page.users.len() }}</span></h2>
<p class="hint">
You can only change someone whose role you outrank — {{ page.editable_users() }} of {{ page.users.len() }} here.
</p>
<h2>{{ nav.tr("users-heading") }}<span class="count">{{ page.users.len() }}</span></h2>
<p class="hint">{{ nav.tr_args("users-outrank-hint", [("editable", page.editable_users().to_string()), ("total", page.users.len().to_string())]) }}</p>
<div class="table-scroll">
<table class="builder-table">
<thead><tr><th>User</th><th>Email</th><th>Role</th><th>Change role</th><th>Reset password</th></tr></thead>
<thead><tr><th>{{ nav.tr("users-th-user") }}</th><th>{{ nav.tr("users-th-email") }}</th><th>{{ nav.tr("users-th-role") }}</th><th>{{ nav.tr("users-th-change") }}</th><th>{{ nav.tr("users-th-reset") }}</th></tr></thead>
<tbody>
{% for user in page.users %}
<tr>
@@ -38,19 +36,19 @@
<select name="role">
{% for role in page.roles %}<option value="{{ role }}" {% if user.role == role.as_str() %}selected{% endif %}>{{ role }}</option>{% endfor %}
</select>
<button type="submit">Assign</button>
<button type="submit">{{ nav.tr("users-assign") }}</button>
</form>
</td>
<td>
<form hx-post="/permissions/users/password" hx-target="#permission-status" class="actions">
<input type="hidden" name="username" value="{{ user.username }}">
<input name="new_password" type="password" autocomplete="new-password" placeholder="New password" required>
<input name="new_password_confirmation" type="password" autocomplete="new-password" placeholder="Confirm" required>
<button type="submit">Reset</button>
<input name="new_password" type="password" autocomplete="new-password" placeholder="{{ nav.tr("field-new-password") }}" required>
<input name="new_password_confirmation" type="password" autocomplete="new-password" placeholder="{{ nav.tr("users-confirm") }}" required>
<button type="submit">{{ nav.tr("users-reset") }}</button>
</form>
</td>
{% else %}
<td colspan="2"><span class="hint">outranks you</span></td>
<td colspan="2"><span class="hint">{{ nav.tr("perm-role-reason-outranks-you") }}</span></td>
{% endif %}
</tr>
{% endfor %}