Files
StarterNG/Eu07.BlackBox.Views/BlackBoxStrings.cs
maj00r 532875fc7b Black box: the queries of the user's train worked out once a read, lights as the driver checks them
- The stations, the signals passed, the horn points, the couplings, the
  consists and the timetable progress of the user's train are kept until
  a read adds something; the views asked for them every frame, which on
  a long session with many trains took the window down. A read that adds
  nothing no longer counts as a change.
- The lights are checked against the lamps the vehicles at the ends have
  (written by the simulator from now on), as its driver checks them: Pc 1
  without the upper headlight, with the auxiliary lamps, Pc 5 with the
  rear-end signals. Only while the user drives: the autopilot's lights
  are its own.
- A train off the platform counts at both ends: its head past the stop
  point as well as its tail before the platform's end.
- A recording without the couplings keeps the timetable for any vehicle
  of the user.
- A signal passed at danger is ringed on the map only once it was.
- In the tapes window a black box opens on a click or Enter, not when
  the arrow keys go over it.
- The viewer's screenshot of a window not laid out saves nothing and
  still closes.
2026-11-11 00:57:57 +01:00

436 lines
19 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using System.Globalization;
namespace Eu07.BlackBox.Views;
/// <summary>
/// The texts of the window, by key. The starter gives its own translations; on its
/// own the window speaks Polish or English, as the system does.
/// </summary>
public interface IBlackBoxStrings
{
string this[string key] { get; }
}
public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
{
private static readonly Dictionary<string, string> English = new()
{
["Title"] = "Black box",
["TitleOf"] = "Black box – {0}",
["Open"] = "Open…",
["Reload"] = "Reload",
["Live"] = "Follow the file",
["LiveTip"] = "Reads what the simulator adds to the file every 2 seconds",
["Play"] = "Play",
["Pause"] = "Pause",
["Follow"] = "Follow the train",
["Fit"] = "Whole map",
["NoFile"] = "Open a black box: physicslog/*.blackbox, written with the physics logs on.",
["Unreadable"] = "Can't read {0}: {1}",
["Reading"] = "Reading {0}…",
["Summary"] = "{0} · {1:0.0} km · max {2:0} km/h · driven {3} · autopilot {4} · over the AI {5} ({6} by more than {7:0} km/h, at most +{8:0} km/h) · signals {9} · at danger {10} · commands {11}",
["NotComplete"] = "still being written, or cut short",
["Cursor"] = "{0} · {1:0} km/h · AI {2} · limit {3}",
["CursorNoAi"] = "{0} · {1:0} km/h · no AI data",
["CursorOut"] = "{0} · not in a vehicle",
["None"] = "–",
["LimitAt"] = "{0:0} km/h in {1:0} m",
["EventCommand"] = "{0}",
["EventAutopilotOn"] = "Autopilot on",
["EventAutopilotOff"] = "Autopilot off",
["EventPassed"] = "Signal {0}: {1}, {2:0} km/h",
["EventDanger"] = "PASSED AT DANGER {0}, {1:0} km/h, {2:0} m beyond",
["EventInVehicle"] = "In {0}",
["EventOutside"] = "Out of the cab of {0}",
["EventNoVehicle"] = "Not in any vehicle",
["EventEnd"] = "End of the recording",
["AspectStop"] = "stop",
["AspectFree"] = "go",
["AspectSpeed"] = "{0:0}/{1}",
["LegendWithin"] = "within the AI's speed",
["LegendSlightly"] = "up to {0:0} km/h over",
["LegendOver"] = "more over",
["LegendAutopilot"] = "autopilot",
["LegendNoData"] = "no AI data",
["TimelineSpeed"] = "speed",
["TimelineTarget"] = "AI",
["TimelineLimit"] = "next limit",
["BandDriving"] = "driving",
["BandBrakes"] = "brakes",
["BandAlerter"] = "alerter",
["BandController"] = "controller",
["Cab"] = "Cab",
["CabNoData"] = "The user was in no vehicle then.",
["CabController"] = "Master controller",
["CabShunt"] = "Field shunting",
["CabReverser"] = "Reverser",
["CabForward"] = "forward",
["CabBackward"] = "backward",
["CabNeutral"] = "0",
["CabTrainBrake"] = "Driver's brake valve",
["CabLocalBrake"] = "Local brake",
["CabReservoir"] = "Main reservoir",
["CabCylinder"] = "Brake cylinders",
["CabPipe"] = "Brake pipe",
["CabCurrent"] = "Current",
["CabVoltage"] = "Voltage",
["CabRpm"] = "Revolutions",
["CabLights"] = "Lights",
["CabLightsFront"] = "front",
["CabLightsRear"] = "rear",
["DevBattery"] = "Battery",
["DevMainBreaker"] = "Main breaker",
["DevPantographFront"] = "Front pantograph",
["DevPantographRear"] = "Rear pantograph",
["DevConverter"] = "Converter",
["DevCompressor"] = "Compressor",
["DevLineContactors"] = "Line contactors",
["DevHeating"] = "Train heating",
["DevRadio"] = "Radio",
["DevShuntMode"] = "Shunting mode",
["DevDoorsLeft"] = "Left doors",
["DevDoorsRight"] = "Right doors",
["DevSanding"] = "Sanding",
["DevHorn"] = "Horn",
["DevSpringBrake"] = "Spring brake",
["DevAlerter"] = "Alerter",
["DevWheelSlip"] = "Wheel slip",
["DevOverloadRelay"] = "Overload relay",
["DevRadioStop"] = "Radio-stop",
["DevAlarmChain"] = "Emergency brake",
["TabEvents"] = "Events",
["TabTimetable"] = "Timetable",
["TabSummary"] = "Summary",
["PanelMap"] = "Map",
["PanelTimeline"] = "Run",
["Relation"] = "{0} → {1}",
["StatDistance"] = "Distance",
["StatMaxSpeed"] = "Top speed",
["StatDriven"] = "Driven by the user",
["StatAutopilotSub"] = "autopilot {0}",
["StatOverAi"] = "Over the AI",
["StatOverAiSub"] = "{0} by >{1:0} km/h · up to +{2:0}",
["StatSignals"] = "Signals",
["StatSignalsSub"] = "{0} at danger",
["StatStops"] = "Stops",
["StatStopsSub"] = "{0} missed",
["StatDelay"] = "Largest delay",
["StatDelaySub"] = "leaving a station: {0} at most",
["StatPlatform"] = "Stops off the platform",
["StatLights"] = "Head and tail signals",
["StatLightsRight"] = "right",
["StatLightsSub"] = "as required all the {0} on the move",
["StatLightsHead"] = "head {0} instead of {1}",
["StatLightsTail"] = "tail {0} instead of {1}",
["StatPlatformAt"] = "{0} {1:0.0} m",
["StatPlatformNone"] = "the whole train along the platform at every stop",
["StatHorn"] = "Horn at W6",
["StatHornSub"] = "{0} without the horn",
["StatAcceleration"] = "Acceleration",
["StatAccelerationSub"] = "lateral up to {0:0.00} m/s²",
["StatSecurity"] = "CA/SHP braking",
["StatRecording"] = "Recording",
["StatComplete"] = "complete",
["StatIncomplete"] = "being written or cut short",
["Minutes"] = "{0:+0.0;−0.0;0} min",
["OnTime"] = "on time",
["DelayNow"] = "delay {0}",
["DelayStanding"] = "{0} standing at {1}",
["DelayAfter"] = "{0} after {1}",
["TimetableNone"] = "The user's train had no timetable.",
["TtArrived"] = "arr. {0}",
["TtDeparted"] = "dep. {0}",
["TtPassed"] = "passed {0}",
["TtMissed"] = "stop missed",
["TtLeftEarly"] = "left early",
["TtStopShort"] = "{0:0.0} m short",
["TtStopPast"] = "{0:0.0} m past",
["TtStopExact"] = "on the spot",
["TtOnPlatform"] = "along the platform",
["TtOffPlatform"] = "{0:0.0} m of the train off the platform",
["TtTechnical"] = "technical stop",
["TtStanding"] = "standing",
["EventStopped"] = "Stop at {0}, {1}",
["EventStationPassed"] = "Passed {0}",
["EventStationMissed"] = "STOP MISSED: {0}",
["EventReady"] = "{0}: time to leave",
["EventHornSounded"] = "W6: horn sounded",
["EventHornMissed"] = "W6: NO HORN",
["EventCab"] = "Cab {0} of {1}",
["EventSecurityBraking"] = "BRAKING BY {0}",
["EventTimetable"] = "Timetable {0}, {1}",
["CabSpeed"] = "Speed",
["CabAiTarget"] = "AI {0:0} km/h",
["CabAcceleration"] = "Along",
["CabLateral"] = "Lateral",
["CabEndFront"] = "A",
["CabEndRear"] = "B",
["CabDriverUser"] = "user drives",
["CabDriverAi"] = "autopilot",
["CabOutside"] = "outside the cab",
["CabLightsHead"] = "head",
["CabLightsTail"] = "tail",
["CabSectionBrakes"] = "Brakes",
["CabSectionDrive"] = "Traction",
["DevVigilance"] = "CA",
["DevCabSignal"] = "SHP",
["DevSecurityBraking"] = "CA/SHP braking",
["LegendStopPoint"] = "W4 stop point",
["LegendShortStop"] = "W32 stop for shorter trains",
["ShortStopHover"] = "W32 {0}",
["LegendHorn"] = "W6 horn point",
["BandVigilance"] = "CA",
["BandCabSignal"] = "SHP",
["StopPointHover"] = "W4 {0}",
["PlatformHover"] = "platform {0:0} m",
["ShortTrainsHover"] = "for trains up to {0:0} m",
["StopHeadHover"] = "the head to stop {0:0} m before it",
["StopMiddleHover"] = "the middle of the train to stop {0:0} m before it",
["HornHover"] = "W6 {0} · {1:0} s",
["ZoomIn"] = "Zoom in",
["ZoomOut"] = "Zoom out",
["EventCamera"] = "Camera: {0}",
["CameraCab"] = "in the cab",
["CameraExternal"] = "outside view",
["CameraFree"] = "free camera",
["CameraDebug"] = "debug camera",
["EventCoupled"] = "Coupled {0} to {1}",
["EventUncoupled"] = "Uncoupled {0} from {1}",
["EventCouplingChanged"] = "{0} – {1}: {2}",
["CouplingCoupler"] = "coupler",
["CouplingBrakePipe"] = "brake pipe",
["CouplingControl"] = "control",
["CouplingPower"] = "high voltage",
["CouplingGangway"] = "gangway",
["CouplingMainPipe"] = "main pipe",
["CouplingHeating"] = "heating",
["CouplingNothing"] = "nothing",
["BandCamera"] = "camera",
["LegendCamera"] = "camera",
["Events"] = "Events",
["OnlyUser"] = "only the user's",
["FileFilter"] = "Black box"
};
private static readonly Dictionary<string, string> Polish = new()
{
["Title"] = "Czarna skrzynka",
["TitleOf"] = "Czarna skrzynka – {0}",
["Open"] = "Otwórz…",
["Reload"] = "Odśwież",
["Live"] = "Śledź plik",
["LiveTip"] = "Co 2 sekundy doczytuje to, co symulator dopisał do pliku",
["Play"] = "Odtwarzaj",
["Pause"] = "Pauza",
["Follow"] = "Śledź pociąg",
["Fit"] = "Cała mapa",
["NoFile"] = "Otwórz czarną skrzynkę: physicslog/*.blackbox, zapisywaną razem z logami fizyki.",
["Unreadable"] = "Nie można odczytać {0}: {1}",
["Reading"] = "Czytanie {0}…",
["Summary"] = "{0} · {1:0.0} km · maks. {2:0} km/h · jazda {3} · autopilot {4} · ponad AI {5} (w tym {6} o więcej niż {7:0} km/h, najwyżej +{8:0} km/h) · sygnalizatory {9} · minięte na „Stój” {10} · komendy {11}",
["NotComplete"] = "wciąż zapisywana albo ucięta",
["Cursor"] = "{0} · {1:0} km/h · AI {2} · ograniczenie {3}",
["CursorNoAi"] = "{0} · {1:0} km/h · brak danych AI",
["CursorOut"] = "{0} · poza pojazdem",
["None"] = "–",
["LimitAt"] = "{0:0} km/h za {1:0} m",
["EventCommand"] = "{0}",
["EventAutopilotOn"] = "Autopilot włączony",
["EventAutopilotOff"] = "Autopilot wyłączony",
["EventPassed"] = "Sygnalizator {0}: {1}, {2:0} km/h",
["EventDanger"] = "MINIĘTY NA „STÓJ” {0}, {1:0} km/h, {2:0} m za nim",
["EventInVehicle"] = "W {0}",
["EventOutside"] = "Poza kabiną {0}",
["EventNoVehicle"] = "Poza pojazdami",
["EventEnd"] = "Koniec nagrania",
["AspectStop"] = "stój",
["AspectFree"] = "wolna droga",
["AspectSpeed"] = "{0:0}/{1}",
["LegendWithin"] = "w granicach prędkości AI",
["LegendSlightly"] = "do {0:0} km/h ponad",
["LegendOver"] = "więcej ponad",
["LegendAutopilot"] = "autopilot",
["LegendNoData"] = "brak danych AI",
["TimelineSpeed"] = "prędkość",
["TimelineTarget"] = "AI",
["TimelineLimit"] = "następne ograniczenie",
["BandDriving"] = "jazda",
["BandBrakes"] = "hamulce",
["BandAlerter"] = "czuwak",
["BandController"] = "nastawnik",
["Cab"] = "Kabina",
["CabNoData"] = "Użytkownik nie był wtedy w żadnym pojeździe.",
["CabController"] = "Nastawnik",
["CabShunt"] = "Bocznik",
["CabReverser"] = "Kierunek",
["CabForward"] = "naprzód",
["CabBackward"] = "wstecz",
["CabNeutral"] = "0",
["CabTrainBrake"] = "Hamulec zespolony",
["CabLocalBrake"] = "Hamulec pomocniczy",
["CabReservoir"] = "Zbiornik główny",
["CabCylinder"] = "Cylindry",
["CabPipe"] = "Przewód główny",
["CabCurrent"] = "Prąd",
["CabVoltage"] = "Napięcie",
["CabRpm"] = "Obroty",
["CabLights"] = "Światła",
["CabLightsFront"] = "przód",
["CabLightsRear"] = "tył",
["DevBattery"] = "Baterie",
["DevMainBreaker"] = "WS",
["DevPantographFront"] = "Pantograf przedni",
["DevPantographRear"] = "Pantograf tylny",
["DevConverter"] = "Przetwornica",
["DevCompressor"] = "Sprężarka",
["DevLineContactors"] = "Styczniki liniowe",
["DevHeating"] = "Ogrzewanie",
["DevRadio"] = "Radiotelefon",
["DevShuntMode"] = "Jazda manewrowa",
["DevDoorsLeft"] = "Drzwi lewe",
["DevDoorsRight"] = "Drzwi prawe",
["DevSanding"] = "Piasecznica",
["DevHorn"] = "Syrena",
["DevSpringBrake"] = "Hamulec sprężynowy",
["DevAlerter"] = "Czuwak",
["DevWheelSlip"] = "Poślizg",
["DevOverloadRelay"] = "Nadmiarowy",
["DevRadioStop"] = "Radiostop",
["DevAlarmChain"] = "Hamulec bezpieczeństwa",
["TabEvents"] = "Zdarzenia",
["TabTimetable"] = "Rozkład",
["TabSummary"] = "Podsumowanie",
["PanelMap"] = "Mapa",
["PanelTimeline"] = "Przebieg jazdy",
["Relation"] = "{0} → {1}",
["StatDistance"] = "Dystans",
["StatMaxSpeed"] = "Prędkość maks.",
["StatDriven"] = "Jazda użytkownika",
["StatAutopilotSub"] = "autopilot {0}",
["StatOverAi"] = "Ponad AI",
["StatOverAiSub"] = "{0} o >{1:0} km/h · do +{2:0}",
["StatSignals"] = "Sygnalizatory",
["StatSignalsSub"] = "{0} na „Stój”",
["StatStops"] = "Postoje",
["StatStopsSub"] = "{0} pominięte",
["StatDelay"] = "Największe opóźnienie",
["StatDelaySub"] = "przy odjeździe: najwyżej {0}",
["StatPlatform"] = "Postoje poza peronem",
["StatLights"] = "Sygnały czoła i końca",
["StatLightsRight"] = "zgodne",
["StatLightsSub"] = "jak trzeba przez całe {0} jazdy",
["StatLightsHead"] = "czoło {0} zamiast {1}",
["StatLightsTail"] = "koniec {0} zamiast {1}",
["StatPlatformAt"] = "{0} {1:0.0} m",
["StatPlatformNone"] = "na każdym postoju cały skład przy peronie",
["StatHorn"] = "Trąbienie na W6",
["StatHornSub"] = "{0} bez trąbienia",
["StatAcceleration"] = "Przyspieszenie",
["StatAccelerationSub"] = "boczne do {0:0.00} m/s²",
["StatSecurity"] = "Hamowania CA/SHP",
["StatRecording"] = "Nagranie",
["StatComplete"] = "pełne",
["StatIncomplete"] = "w trakcie zapisu lub ucięte",
["Minutes"] = "{0:+0.0;−0.0;0} min",
["OnTime"] = "planowo",
["DelayNow"] = "opóźnienie {0}",
["DelayStanding"] = "{0} stoi w: {1}",
["DelayAfter"] = "{0} za: {1}",
["TimetableNone"] = "Pociąg użytkownika nie miał rozkładu.",
["TtArrived"] = "przyj. {0}",
["TtDeparted"] = "odj. {0}",
["TtPassed"] = "przejazd {0}",
["TtMissed"] = "pominięty postój",
["TtLeftEarly"] = "odjazd przed czasem",
["TtStopShort"] = "{0:0.0} m przed miejscem",
["TtStopPast"] = "{0:0.0} m za miejscem",
["TtStopExact"] = "w punkt",
["TtOnPlatform"] = "cały przy peronie",
["TtOffPlatform"] = "{0:0.0} m składu poza peronem",
["TtTechnical"] = "postój techniczny",
["TtStanding"] = "stoi",
["EventStopped"] = "Postój: {0}, {1}",
["EventStationPassed"] = "Przejazd: {0}",
["EventStationMissed"] = "POMINIĘTY POSTÓJ: {0}",
["EventReady"] = "{0}: czas odjazdu",
["EventHornSounded"] = "W6: zatrąbił",
["EventHornMissed"] = "W6: BEZ TRĄBIENIA",
["EventCab"] = "Kabina {0} w {1}",
["EventSecurityBraking"] = "HAMOWANIE PRZEZ {0}",
["EventTimetable"] = "Rozkład {0}, {1}",
["CabSpeed"] = "Prędkość",
["CabAiTarget"] = "AI {0:0} km/h",
["CabAcceleration"] = "Wzdłużne",
["CabLateral"] = "Boczne",
["CabEndFront"] = "A",
["CabEndRear"] = "B",
["CabDriverUser"] = "prowadzi użytkownik",
["CabDriverAi"] = "autopilot",
["CabOutside"] = "poza kabiną",
["CabLightsHead"] = "czoło",
["CabLightsTail"] = "koniec",
["CabSectionBrakes"] = "Hamulce",
["CabSectionDrive"] = "Napęd",
["DevVigilance"] = "CA",
["DevCabSignal"] = "SHP",
["DevSecurityBraking"] = "Hamowanie CA/SHP",
["LegendStopPoint"] = "W4 – wskaźnik zatrzymania",
["LegendShortStop"] = "W32 – zatrzymanie krótszych pociągów",
["ShortStopHover"] = "W32 {0}",
["LegendHorn"] = "W6 – „trąbić”",
["BandVigilance"] = "CA",
["BandCabSignal"] = "SHP",
["StopPointHover"] = "W4 {0}",
["PlatformHover"] = "peron {0:0} m",
["ShortTrainsHover"] = "dla pociągów do {0:0} m",
["StopHeadHover"] = "czoło ma stanąć {0:0} m przed W4",
["StopMiddleHover"] = "środek składu ma stanąć {0:0} m przed W4",
["HornHover"] = "W6 {0} · {1:0} s",
["ZoomIn"] = "Przybliż",
["ZoomOut"] = "Oddal",
["EventCamera"] = "Kamera: {0}",
["CameraCab"] = "w kabinie",
["CameraExternal"] = "widok zewnętrzny",
["CameraFree"] = "wolna kamera",
["CameraDebug"] = "kamera debugowania",
["EventCoupled"] = "Sprzęgnięto {0} z {1}",
["EventUncoupled"] = "Rozprzęgnięto {0} od {1}",
["EventCouplingChanged"] = "{0} – {1}: {2}",
["CouplingCoupler"] = "sprzęg",
["CouplingBrakePipe"] = "przewód hamulcowy",
["CouplingControl"] = "sterowanie",
["CouplingPower"] = "WN",
["CouplingGangway"] = "mostek",
["CouplingMainPipe"] = "przewód zasilający",
["CouplingHeating"] = "ogrzewanie",
["CouplingNothing"] = "nic",
["BandCamera"] = "kamera",
["LegendCamera"] = "kamera",
["Events"] = "Zdarzenia",
["OnlyUser"] = "tylko użytkownika",
["FileFilter"] = "Czarna skrzynka"
};
private readonly Dictionary<string, string> _texts;
public DefaultBlackBoxStrings() : this(CultureInfo.CurrentUICulture)
{
}
public DefaultBlackBoxStrings(CultureInfo culture) : this(culture.TwoLetterISOLanguageName)
{
}
/// <summary>Polish for "pl", English for any other language.</summary>
public DefaultBlackBoxStrings(string languageCode)
{
_texts = languageCode == "pl" ? Polish : English;
}
/// <summary>The keys there are texts for, for a translation to give them all.</summary>
public static IEnumerable<string> Keys => English.Keys;
public string this[string key] => _texts.TryGetValue(key, out var text) ? text : English.GetValueOrDefault(key, key);
}