Repository Public License
1// ORIX Convert — App/Sources/Features/Shared/KeyLabels.swift2// Description: Human labels for the generic validation check names and the common fact keys reported by engines3// ("output.not-empty" → "Output is not empty"), through the app's string catalog. An unknown key is4// looked up in the engines' catalog, then shown as it is.5// Author: Simon-Pierre Boucher — contact@spboucher.ai6import Foundation78enum KeyLabels {9 /// Label of a validation check. Checks of a chained plan are named `stepN.<name>`.10 static func check(_ name: String) -> String {11 if name.hasPrefix("step"), let dot = name.firstIndex(of: "."), let step = Int(name[name.index(name.startIndex, offsetBy: 4)..<dot]) {12 return L("Step %lld: %@", step, check(String(name[name.index(after: dot)...])))13 }14 return checks[name] ?? LE(name)15 }1617 static func fact(_ key: String) -> String { facts[key] ?? LE(key) }1819 private static let checks: [String: String] = [20 "output.present": L("A result was produced"),21 "output.location": L("Result written inside the work folder"),22 "output.exists": L("Result file exists"),23 "output.not-empty": L("Output is not empty"),24 "output.format": L("Content matches the destination format"),25 "output.no-symlink-escape": L("No link leads outside the result"),26 "reopen": L("Result opens again"),27 "decodes": L("Result decodes"),28 "image.decodes": L("Image decodes"),29 "pixels": L("Pixels verified"),30 "dimensions": L("Dimensions as expected"),31 "alpha": L("Transparency as expected"),32 "pdf.opens": L("PDF opens"),33 "svg.readable": L("SVG is readable"),34 "content": L("Content verified"),35 "outline": L("Outline verified"),36 "tables": L("Tables verified"),37 "row-count": L("Row count as expected"),38 "column-count": L("Column count as expected"),39 "column-names": L("Column names as expected"),40 "values": L("Values verified"),41 "sample-values": L("Sample values verified"),42 "duration": L("Duration within tolerance"),43 "pages": L("Page count as expected"),44 "frames": L("Frame count as expected"),45 "geo.readable": L("Geodata is readable"),46 "geo.feature-count": L("Feature count as expected"),47 "geo.geometry-types": L("Geometry types as expected"),48 "geo.bounding-box": L("Bounding box as expected"),49 "geo.attributes": L("Attributes as expected"),50 "geo.reference-system": L("Reference system as expected"),51 ]5253 private static let facts: [String: String] = [54 "dpi": L("Resolution (dpi)"),55 "bits": L("Bits per channel"),56 "color.space": L("Colour space"),57 "colorspace": L("Colour space"),58 "color space": L("Colour space"),59 "profile": L("Colour profile"),60 "icc": L("Colour profile"),61 "format": L("Format"),62 "codec": L("Codec"),63 "duration": L("Duration (s)"),64 "bitrate": L("Bit rate"),65 "width": L("Width (px)"),66 "height": L("Height (px)"),67 "pages": L("Pages"),68 "frames": L("Frames"),69 "bytes": L("Size (bytes)"),70 "bytes.after": L("Size after (bytes)"),71 "saved.percent": L("Space saved"),72 "quality": L("Quality used"),73 "alpha": L("Transparency"),74 "backend": L("Converted with"),75 "result": L("Result"),76 "encoding": L("Text encoding"),77 "encrypted": L("Protected"),78 "images": L("Images"),79 "tables": L("Tables"),80 "words": L("Words"),81 "paths": L("Paths"),82 "nodes": L("Nodes"),83 "colors": L("Colours"),84 "sources": L("Source files"),85 "psnr.db": L("PSNR (dB)"),86 "pixels.sha256": L("Pixel checksum (SHA-256)"),87 "verify.pixels": L("Pixel verification"),88 "verify.max-difference": L("Largest difference found"),89 "verify.decoder": L("Verified with"),90 "ocr.lines": L("Lines recognised (OCR)"),91 "outline.entries": L("Outline entries"),92 "animation.loop": L("Loop count"),93 "animation.duration": L("Animation duration"),94 "duration.expected": L("Expected duration (s)"),95 "duration.tolerance": L("Duration tolerance (s)"),96 "video.encoder": L("Video encoder used"),97 "video.codec": L("Video codec"),98 "video.backend": L("Video encoding backend"),99 "video.size": L("Frame size"),100 "video.fps": L("Frame rate"),101 "video.rate": L("Video rate control"),102 "video.hdr": L("HDR"),103 "audio.encoder": L("Audio encoder used"),104 "audio.codec": L("Audio codec"),105 "audio.samplerate": L("Sample rate (Hz)"),106 "audio.channels": L("Channels"),107 "audio.bitdepth": L("Bit depth"),108 "audio.dither": L("Dither"),109 "artwork": L("Cover art"),110 "subtitle.codec": L("Subtitle codec"),111 "subtitle.tracks": L("Subtitle tracks"),112 "loudness.mode": L("Loudness normalisation"),113 "loudness.target": L("Loudness target"),114 "loudness.gain": L("Gain applied"),115 "loudness.input.i": L("Integrated loudness, source"),116 "loudness.input.tp": L("True peak, source"),117 "loudness.input.lra": L("Loudness range, source"),118 "loudness.output.i": L("Integrated loudness, result"),119 "loudness.output.tp": L("True peak, result"),120 "threshold": L("Threshold used"),121 "target.reached": L("Target size reached"),122 "target.size.bytes": L("Target size (bytes)"),123 "target.encodes": L("Encoding attempts"),124 "trim.accuracy": L("Trim accuracy"),125 ]126}127