Skip to content

Commit 5120124

Browse files
cicnavitvdijen
andauthored
Update translations (#285)
* Start with text message IDs * Update translations * Fix some of the Dutch translations * Add Croatian language * Add es, fr, it langs back as empty translation files --------- Co-authored-by: Tim van Dijen <[email protected]>
1 parent d3cdf5f commit 5120124

File tree

16 files changed

+3244
-572
lines changed

16 files changed

+3244
-572
lines changed

locales/en/LC_MESSAGES/oidc.po

+496-149
Large diffs are not rendered by default.

locales/es/LC_MESSAGES/oidc.po

+520-94
Large diffs are not rendered by default.

locales/fr/LC_MESSAGES/oidc.po

+508-134
Large diffs are not rendered by default.

locales/hr/LC_MESSAGES/oidc.po

+614
Large diffs are not rendered by default.

locales/it/LC_MESSAGES/oidc.po

+526-82
Large diffs are not rendered by default.

locales/nl/LC_MESSAGES/oidc.po

+477-79
Large diffs are not rendered by default.

src/Forms/ClientForm.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -353,40 +353,40 @@ protected function buildForm(): void
353353
$this->setMethod('POST');
354354
$this->addComponent($this->csrfProtection, Form::ProtectorId);
355355

356-
$this->addText('name', '{oidc:client:name}')
356+
$this->addText('name', Translate::noop('Name'))
357357
->setHtmlAttribute('class', 'full-width')
358358
->setMaxLength(255)
359359
->setRequired(Translate::noop('Name is required.'));
360360

361-
$this->addTextArea('description', '{oidc:client:description}', null, 3)
361+
$this->addTextArea('description', Translate::noop('Description'), null, 3)
362362
->setHtmlAttribute('class', 'full-width');
363-
$this->addTextArea('redirect_uri', '{oidc:client:redirect_uri}', null, 5)
363+
$this->addTextArea('redirect_uri', Translate::noop('Redirect URI'), null, 5)
364364
->setHtmlAttribute('class', 'full-width')
365365
->setRequired(Translate::noop('At least one redirect URI is required.'));
366366

367-
$this->addCheckbox('is_enabled', '{oidc:client:is_enabled}');
367+
$this->addCheckbox('is_enabled', Translate::noop('Activated'));
368368

369369
$this->addCheckbox('is_confidential', '{oidc:client:is_confidential}');
370370

371-
$this->addSelect('auth_source', '{oidc:client:auth_source}:')
371+
$this->addSelect('auth_source', Translate::noop('Authentication source'))
372372
->setHtmlAttribute('class', 'full-width')
373373
->setItems($this->sspBridge->auth()->source()->getSources(), false)
374374
->setPrompt(Translate::noop('-'));
375375

376376
$scopes = $this->getScopes();
377377

378-
$this->addMultiSelect('scopes', '{oidc:client:scopes}', $scopes, 10)
378+
$this->addMultiSelect('scopes', Translate::noop('Scopes'), $scopes, 10)
379379
->setHtmlAttribute('class', 'full-width')
380380
->setRequired(Translate::noop('At least one scope is required.'));
381381

382-
$this->addText('owner', '{oidc:client:owner}')
382+
$this->addText('owner', Translate::noop('Owner'))
383383
->setMaxLength(190);
384-
$this->addTextArea('post_logout_redirect_uri', '{oidc:client:post_logout_redirect_uri}', null, 5)
384+
$this->addTextArea('post_logout_redirect_uri', Translate::noop('Post-logout Redirect URIs'), null, 5)
385385
->setHtmlAttribute('class', 'full-width');
386-
$this->addTextArea('allowed_origin', '{oidc:client:allowed_origin}', null, 5)
386+
$this->addTextArea('allowed_origin', Translate::noop('Allowed origins for public clients'), null, 5)
387387
->setHtmlAttribute('class', 'full-width');
388388

389-
$this->addText('backchannel_logout_uri', '{oidc:client:backchannel_logout_uri}')
389+
$this->addText('backchannel_logout_uri', Translate::noop('Back-Channel Logout URI'))
390390
->setHtmlAttribute('class', 'full-width');
391391

392392
$this->addText('entity_identifier', 'Entity Identifier')

src/Services/Container.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use SimpleSAML\Configuration;
3131
use SimpleSAML\Database;
3232
use SimpleSAML\Error\Exception;
33+
use SimpleSAML\Locale\Translate;
3334
use SimpleSAML\Metadata\MetaDataStorageHandler;
3435
use SimpleSAML\Module\oidc\Admin\Menu;
3536
use SimpleSAML\Module\oidc\Bridges\PsrHttpBridge;
@@ -147,7 +148,11 @@ public function __construct()
147148
$helpers = new Helpers();
148149
$this->services[Helpers::class] = $helpers;
149150

150-
$csrfProtection = new CsrfProtection('{oidc:client:csrf_error}', $session);
151+
$csrfProtection = new CsrfProtection(
152+
Translate::noop('Your session has expired. Please return to the home page and try again.'),
153+
$session,
154+
);
155+
151156
$formFactory = new FormFactory(
152157
$moduleConfig,
153158
$csrfProtection,

templates/clients.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
<small>{{ client.description }}</small>
5454
<br>
5555
<small>
56-
{{ 'Registration:'|trans }} {{ client.registrationType.description }} |
57-
{{ 'Created at:'|trans }} {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
58-
{{ 'Updated at:'|trans }} {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
59-
{{ 'Expires at:'|trans }} {{ client.expiresAt ? client.expiresAt|date() : 'never' }}
56+
{{ 'Registration'|trans }}: {{ client.registrationType.description }} |
57+
{{ 'Created at'|trans }}: {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
58+
{{ 'Updated at'|trans }}: {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
59+
{{ 'Expires at'|trans }}: {{ client.expiresAt ? client.expiresAt|date() : 'never'|trans }}
6060
</small>
6161
</td>
6262
<td>

templates/clients/includes/form.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<span class="pure-form-message red-text">{{ form.scopes.getError }}</span>
8888
{% endif %}
8989

90-
<label for="frm-backchannel_logout_uri">{{ 'Back-Channel Logout URI'|trans }}</label>
90+
<label for="frm-backchannel_logout_uri">{{ 'Back-channel Logout URI'|trans }}</label>
9191
{{ form.backchannel_logout_uri.control | raw }}
9292
<span class="pure-form-message">
9393
{% trans %}Enter if client supports Back-Channel Logout specification. When logout is initiated at the OpenID Provider, it will send a Logout Token to this URI in order to notify the client about that event. Must be a valid URI. Example: https://example.org/foo?bar=1{% endtrans %}
@@ -96,7 +96,7 @@
9696
<span class="pure-form-message red-text">{{ form.backchannel_logout_uri.getError }}</span>
9797
{% endif %}
9898

99-
<label for="frm-post_logout_redirect_uri">{{ 'Post-Logout Redirect URIs'|trans }}</label>
99+
<label for="frm-post_logout_redirect_uri">{{ 'Post-logout Redirect URIs'|trans }}</label>
100100
{{ form.post_logout_redirect_uri.control | raw }}
101101
<span class="pure-form-message">
102102
{% trans %}Allowed redirect URIs to use after client initiated logout. Must be a valid URI, one per line. Example: https://example.org/foo?bar=1{% endtrans %}

templates/clients/show.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
</div>
4141

4242
<div class="">
43-
{{ 'Registration:'|trans }} {{ client.registrationType.description }} |
44-
{{ 'Created at:'|trans }} {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
45-
{{ 'Updated at:'|trans }} {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
46-
{{ 'Expires at:'|trans }} {{ client.expiresAt ? client.expiresAt|date() : 'never' }}
43+
{{ 'Registration'|trans }}: {{ client.registrationType.description }} |
44+
{{ 'Created at'|trans }}: {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
45+
{{ 'Updated at'|trans }}: {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
46+
{{ 'Expires at'|trans }}: {{ client.expiresAt ? client.expiresAt|date() : 'never'|trans }}
4747
</div>
4848

4949
<br>

templates/config/migrations.twig

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
{% endif %}
2323

2424
<div class="message-box">
25-
Before running the migrations, make sure that the database user has proper privileges to change the scheme
26-
(for example, <kbd>alter, create, drop, index</kbd>). After running the migrations, it is a good practice to remove
27-
those privileges.
25+
{{ 'Before running the migrations, make sure that the database user has proper privileges to change the scheme (for example, <kbd>alter, create, drop, index</kbd>). After running the migrations, it is a good practice to remove those privileges.'|trans }}
2826
</div>
2927

3028
{% endblock oidcContent -%}

templates/includes/menu.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<li>
66
<a href="{{ item.hrefPath }}"
77
class="{{ item.hrefPath == oidcMenu.activeHrefPath ? 'active' : '' }}"
8-
> {{ item.label }} </a>
8+
> {{ item.label|trans }} </a>
99
</li>
1010
{% endfor %}
1111
</ul>

templates/logout.twig

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
{% block oidcContent %}
66
<h2>
77
{% if wasLogoutActionCalled %}
8-
{{ '{oidc:logout:page_title_success}'|trans }}
8+
{{ 'Logout Successful'|trans }}
99
{% else %}
10-
{{ '{oidc:logout:page_title_fail}'|trans }}
10+
{{ 'Logout Failed'|trans }}
1111
{% endif %}
1212
</h2>
1313

1414

1515
<div>
1616
<h3>
17-
{{ '{oidc:logout:info_title}'|trans }}
17+
{{ 'Info'|trans }}
1818
</h3>
1919
<p>
2020
{% if wasLogoutActionCalled %}
21-
{{ '{oidc:logout:info_message_success}'|trans }}
21+
{{ 'You can now close this window or navigate to another page.'|trans }}
2222
{% else %}
23-
{{ '{oidc:logout:info_message_fail}'|trans }}
23+
{{ 'Requested session was not found or it is expired.'|trans }}
2424
{% endif %}
2525
</p>
2626
</div>

templates/tests/trust-chain-resolution.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
<h4>{{ 'Resolved chains'|trans }}</h4>
5555
{% if trustChainBag|default %}
5656
<p>
57-
{{ 'Total chains:'|trans }} {{ trustChainBag.getCount }}
57+
{{ 'Total chains'|trans }}: {{ trustChainBag.getCount }}
5858
</p>
5959
{% for index, trustChain in trustChainBag.getAll %}
6060
<p>
61-
{{ loop.index }}. {{ 'Trust Anchor ID:'|trans }} {{ trustChain.getResolvedTrustAnchor.getIssuer }}
61+
{{ loop.index }}. {{ 'Trust Anchor ID'|trans }}: {{ trustChain.getResolvedTrustAnchor.getIssuer }}
6262
<br><br>
63-
{{ 'Path:'|trans }}
63+
{{ 'Path'|trans }}:
6464
<br>
6565
{% for entity in trustChain.getEntities %}
6666
{% if loop.index > 1 %}
@@ -69,7 +69,7 @@
6969
{% endfor %}
7070

7171
<br>
72-
{{ 'Resolved metadata:' }}<br>
72+
{{ 'Resolved metadata' }}:<br>
7373
{% if resolvedMetadata[index]|default is not empty %}
7474
<code class="code-box code-box-content">
7575
{{- resolvedMetadata[index]|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_UNESCAPED_SLASHES')) -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\Test\Module\oidc\unit\Factories;
6+
7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\UsesClass;
9+
use PHPUnit\Framework\MockObject\MockObject;
10+
use PHPUnit\Framework\TestCase;
11+
use SimpleSAML\Module\oidc\Bridges\SspBridge;
12+
use SimpleSAML\Module\oidc\Factories\FormFactory;
13+
use SimpleSAML\Module\oidc\Forms\ClientForm;
14+
use SimpleSAML\Module\oidc\Forms\Controls\CsrfProtection;
15+
use SimpleSAML\Module\oidc\Helpers;
16+
use SimpleSAML\Module\oidc\ModuleConfig;
17+
18+
#[CoversClass(FormFactory::class)]
19+
#[UsesClass(ClientForm::class)]
20+
class FormFactoryTest extends TestCase
21+
{
22+
protected MockObject $moduleConfigMock;
23+
protected MockObject $csrfProtectionMock;
24+
protected MockObject $sspBridgeMock;
25+
protected MockObject $helpersMock;
26+
27+
protected function setUp(): void
28+
{
29+
$this->moduleConfigMock = $this->createMock(ModuleConfig::class);
30+
$this->csrfProtectionMock = $this->createMock(CsrfProtection::class);
31+
$this->sspBridgeMock = $this->createMock(SspBridge::class);
32+
$this->helpersMock = $this->createMock(Helpers::class);
33+
}
34+
35+
protected function sut(
36+
?ModuleConfig $moduleConfig = null,
37+
?CsrfProtection $csrfProtection = null,
38+
?SspBridge $sspBridge = null,
39+
?Helpers $helpers = null,
40+
): FormFactory {
41+
$moduleConfig ??= $this->moduleConfigMock;
42+
$csrfProtection ??= $this->csrfProtectionMock;
43+
$sspBridge ??= $this->sspBridgeMock;
44+
$helpers ??= $this->helpersMock;
45+
46+
return new FormFactory(
47+
$moduleConfig,
48+
$csrfProtection,
49+
$sspBridge,
50+
$helpers,
51+
);
52+
}
53+
54+
public function testCanConstruct(): void
55+
{
56+
$this->assertInstanceOf(FormFactory::class, $this->sut());
57+
}
58+
59+
public function testCanBuildClientForm(): void
60+
{
61+
$this->assertInstanceOf(
62+
ClientForm::class,
63+
$this->sut()->build(ClientForm::class),
64+
);
65+
}
66+
}

0 commit comments

Comments
 (0)