Files
mmd-pdf/Services/OcrCatalog.cs
T
kua-agent 6610acfa44 feat: rebrand to MMD PDF, single corporate theme, and remove original text under an edit
- Services/PdfRedactText.cs: strip text whose origin falls inside a CoverAnnotation
  from the page content stream at save time, hooked into PdfBurn.DrawAnnotationsIntoDoc.
  Fixes edited values staying recoverable by text extraction.
- Themes/MMD.xaml replaces all thirteen themes; picker and accent strip removed; no dark mode.
- Rename KillerPDF -> MMD PDF across code, resources, packaging and locale strings; new icon.
- Remove the upstream author credit and the in-app install button.
2026-08-27 07:37:09 +02:00

59 lines
2.6 KiB
C#

namespace MmdPdf.Services
{
// ============================================================
// OCR catalog - pure data, no IO, no App, no bootstrap.
// ============================================================
//
// Split out of OcrLanguages.cs so the test project can link THIS file alone. MmdPdf.Tests
// compiles individual sources rather than referencing the app assembly, and OcrLanguages
// reaches App.GetSetting, OcrNativeBootstrap and HttpClient - none of which a data check needs.
//
// THE RULE THIS FILE ENCODES: OCR languages track interface languages. If MmdPdf ships a UI
// in a language, it ships an OCR model for that language. There is no interface language whose
// text the app cannot read.
//
// It drifted once already, because nothing checked: the UI shipped hu-HU while the catalog
// stayed at eleven entries, and baobab-ts.com kept claiming OCR covered ten languages and that
// Polish and Hungarian did not need models. OcrCatalogTests now reads Strings\*.xaml and fails
// the build if these lists and that folder disagree, and release.ps1 runs the suite.
internal static class OcrCatalog
{
// Tesseract code -> display name. English is NOT bundled; every model downloads on demand
// into OcrNativeBootstrap.TessDataDir. Order mirrors the language picker (English first,
// then the LangGroup radios in MainWindow.xaml).
internal static readonly (string Code, string Name)[] Languages =
[
("eng", "English"),
("ben", "Bengali"),
("ces", "Czech"),
("deu", "German"),
("spa", "Spanish"),
("fra", "French"),
("hun", "Hungarian"),
("jpn", "Japanese"),
("pol", "Polish"),
("tur", "Turkish"),
("chi_sim", "Chinese (Simplified)"),
("chi_tra", "Chinese (Traditional)"),
];
// The Strings\*.xaml locale each model backs. Kept beside the catalog so the two are always
// edited together; the test asserts this covers exactly the locales that ship.
internal static readonly (string Locale, string Code)[] LocaleToCode =
[
("en-US", "eng"),
("bn", "ben"),
("cs-CZ", "ces"),
("de-DE", "deu"),
("es", "spa"),
("fr-FR", "fra"),
("hu-HU", "hun"),
("ja-JP", "jpn"),
("pl-PL", "pol"),
("tr-TR", "tur"),
("zh-CN", "chi_sim"),
("zh-TW", "chi_tra"),
];
}
}