@@ -160,29 +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.
163164 'label ' => $ this ->l10n ->t ('Signature is valid. ' ),
164165 'isValid ' => true ,
165166 ],
166167 ValidationState::SIGNATURE_INVALID => [
167168 'id ' => 2 ,
169+ // TRANSLATORS: User-facing status when signature cryptographic validation fails.
168170 'label ' => $ this ->l10n ->t ('Signature is invalid. ' ),
169171 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
170172 'isValid ' => false ,
171173 ],
172174 ValidationState::DIGEST_MISMATCH => [
173175 'id ' => 3 ,
176+ // TRANSLATORS: User-facing status when signed digest does not match PDF content.
174177 'label ' => $ this ->l10n ->t ('Digest mismatch. ' ),
175178 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
176179 'isValid ' => false ,
177180 ],
178181 ValidationState::NOT_VERIFIED => [
179182 'id ' => 5 ,
183+ // TRANSLATORS: User-facing status when validation could not be fully completed.
180184 'label ' => $ this ->l10n ->t ('Signature has not yet been verified. ' ),
181185 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
182186 'isValid ' => false ,
183187 ],
184188 default => [
185189 'id ' => 6 ,
190+ // TRANSLATORS: Generic fallback status for unexpected signature validation failures.
186191 'label ' => $ this ->l10n ->t ('Unknown validation failure. ' ),
187192 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
188193 'isValid ' => false ,
@@ -197,41 +202,48 @@ private function mapCertificateValidation(ValidationResult $result): array {
197202 return match ($ result ->state ) {
198203 ValidationState::CERT_TRUSTED => [
199204 'id ' => 1 ,
205+ // TRANSLATORS: User-facing status when certificate is trusted.
200206 'label ' => $ this ->l10n ->t ('Certificate is trusted. ' ),
201207 'isValid ' => true ,
202208 ],
203209 ValidationState::CERT_ISSUER_NOT_TRUSTED => [
204210 'id ' => 2 ,
211+ // TRANSLATORS: User-facing status when issuing CA is known but not trusted.
205212 'label ' => $ this ->l10n ->t ("Certificate issuer isn't trusted. " ),
206213 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
207214 'isValid ' => false ,
208215 ],
209216 ValidationState::CERT_ISSUER_UNKNOWN => [
210217 'id ' => 3 ,
218+ // TRANSLATORS: User-facing status when certificate issuer cannot be identified/trusted.
211219 'label ' => $ this ->l10n ->t ('Certificate issuer is unknown. ' ),
212220 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
213221 'isValid ' => false ,
214222 ],
215223 ValidationState::CERT_REVOKED => [
216224 'id ' => 4 ,
225+ // TRANSLATORS: User-facing status when certificate is revoked.
217226 'label ' => $ this ->l10n ->t ('Certificate has been revoked. ' ),
218227 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
219228 'isValid ' => false ,
220229 ],
221230 ValidationState::CERT_EXPIRED => [
222231 'id ' => 5 ,
232+ // TRANSLATORS: User-facing status when certificate is expired.
223233 'label ' => $ this ->l10n ->t ('Certificate has expired. ' ),
224234 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
225235 'isValid ' => false ,
226236 ],
227237 ValidationState::CERT_NOT_VERIFIED => [
228238 'id ' => 6 ,
239+ // TRANSLATORS: User-facing status when certificate validation could not be completed.
229240 'label ' => $ this ->l10n ->t ('Certificate has not yet been verified. ' ),
230241 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
231242 'isValid ' => false ,
232243 ],
233244 default => [
234245 'id ' => 7 ,
246+ // TRANSLATORS: Generic fallback status for unexpected certificate validation failures.
235247 'label ' => $ this ->l10n ->t ('Unknown issue with certificate or corrupted data. ' ),
236248 'reason ' => $ this ->translateKnownReason ($ result ->reason ),
237249 'isValid ' => false ,
@@ -260,28 +272,46 @@ private function translateKnownReason(?string $reason): ?string {
260272 return $ this ->l10n ->t ('Certificate validation failed: %s ' , [$ translatedDetail ]);
261273 }
262274
263- // TRANSLATORS: Technical validation reasons from pdf-signature-validator.
264- // Keep protocol/acronym terms like ByteRange, CRL and CA as-is.
265275 return match ($ reason ) {
276+ // TRANSLATORS: Technical term from PDF signatures. Keep "ByteRange" unchanged.
266277 'No ByteRange in signature ' => $ this ->l10n ->t ('No ByteRange in signature ' ),
278+ // TRANSLATORS: Technical message for digest/hash mismatch in PDF signature verification.
267279 '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.
268281 'Signature does not match certificate ' => $ this ->l10n ->t ('Signature does not match certificate ' ),
282+ // TRANSLATORS: X.509 certificate parsing failure.
269283 'Failed to parse certificate ' => $ this ->l10n ->t ('Failed to parse certificate ' ),
284+ // TRANSLATORS: Signature timestamp is outside certificate validity window.
270285 '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.
271287 'Certificate has expired ' => $ this ->l10n ->t ('Certificate has expired ' ),
288+ // TRANSLATORS: No certificates were found in provided certificate chain.
272289 'Empty certificate chain ' => $ this ->l10n ->t ('Empty certificate chain ' ),
290+ // TRANSLATORS: Certificate does not provide a serial number field.
273291 'Certificate has no serial number ' => $ this ->l10n ->t ('Certificate has no serial number ' ),
292+ // TRANSLATORS: CRL means Certificate Revocation List; keep acronym CRL unchanged.
274293 'Certificate found in CRL ' => $ this ->l10n ->t ('Certificate found in CRL ' ),
294+ // TRANSLATORS: Certificate structure/content is invalid.
275295 'Invalid certificate ' => $ this ->l10n ->t ('Invalid certificate ' ),
296+ // TRANSLATORS: CA means Certificate Authority; keep acronym CA unchanged.
276297 'Leaf certificate is marked as CA ' => $ this ->l10n ->t ('Leaf certificate is marked as CA ' ),
298+ // TRANSLATORS: Certificate signature chain validation failed.
277299 'Certificate signature validation failed ' => $ this ->l10n ->t ('Certificate signature validation failed ' ),
300+ // TRANSLATORS: Self-signed certificate is not present in trusted roots list.
278301 '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.
279303 '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.
280305 '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.
281307 'No binary signature ' => $ this ->l10n ->t ('No binary signature ' ),
308+ // TRANSLATORS: Signature payload has no embedded certificates.
282309 'No certificates in signature ' => $ this ->l10n ->t ('No certificates in signature ' ),
310+ // TRANSLATORS: Certificate used for signing is expired.
283311 'Signing certificate has expired ' => $ this ->l10n ->t ('Signing certificate has expired ' ),
312+ // TRANSLATORS: Certificate used for signing is revoked.
284313 'Signing certificate has been revoked ' => $ this ->l10n ->t ('Signing certificate has been revoked ' ),
314+ // TRANSLATORS: Signature verification could not be fully completed.
285315 'Signature verification incomplete ' => $ this ->l10n ->t ('Signature verification incomplete ' ),
286316 default => $ reason ,
287317 };
0 commit comments