fix: PDF-Exporte folgen der Sprache der Oberfläche
`RoutinePdfExporter._text()` hat den Text übersetzt und dann das Original geschrieben. Seit dem Englisch-Umschalten waren PDFs damit faktisch durchgehend deutsch, obwohl die Release-Notizen übersetzte Blätter nennen. - `_text()` schreibt jetzt die Übersetzung. - Zusammengesetzte Texte übersetzen zuerst die Vorlage und setzen dann ein (Untertitel, Notiz im Rink, "+ %d weitere", Saisonvergleich). - `_draw_note()` übersetzt vor dem Umbruch, sonst passt kein Satz mehr auf einen Katalogschlüssel. - Fehlende Schlüssel ergänzt (u. a. "Kategorie: %s", "%d Abschnitte", "Musik: %s", Tabellenköpfe). Test: `run_export_tests` baut ein PDF auf Englisch und prüft, dass Tabellenköpfe und der Saisonvergleich übersetzt sind.
This commit is contained in:
parent
bbf9154221
commit
1b6e6d8ede
4 changed files with 130 additions and 12 deletions
86
docs/refactor-whiteboard-controller.md
Normal file
86
docs/refactor-whiteboard-controller.md
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# WhiteboardController zerlegen
|
||||
|
||||
Stand: 2026-11-13
|
||||
|
||||
Ziel: Der Controller ist mit **9.092 Zeilen und 465 Funktionen** der größte
|
||||
Baustein im Projekt; die Roadmap nennt < 1.500 Zeilen pro Datei. Diese Notiz
|
||||
hält die Reihenfolge fest, damit der Umbau in Etappen mit grüner Suite
|
||||
passiert und nicht als Big Bang.
|
||||
|
||||
## Grundregeln
|
||||
|
||||
1. **Erst reine Logik, dann UI.** Textaufbau, Formatierung und Prüf-Logik
|
||||
lassen sich ohne Szene testen und sind risikofrei zu verschieben. Dialoge
|
||||
und Signale kommen zuletzt.
|
||||
2. **Eine Etappe = ein Commit mit grüner Suite.** Keine Etappe ändert
|
||||
Verhalten; die Tests bleiben unverändert, nur Aufrufstellen wandern.
|
||||
3. **Kein Big Bang.** Der Controller bleibt Node und Scene-Einstiegspunkt.
|
||||
Ausgelagert werden Aufgaben, nicht die Klasse.
|
||||
4. **Zustand bleibt beim Controller.** `_routine`, `_current_path`, Auswahl
|
||||
und Historie gehören weiter dorthin; ausgelagerte Bausteine bekommen die
|
||||
Daten übergeben, statt sie zu besitzen.
|
||||
|
||||
## Zielbausteine
|
||||
|
||||
| Baustein | Inhalt | Zeilen (grob) | Kopplung | Etappe |
|
||||
| :--- | :--- | ---: | :--- | :--- |
|
||||
| `HelpContent` | Hilfetext für den ?-Dialog | ~140 | keine | 1 ✅ |
|
||||
| `ValidationReportView` | Zeilen für Prüf- und Saisonvergleichs-Dialog | ~400 | nur Daten | 2 |
|
||||
| `ExportService` | PDF/SVG/PNG schreiben, Abschlussdialog-Daten | ~250 | Dateisystem | 3 |
|
||||
| `SeasonPanel` | Saison-/Programm-/Kategorieauswahl und Regelnachführung | ~250 | Statusleiste | 4 |
|
||||
| `SyncPanel` | Dropbox-Sync, Konflikte, Küren verwalten | ~900 | Dialoge, Threads | 5 |
|
||||
| `HubPanel` | Kür-Hub (Login, Upload, Downloads) | ~650 | Dialoge, Threads | 6 |
|
||||
| `PlaybackPanel` | Wiedergabe, Musik, Timeline-Labels | ~600 | Canvas, Audio | 7 |
|
||||
| `ElementInspector` | Element-Dialog, Features, Level, Kombinationen | ~800 | Dialog, Regeln | 8 |
|
||||
|
||||
Danach bleibt ein Controller von grob 2.000–2.500 Zeilen: Verdrahtung,
|
||||
Auswahl, Werkzeuge, Abschnitte, Undo/Redo, Statuszeile.
|
||||
|
||||
## Etappen
|
||||
|
||||
### 1. `HelpContent` ✅
|
||||
|
||||
Der Hilfetext ist ein reiner String. Verschoben nach
|
||||
`src/whiteboard/view/help_content.gd` (`HelpContent.build()`), der Controller
|
||||
setzt ihn nur noch in den Dialog. Kein Verhalten geändert.
|
||||
|
||||
### 2. `ValidationReportView`
|
||||
|
||||
Der komplette Textaufbau für den Prüfdialog (Kopf, Saisonhinweis, Kategorie,
|
||||
Basiswert, Punktschätzung, Prüfliste, Befunde) und für den
|
||||
Saisonvergleich wandert in eine Klasse, die `Routine`, `ValidationReport`,
|
||||
`RulesPackage` und die Anzeige-Optionen bekommt und `PackedStringArray`
|
||||
zurückgibt.
|
||||
|
||||
Fertig, wenn der Controller nur noch `validation_text.text = ...` setzt und
|
||||
der Dialog unverändert aussieht (Whiteboard-Test grün, keine neuen
|
||||
Typfehler).
|
||||
|
||||
### 3. `ExportService`
|
||||
|
||||
Schreiben der Dateien, Pfadbildung und der Abschluss-Dialog bekommen einen
|
||||
eigenen Baustein; der Controller reicht Kür, Format und Abschnitt durch.
|
||||
|
||||
### 4. `SeasonPanel`
|
||||
|
||||
Saison-, Programm- und Kategorieauswahl samt Regelnachführung
|
||||
(`_apply_rules_for_season`, `_sync_season_option`, `set_season`, …). Danach
|
||||
kennt nur noch dieser Baustein `RulesLibrary` und `RulesPackage`.
|
||||
|
||||
### 5–7. Sync, Hub, Playback
|
||||
|
||||
Die drei Thread-/Dialog-Cluster. Sie hängen an Signalen und Fenstern; hier
|
||||
lohnt es, die Bausteine als eigene Nodes mit Signalen zu schneiden, statt als
|
||||
RefCounted mit Rückruf.
|
||||
|
||||
### 8. `ElementInspector`
|
||||
|
||||
Zuletzt: Element-Dialog, Feature-Auswahl, Fußzuordnung, Levelableitung. Der
|
||||
größte UI-Block und der, an dem am meisten hängt.
|
||||
|
||||
## Was bewusst bleibt
|
||||
|
||||
- `_ready()` und die Signalverdrahtung der Szene.
|
||||
- Undo/Redo und die Historie (arbeiten auf dem gesamten Kürzustand).
|
||||
- Die Statuszeile als Zusammenfassung (`_update_status`), solange Panels sie
|
||||
nicht selbst besitzen.
|
||||
|
|
@ -799,3 +799,16 @@
|
|||
"„%s“: %d Features auf einem Fuß, es zählen höchstens %d.","„%s“: %d Features auf einem Fuß, es zählen höchstens %d.","“%s”: %d features on one foot, at most %d count."
|
||||
"Bei „%s“ zählen höchstens %d Features der Gruppe „%s“.","Bei „%s“ zählen höchstens %d Features der Gruppe „%s“.","In “%s” at most %d features of the group “%s” count."
|
||||
"Als PDF","Als PDF","As PDF"
|
||||
"Kategorie: %s","Kategorie: %s","Category: %s"
|
||||
"%d Abschnitte","%d Abschnitte","%d sections"
|
||||
"Musik: %s","Musik: %s","Music: %s"
|
||||
"+ %d weitere","+ %d weitere","+ %d more"
|
||||
"Abschnitt","Abschnitt","Section"
|
||||
"Abschnitte","Abschnitte","Sections"
|
||||
"#","#","#"
|
||||
"Fehler","Fehler","Error"
|
||||
"Warnung","Warnung","Warning"
|
||||
"Hinweis","Hinweis","Note"
|
||||
"%s — nicht im Katalog","%s — nicht im Katalog","%s — not in the catalog"
|
||||
"%s — Feature „%s“ in der Ziel-Saison unbekannt","%s — Feature „%s“ in der Ziel-Saison unbekannt","%s — feature “%s” unknown in the target season"
|
||||
"• %s — in der Ziel-Saison nicht vorhanden","• %s — in der Ziel-Saison nicht vorhanden","• %s — not available in the target season"
|
||||
|
|
|
|||
|
|
|
@ -180,7 +180,7 @@ static func _report_blocks(
|
|||
for change: SeasonUpgradeCheck.Change in missing_category:
|
||||
blocks.append(
|
||||
_report_block(
|
||||
"• %s — in der Ziel-Saison nicht vorhanden" % change.label,
|
||||
I18n.t("• %s — in der Ziel-Saison nicht vorhanden") % change.label,
|
||||
10.0,
|
||||
false,
|
||||
TEXT_COLOR,
|
||||
|
|
@ -193,7 +193,7 @@ static func _report_blocks(
|
|||
var sign := "+" if report.value_delta() >= 0.0 else "−"
|
||||
blocks.append(
|
||||
_report_block(
|
||||
"Basiswert %s → %s (%s%s)"
|
||||
I18n.t("Basiswert %s → %s (%s%s)")
|
||||
% [
|
||||
_number(report.base_value_before),
|
||||
_number(report.base_value_after),
|
||||
|
|
@ -212,7 +212,7 @@ static func _report_blocks(
|
|||
if not report.issues.is_empty():
|
||||
blocks.append(
|
||||
_report_block(
|
||||
"Befunde bei Prüfung gegen %s" % report.target_season,
|
||||
I18n.t("Befunde bei Prüfung gegen %s") % report.target_season,
|
||||
12.0,
|
||||
true,
|
||||
TEXT_COLOR,
|
||||
|
|
@ -223,7 +223,7 @@ static func _report_blocks(
|
|||
for issue: ValidationIssue in report.issues:
|
||||
blocks.append(
|
||||
_report_block(
|
||||
"• %s: %s" % [issue.severity_label(), issue.message],
|
||||
"• %s: %s" % [I18n.t(issue.severity_label()), issue.message],
|
||||
9.5,
|
||||
false,
|
||||
MUTED_COLOR,
|
||||
|
|
@ -253,9 +253,9 @@ static func _add_report_group(
|
|||
static func _report_change_text(change: SeasonUpgradeCheck.Change) -> String:
|
||||
match change.kind:
|
||||
SeasonUpgradeCheck.KIND_MISSING_CODE:
|
||||
return "%s — nicht im Katalog" % change.label
|
||||
return I18n.t("%s — nicht im Katalog") % change.label
|
||||
SeasonUpgradeCheck.KIND_UNKNOWN_FEATURE:
|
||||
return "%s — Feature „%s“ in der Ziel-Saison unbekannt" % [
|
||||
return I18n.t("%s — Feature „%s“ in der Ziel-Saison unbekannt") % [
|
||||
change.label,
|
||||
change.before,
|
||||
]
|
||||
|
|
@ -574,14 +574,14 @@ static func _routine_subtitle(routine: Routine, section_count: int) -> String:
|
|||
parts.append(I18n.t("Artistic"))
|
||||
var category := routine.adult_category.strip_edges()
|
||||
if not category.is_empty():
|
||||
parts.append("Kategorie: %s" % category.capitalize())
|
||||
parts.append(I18n.t("Kategorie: %s") % category.capitalize())
|
||||
var season := routine.season.strip_edges()
|
||||
if not season.is_empty():
|
||||
parts.append(I18n.t("Saison %s") % season)
|
||||
parts.append("%d Abschnitte" % section_count)
|
||||
parts.append(I18n.t("%d Abschnitte") % section_count)
|
||||
parts.append(I18n.t("Gesamt %s") % _fmt_clock(routine.get_duration_seconds()))
|
||||
if routine.has_music():
|
||||
parts.append("Musik: %s" % routine.music_file)
|
||||
parts.append(I18n.t("Musik: %s") % routine.music_file)
|
||||
return " · ".join(parts)
|
||||
|
||||
|
||||
|
|
@ -696,7 +696,7 @@ static func _text(
|
|||
_n(color.b),
|
||||
_n(x),
|
||||
_n(_y(top)),
|
||||
_pdf_literal(text),
|
||||
_pdf_literal(caption),
|
||||
]
|
||||
)
|
||||
|
||||
|
|
@ -1554,7 +1554,7 @@ static func _draw_timeline_notes(
|
|||
if entries.size() > visible:
|
||||
_text(
|
||||
lines,
|
||||
"+ %d weitere" % (entries.size() - visible),
|
||||
I18n.t("+ %d weitere") % (entries.size() - visible),
|
||||
x,
|
||||
top + 16.0 + float(visible) * 13.0,
|
||||
8.5,
|
||||
|
|
@ -1656,7 +1656,7 @@ static func _draw_note(
|
|||
text: String
|
||||
) -> void:
|
||||
_rect(lines, x, top, width, 36.0, ROW_COLOR, RULE_COLOR, 0.5)
|
||||
var wrapped := _wrap_text(text, 8.0, width - 16.0, 2)
|
||||
var wrapped := _wrap_text(I18n.t(text), 8.0, width - 16.0, 2)
|
||||
for index: int in range(wrapped.size()):
|
||||
_text(
|
||||
lines,
|
||||
|
|
|
|||
|
|
@ -192,6 +192,25 @@ func _run() -> void:
|
|||
comparison_text.contains("Basiswert"),
|
||||
"the comparison PDF sums the base values"
|
||||
)
|
||||
|
||||
# Die PDF-Texte folgen der Sprache der Oberfläche.
|
||||
AppSettings.apply_locale("en")
|
||||
var english_pdf := (
|
||||
RoutinePdfExporter.build(routine).get_string_from_ascii()
|
||||
)
|
||||
var english_comparison := (
|
||||
RoutinePdfExporter.build_season_comparison(comparison_routine, report)
|
||||
.get_string_from_ascii()
|
||||
)
|
||||
AppSettings.apply_locale("de")
|
||||
_check(
|
||||
english_pdf.contains("Duration") and english_pdf.contains("Section"),
|
||||
"PDF table labels follow the interface language"
|
||||
)
|
||||
_check(
|
||||
english_comparison.contains("not in the catalog"),
|
||||
"the comparison PDF follows the interface language"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains(" c") or pdf_text.contains(" l"),
|
||||
"PDF export contains vector path operators"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue