Skip to content

Commit b433b29

Browse files
committed
docs: place translator comments above each l10n call
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 64f8b61 commit b433b29

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

lib/Service/Signature/PdfSignatureValidationService.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -160,34 +160,34 @@ private function mapSignatureValidation(ValidationResult $result): array {
160160
return match ($result->state) {
161161
ValidationState::SIGNATURE_VALID => [
162162
'id' => 1,
163-
// TRANSLATORS: User-facing status when signature cryptographic validation succeeds.
163+
// TRANSLATORS User-facing status when signature cryptographic validation succeeds.
164164
'label' => $this->l10n->t('Signature is valid.'),
165165
'isValid' => true,
166166
],
167167
ValidationState::SIGNATURE_INVALID => [
168168
'id' => 2,
169-
// TRANSLATORS: User-facing status when signature cryptographic validation fails.
169+
// TRANSLATORS User-facing status when signature cryptographic validation fails.
170170
'label' => $this->l10n->t('Signature is invalid.'),
171171
'reason' => $this->translateKnownReason($result->reason),
172172
'isValid' => false,
173173
],
174174
ValidationState::DIGEST_MISMATCH => [
175175
'id' => 3,
176-
// TRANSLATORS: User-facing status when signed digest does not match PDF content.
176+
// TRANSLATORS User-facing status when signed digest does not match PDF content.
177177
'label' => $this->l10n->t('Digest mismatch.'),
178178
'reason' => $this->translateKnownReason($result->reason),
179179
'isValid' => false,
180180
],
181181
ValidationState::NOT_VERIFIED => [
182182
'id' => 5,
183-
// TRANSLATORS: User-facing status when validation could not be fully completed.
183+
// TRANSLATORS User-facing status when validation could not be fully completed.
184184
'label' => $this->l10n->t('Signature has not yet been verified.'),
185185
'reason' => $this->translateKnownReason($result->reason),
186186
'isValid' => false,
187187
],
188188
default => [
189189
'id' => 6,
190-
// TRANSLATORS: Generic fallback status for unexpected signature validation failures.
190+
// TRANSLATORS Generic fallback status for unexpected signature validation failures.
191191
'label' => $this->l10n->t('Unknown validation failure.'),
192192
'reason' => $this->translateKnownReason($result->reason),
193193
'isValid' => false,
@@ -202,48 +202,48 @@ private function mapCertificateValidation(ValidationResult $result): array {
202202
return match ($result->state) {
203203
ValidationState::CERT_TRUSTED => [
204204
'id' => 1,
205-
// TRANSLATORS: User-facing status when certificate is trusted.
205+
// TRANSLATORS User-facing status when certificate is trusted.
206206
'label' => $this->l10n->t('Certificate is trusted.'),
207207
'isValid' => true,
208208
],
209209
ValidationState::CERT_ISSUER_NOT_TRUSTED => [
210210
'id' => 2,
211-
// TRANSLATORS: User-facing status when issuing CA is known but not trusted.
211+
// TRANSLATORS User-facing status when issuing CA is known but not trusted.
212212
'label' => $this->l10n->t("Certificate issuer isn't trusted."),
213213
'reason' => $this->translateKnownReason($result->reason),
214214
'isValid' => false,
215215
],
216216
ValidationState::CERT_ISSUER_UNKNOWN => [
217217
'id' => 3,
218-
// TRANSLATORS: User-facing status when certificate issuer cannot be identified/trusted.
218+
// TRANSLATORS User-facing status when certificate issuer cannot be identified/trusted.
219219
'label' => $this->l10n->t('Certificate issuer is unknown.'),
220220
'reason' => $this->translateKnownReason($result->reason),
221221
'isValid' => false,
222222
],
223223
ValidationState::CERT_REVOKED => [
224224
'id' => 4,
225-
// TRANSLATORS: User-facing status when certificate is revoked.
225+
// TRANSLATORS User-facing status when certificate is revoked.
226226
'label' => $this->l10n->t('Certificate has been revoked.'),
227227
'reason' => $this->translateKnownReason($result->reason),
228228
'isValid' => false,
229229
],
230230
ValidationState::CERT_EXPIRED => [
231231
'id' => 5,
232-
// TRANSLATORS: User-facing status when certificate is expired.
232+
// TRANSLATORS User-facing status when certificate is expired.
233233
'label' => $this->l10n->t('Certificate has expired.'),
234234
'reason' => $this->translateKnownReason($result->reason),
235235
'isValid' => false,
236236
],
237237
ValidationState::CERT_NOT_VERIFIED => [
238238
'id' => 6,
239-
// TRANSLATORS: User-facing status when certificate validation could not be completed.
239+
// TRANSLATORS User-facing status when certificate validation could not be completed.
240240
'label' => $this->l10n->t('Certificate has not yet been verified.'),
241241
'reason' => $this->translateKnownReason($result->reason),
242242
'isValid' => false,
243243
],
244244
default => [
245245
'id' => 7,
246-
// TRANSLATORS: Generic fallback status for unexpected certificate validation failures.
246+
// TRANSLATORS Generic fallback status for unexpected certificate validation failures.
247247
'label' => $this->l10n->t('Unknown issue with certificate or corrupted data.'),
248248
'reason' => $this->translateKnownReason($result->reason),
249249
'isValid' => false,
@@ -257,7 +257,7 @@ private function translateKnownReason(?string $reason): ?string {
257257
}
258258

259259
if (preg_match('/^Intermediate certificate at position (\d+) is not signed by issuer$/', $reason, $matches) === 1) {
260-
// TRANSLATORS: %s is the numeric position of an intermediate certificate in the chain.
260+
// TRANSLATORS %s is the numeric position of an intermediate certificate in the chain.
261261
return $this->l10n->t(
262262
'Intermediate certificate at position %s is not signed by issuer',
263263
[$matches[1]]
@@ -268,50 +268,50 @@ private function translateKnownReason(?string $reason): ?string {
268268
if (str_starts_with($reason, $prefix)) {
269269
$detail = substr($reason, strlen($prefix));
270270
$translatedDetail = $this->translateKnownReason($detail) ?? $detail;
271-
// TRANSLATORS: %s is a translated certificate validation detail message.
271+
// TRANSLATORS %s is a translated certificate validation detail message.
272272
return $this->l10n->t('Certificate validation failed: %s', [$translatedDetail]);
273273
}
274274

275275
return match ($reason) {
276-
// TRANSLATORS: Technical term from PDF signatures. Keep "ByteRange" unchanged.
276+
// TRANSLATORS Technical term from PDF signatures. Keep "ByteRange" unchanged.
277277
'No ByteRange in signature' => $this->l10n->t('No ByteRange in signature'),
278-
// TRANSLATORS: Technical message for digest/hash mismatch in PDF signature verification.
278+
// TRANSLATORS Technical message for digest/hash mismatch in PDF signature verification.
279279
'PDF content hash does not match signed digest' => $this->l10n->t('PDF content hash does not match signed digest'),
280-
// TRANSLATORS: Certificate/public-key verification failed for signature bytes.
280+
// TRANSLATORS Certificate/public-key verification failed for signature bytes.
281281
'Signature does not match certificate' => $this->l10n->t('Signature does not match certificate'),
282-
// TRANSLATORS: X.509 certificate parsing failure.
282+
// TRANSLATORS X.509 certificate parsing failure.
283283
'Failed to parse certificate' => $this->l10n->t('Failed to parse certificate'),
284-
// TRANSLATORS: Signature timestamp is outside certificate validity window.
284+
// TRANSLATORS Signature timestamp is outside certificate validity window.
285285
'Certificate was not valid at time of signature' => $this->l10n->t('Certificate was not valid at time of signature'),
286-
// TRANSLATORS: Certificate validity date has ended.
286+
// TRANSLATORS Certificate validity date has ended.
287287
'Certificate has expired' => $this->l10n->t('Certificate has expired'),
288-
// TRANSLATORS: No certificates were found in provided certificate chain.
288+
// TRANSLATORS No certificates were found in provided certificate chain.
289289
'Empty certificate chain' => $this->l10n->t('Empty certificate chain'),
290-
// TRANSLATORS: Certificate does not provide a serial number field.
290+
// TRANSLATORS Certificate does not provide a serial number field.
291291
'Certificate has no serial number' => $this->l10n->t('Certificate has no serial number'),
292-
// TRANSLATORS: CRL means Certificate Revocation List; keep acronym CRL unchanged.
292+
// TRANSLATORS CRL means Certificate Revocation List; keep acronym CRL unchanged.
293293
'Certificate found in CRL' => $this->l10n->t('Certificate found in CRL'),
294-
// TRANSLATORS: Certificate structure/content is invalid.
294+
// TRANSLATORS Certificate structure/content is invalid.
295295
'Invalid certificate' => $this->l10n->t('Invalid certificate'),
296-
// TRANSLATORS: CA means Certificate Authority; keep acronym CA unchanged.
296+
// TRANSLATORS CA means Certificate Authority; keep acronym CA unchanged.
297297
'Leaf certificate is marked as CA' => $this->l10n->t('Leaf certificate is marked as CA'),
298-
// TRANSLATORS: Certificate signature chain validation failed.
298+
// TRANSLATORS Certificate signature chain validation failed.
299299
'Certificate signature validation failed' => $this->l10n->t('Certificate signature validation failed'),
300-
// TRANSLATORS: Self-signed certificate is not present in trusted roots list.
300+
// TRANSLATORS Self-signed certificate is not present in trusted roots list.
301301
'Self-signed certificate not in trusted roots' => $this->l10n->t('Self-signed certificate not in trusted roots'),
302-
// TRANSLATORS: Root certificate must be self-signed to be considered a trust anchor.
302+
// TRANSLATORS Root certificate must be self-signed to be considered a trust anchor.
303303
'Root certificate is not self-signed' => $this->l10n->t('Root certificate is not self-signed'),
304-
// TRANSLATORS: Root certificate is not present in configured trusted certificate list.
304+
// TRANSLATORS Root certificate is not present in configured trusted certificate list.
305305
'Root certificate is not in trusted list' => $this->l10n->t('Root certificate is not in trusted list'),
306-
// TRANSLATORS: Signature container has no binary signature payload.
306+
// TRANSLATORS Signature container has no binary signature payload.
307307
'No binary signature' => $this->l10n->t('No binary signature'),
308-
// TRANSLATORS: Signature payload has no embedded certificates.
308+
// TRANSLATORS Signature payload has no embedded certificates.
309309
'No certificates in signature' => $this->l10n->t('No certificates in signature'),
310-
// TRANSLATORS: Certificate used for signing is expired.
310+
// TRANSLATORS Certificate used for signing is expired.
311311
'Signing certificate has expired' => $this->l10n->t('Signing certificate has expired'),
312-
// TRANSLATORS: Certificate used for signing is revoked.
312+
// TRANSLATORS Certificate used for signing is revoked.
313313
'Signing certificate has been revoked' => $this->l10n->t('Signing certificate has been revoked'),
314-
// TRANSLATORS: Signature verification could not be fully completed.
314+
// TRANSLATORS Signature verification could not be fully completed.
315315
'Signature verification incomplete' => $this->l10n->t('Signature verification incomplete'),
316316
default => $reason,
317317
};

0 commit comments

Comments
 (0)