web: initial migration to lingui

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-04-03 19:26:43 +02:00
parent fc1caf1469
commit 25300c1928
150 changed files with 8720 additions and 1482 deletions

View File

@ -1,5 +1,5 @@
import { AdminApi, EventMatcherPolicy, EventsApi, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,18 +56,18 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Action")}
label=${t`Action`}
name="action">
<select class="pf-c-form-control">
<option value="" ?selected=${this.policy?.action === undefined}>---------</option>
@ -77,16 +77,16 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
});
}))}
</select>
<p class="pf-c-form__helper-text">${gettext("Match created events with this action type. When left empty, all action types will be matched.")}</p>
<p class="pf-c-form__helper-text">${t`Match created events with this action type. When left empty, all action types will be matched.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Client IP")}
label=${t`Client IP`}
name="clientIp">
<input type="text" value="${ifDefined(this.policy?.clientIp || "")}" class="pf-c-form-control">
<p class="pf-c-form__helper-text">${gettext("Matches Event's Client IP (strict matching, for network matching use an Expression Policy.")}</p>
<p class="pf-c-form__helper-text">${t`Matches Event's Client IP (strict matching, for network matching use an Expression Policy.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("App")}
label=${t`App`}
name="app">
<select class="pf-c-form-control">
<option value="" ?selected=${this.policy?.app === undefined}>---------</option>
@ -96,7 +96,7 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
});
}))}
</select>
<p class="pf-c-form__helper-text">${gettext("Match events created by selected application. When left empty, all applications are matched.")}</p>
<p class="pf-c-form__helper-text">${t`Match events created by selected application. When left empty, all applications are matched.`}</p>
</ak-form-element-horizontal>
</div>
</ak-form-group>