use super::{help_en, keys::Key, network, printer};
pub(super) fn translate(key: Key) -> &'static str {
match key {
Key::MenuFile => "File",
Key::MenuMp => "MP-System",
Key::MenuView => "View",
Key::MenuSettings => "Settings",
Key::MenuHelp => "Help",
Key::HelpShowDocs => "Show help",
Key::HelpAbout => "About",
Key::HelpDialogTitle => "Help",
Key::HelpSearchPlaceholder => "Search help…",
Key::HnAbout => "About",
Key::HnAppearance => "Appearance",
Key::HnArchitecture => "CPU Architecture",
Key::HnArithmeticCommands => "Arithmetic",
Key::HnCommandPanel => "Command Panel",
Key::HnCommandReference => "Command Reference",
Key::HnCommandSummary => "Appendix: Command Summary",
Key::HnControlTransferCommands => "Control Transfer",
Key::HnCpuArchitecture => "KR580VM80 Processor",
Key::HnDataTransferCommands => "Data Transfer",
Key::HnDeviceWorkflow => "Working with Devices",
Key::HnExport => "Export",
Key::HnExternalDevices => "Peripheral Devices",
Key::HnFeatures => "Features",
Key::HnFileFormats => "File Formats",
Key::HnFilesExport => "Export & Files",
Key::HnFlagsRegister => "Flags Register",
Key::HnFloppy => "KR580 Floppy",
Key::HnGeneralPrinciples => "General Principles",
Key::HnGeneralSettings => "General",
Key::HnHdd => "KR580 Hard Disk",
Key::HnImport => "Import",
Key::HnInstructionSet => "Instruction Set",
Key::HnIntroduction => "Introduction",
Key::HnIoCommands => "I/O",
Key::HnLogicalCommands => "Logical",
Key::HnMainMenu => "Main Menu",
Key::HnMainWindow => "Main Window",
Key::HnMemoryIoSpaces => "Memory & I/O Spaces",
Key::HnMemorySearch => "Memory Search",
Key::HnMenuFile => "File Menu",
Key::HnMenuHelp => "Help Menu",
Key::HnMenuMpSystem => "MP-System Menu",
Key::HnMonitor => "KR580 Monitor",
Key::HnNetwork => "KR580 Network Adapter",
Key::HnPrinter => "KR580 Printer",
Key::HnProcessorControlCommands => "Processor Control",
Key::HnProgramInterface => "Program Description",
Key::HnRamEditing => "RAM Editing Panel",
Key::HnRamTable => "RAM Table",
Key::HnRegisterEdit => "Register Editing",
Key::HnRegisterEditing => "Register Editing Panel",
Key::HnRegisters => "Registers",
Key::HnResetButtons => "Reset Buttons",
Key::HnRunButtons => "Run Buttons",
Key::HnSaveLoad => "Save & Load",
Key::HnSchematic => "Structural Diagram",
Key::HnSettings => "Settings",
Key::HnShortcuts => "Keyboard Shortcuts",
Key::HnStackCommands => "Stack",
Key::HnSystemComponents => "MPS Components",
Key::HnSystemComposition => "MP-System Composition",
Key::HnTopicShortcuts => "Shortcuts Table",
Key::HnWorkflow => "Working with the Program",
Key::HcAbout
| Key::HcFeatures
| Key::HcSystemComponents
| Key::HcArchitecture
| Key::HcRegisters
| Key::HcFlagsRegister
| Key::HcMemoryIoSpaces
| Key::HcDataTransferCommands
| Key::HcLogicalCommands
| Key::HcArithmeticCommands
| Key::HcControlTransferCommands
| Key::HcProcessorControlCommands
| Key::HcIoCommands
| Key::HcStackCommands
| Key::HcMainWindow
| Key::HcMenuFile
| Key::HcMenuMpSystem
| Key::HcMenuHelp
| Key::HcSchematic
| Key::HcRamTable
| Key::HcMonitor
| Key::HcFloppy
| Key::HcHdd
| Key::HcNetwork
| Key::HcPrinter
| Key::HcRamEditing
| Key::HcRegisterEditing
| Key::HcResetButtons
| Key::HcCommandPanel
| Key::HcRunButtons
| Key::HcSaveLoad
| Key::HcImport
| Key::HcExport
| Key::HcFileFormats
| Key::HcGeneralSettings
| Key::HcAppearance
| Key::HcGeneralPrinciples
| Key::HcMemorySearch
| Key::HcRegisterEdit
| Key::HcDeviceWorkflow
| Key::HcCommandSummary
| Key::HcShortcuts => help_en::translate(key),
Key::AboutTitle => "About",
Key::AppName => "KR580",
Key::AboutDescription => "Microprocessor system emulator based on the KR580VM80 chip",
Key::AboutVersion => "Version",
Key::AboutGithubLabel => "GitHub",
Key::FileNew => "New file",
Key::FileOpen => "Open",
Key::FileSave => "Save",
Key::FileSaveAs => "Save as",
Key::FileImport => "Import",
Key::FileExport => "Export",
Key::ExportFormatXlsx => "MS Excel",
Key::ExportFormatText => "Text file",
Key::ExportPageLabel => "On page",
Key::ExportPageDefault => "Subprogram 1",
Key::ExportPageNameBase => "Subprogram",
Key::ExportSectionLabel => "In section",
Key::ExportSectionDefault => "Section 1",
Key::ExportSectionNameBase => "Section",
Key::ExportAddPageTooltip => "Add page",
Key::ExportAddSectionTooltip => "Add section",
Key::ExportDeletePageTooltip => "Delete page",
Key::ExportDeleteSectionTooltip => "Delete section",
Key::ExportMemoryGroup => "RAM contents",
Key::ExportRegistersGroup => "Register values",
Key::ExportFlagsGroup => "Flag values",
Key::ExportRangeFrom => "Cells from",
Key::ExportRangeTo => "to",
Key::ExportColumnAddress => "Include \"RAM cell #\" column",
Key::ExportColumnValue => "Include \"RAM cell value\" column",
Key::ExportColumnCommand => "Include \"Command\" column",
Key::ExportColumnComment => "Add empty comments column",
Key::ExportRegisterAccumulator => "Accumulator",
Key::ExportRegisterStackPointer => "Stack pointer",
Key::ExportRegisterProgramCounter => "Program counter",
Key::ExportRegisterCycles => "Tact counter",
Key::ImportSourceGroup => "Import source",
Key::ImportFileLabel => "File",
Key::ImportNoFile => "No file selected",
Key::ImportNoTargets => "The file has no separate sheets or sections",
Key::ImportSheetLabel => "On sheet",
Key::ImportSectionLabel => "In section",
Key::ImportBrowseTooltip => "Choose file",
Key::ImportChooseFileRequired => "Choose a file to import",
Key::MpRunProgram => "Run program",
Key::MpRunInstruction => "Run instruction",
Key::MpRunTact => "Run tact",
Key::MpResetRam => "Clear RAM",
Key::MpResetCpu => "Clear registers",
Key::MpClearHalt => "Clear HLT flag",
Key::DiscardCancel => "Cancel",
Key::DiscardBody => "Unsaved changes will be lost.",
Key::DiscardBodyDeleteHdd => "All data will be lost.",
Key::DiscardTitleOpen => "Open file",
Key::DiscardTitleNew => "New file",
Key::DiscardTitleImport => "Import",
Key::DiscardTitleClose => "Close application",
Key::DiscardTitleDeleteHdd => "Delete HDD file?",
Key::DiscardConfirmOpen => "Open",
Key::DiscardConfirmNew => "Create",
Key::DiscardConfirmImport => "Import",
Key::DiscardConfirmClose => "Close",
Key::DiscardConfirmDeleteHdd => "Delete",
Key::StatusReady => "Ready",
Key::StatusNewFile => "New file",
Key::StatusCpuHalted => "CPU halted",
Key::StatusStopped => "Stopped",
Key::StatusTact => "Tact",
Key::StatusCycle => "cycle",
Key::StatusOpened => "Opened",
Key::StatusSavedTo => "Saved to",
Key::StatusExportTo => "Exported to",
Key::StatusImportFrom => "Imported from",
Key::ErrorPrefix => "Error",
Key::HaltNotice => {
"CPU halted by the HLT instruction\nReset registers or clear the HLT flag"
}
Key::SpeedTitle => "Speed",
Key::SpeedUnit => "instr/sec",
Key::SettingsTitle => "Settings",
Key::SettingsSearchPlaceholder => "Search settings",
Key::SettingsCategoryGeneral => "General",
Key::SettingsCategoryExternalDevices => "External devices",
Key::SettingsCategoryAppearance => "Appearance",
Key::SettingsCategoryShortcuts => "Shortcuts",
Key::SettingsLanguageLabel => "Language",
Key::SettingsLanguageHint => "Application interface language",
Key::SettingsSpeedLabel => "Speed",
Key::SettingsSpeedHint => "Default speed for all files",
Key::SettingsFollowPcLabel => "Follow PC",
Key::SettingsFollowPcHint => "Move highlight with program counter during execution",
Key::SettingsMemoryOperandHighlightingLabel => "Highlight memory operands",
Key::SettingsMemoryOperandHighlightingHint => {
"Color-code instruction operands in the RAM list"
}
Key::SettingsFloppyImageLabel => "Floppy image",
Key::SettingsFloppyImageHint => "Default floppy image loaded on startup",
Key::SettingsFloppyImageBrowse => "Browse…",
Key::SettingsHddDirectoryLabel => "HDD directory",
Key::SettingsHddDirectoryHint => "Default directory for the hard disk buffer file",
Key::SettingsHddDirectoryBrowse => "Browse…",
Key::SettingsFileAssociationLabel => ".580 file association",
Key::SettingsFileAssociationHint => "Open .580 files in KR580 on double-click",
Key::SettingsFileAssociationAdd => "Add",
Key::SettingsFileAssociationRemove => "Remove",
Key::SettingsToggleOn => "On",
Key::SettingsToggleOff => "Off",
Key::SettingsThemeLabel => "Theme",
Key::SettingsThemeHint => "Interface theme",
Key::SettingsThemePlaceholder => "Coming soon",
Key::SettingsShortcutsLabel => "Keyboard shortcuts",
Key::SettingsShortcutsHint => "Customize keyboard shortcuts",
Key::SettingsNoMatches => "No matches",
Key::SettingsReset => "Reset",
Key::SettingsResetConfirmTitle => "Reset settings?",
Key::SettingsResetConfirmBody => "All settings will be restored to their defaults",
Key::SettingsResetConfirmAction => "Reset",
Key::LangRussian => "Russian",
Key::LangEnglish => "English",
Key::SpeedSlow => "Slow",
Key::SpeedMedium => "Medium",
Key::SpeedHigh => "Fast",
Key::SpeedMax => "Max",
Key::HeaderStatus => "Status",
Key::HltOn => "HLT ON",
Key::HltOff => "HLT OFF",
Key::RegistersAndOperands => "Registers and operands",
Key::Accumulator => "Accumulator",
Key::BufferRegister1 => "Buffer register 1",
Key::BufferRegister2 => "Buffer register 2",
Key::AddressBuffer => "Address buffer",
Key::AddressBufferTooltip => "Last 16-bit address driven by the CPU onto the address bus.",
Key::InstructionRegister => "Instruction register",
Key::InstructionRegisterTooltip => {
"Opcode byte of the instruction currently being executed."
}
Key::InstructionDecoder => "Decoder",
Key::InstructionDecoderTooltip => {
"Human-readable mnemonic decoded from the instruction register."
}
Key::ControlSignals => "Control signals",
Key::CurrentCommand => "Current command",
Key::DataBuffer => "Data buffer",
Key::DataBufferTooltip => {
"Last byte that appeared on the CPU's 8-bit data bus. Updated on every memory or I/O read."
}
Key::FlagsRegister => "Flags register",
Key::FlagsRegisterTooltip => {
"Compact PSW flags: S (sign), Z (zero), AC (auxiliary carry), P (parity), C (carry). Bits 1 and 3 are always 0 on the 8080."
}
Key::StatusRegister => "Status register",
Key::PswTooltip => {
"Program status word: accumulator A concatenated with the PSW flag byte. Upper byte is A, lower byte is the flags."
}
Key::StackPointerTooltip => {
"Stack pointer. Points to the top of the program stack in memory; PUSH decreases it, POP increases it."
}
Key::ProgramCounterTooltip => {
"Program counter. Holds the address of the next instruction byte to be fetched."
}
Key::IncDecTooltip => {
"Number of bytes the CPU will add to the program counter after the current instruction finishes."
}
Key::Multiplexer => "Multiplexer",
Key::TempStorageRegisters => "Temporary storage registers",
Key::GeneralPurposeRegisters => "General-purpose registers",
Key::StackPointer => "Stack pointer (SP)",
Key::ProgramCounter => "Program counter (PC)",
Key::IncDec => "Increment-decrement",
Key::LampF2 => {
"Clock phase 2\nThe second half of the internal clock cycle; many control actions are strobed on this edge."
}
Key::LampF1 => {
"Clock phase 1\nThe first half of the internal clock cycle; the CPU starts a new bus state here."
}
Key::LampSync => {
"Synchronisation\nAsserted at the start of a machine cycle to identify the bus transaction type."
}
Key::LampReady => {
"CPU ready\nWhen active, the CPU can finish the bus cycle; when low, it inserts wait states."
}
Key::LampWait => {
"Wait state\nLit when the CPU is stretching a bus cycle because READY is not yet active."
}
Key::LampHold => {
"Hold request\nA peripheral asks the CPU to release the system bus for DMA."
}
Key::LampInt => {
"Interrupt request\nA peripheral is asking for attention; honoured only when INTE is set."
}
Key::LampInte => {
"Interrupts enabled\nWhen set, the CPU will accept a maskable interrupt request (INT)."
}
Key::LampDbin => {
"Data bus input\nThe CPU is reading data from memory or an I/O port onto the data bus."
}
Key::LampWr => {
"Write strobe\nThe CPU is writing data from the accumulator or data bus to memory or I/O."
}
Key::LampHlda => {
"Hold acknowledge\nThe CPU has released the bus and granted it to the requesting DMA controller."
}
Key::CyclesAndTacts => "Cycle and tact",
Key::CycleLabel => "Cycle",
Key::TactLabel => "Tact",
Key::CycleTooltip => "Which step the current instruction is executing. Counts from one.",
Key::TactTooltip => "Tact number within the current step. Counts from one.",
Key::InternalTimings => "Internal timings",
Key::TotalTacts => "Tacts",
Key::InstructionTact => "Instruction tact",
Key::PhaseLabel => "Phase",
Key::TotalTactsTooltip => {
"Total tacts elapsed since the start of the program. Counts from zero."
}
Key::InstructionTactTooltip => {
"Tact number within the current instruction on the full scale (T1, T2, ...). Counts from one."
}
Key::PhaseTooltip => "Same as 'Instruction tact' but counts from zero.",
Key::MemoryListTitle => "RAM contents",
Key::ColumnAddress => "Address",
Key::ColumnValue => "Value",
Key::ColumnCommand => "Command",
Key::MemoryEditorTitle => "RAM cell and value",
Key::RegisterEditorTitle => "Register and value",
Key::ActionPause => "Pause",
Key::ActionRunProgram => "Run program",
Key::ActionRestartProgram => "Restart program",
Key::ActionStepInstruction => "Step instruction",
Key::ActionStepTact => "Step tact",
Key::ActionResetRam => "Reset RAM",
Key::ActionResetCpu => "Reset registers",
Key::ExecutionPanel => "Execution",
Key::ResetPanel => "Reset",
Key::QuickAccess => "Quick access",
Key::DeviceMonitor => "Show monitor",
Key::DeviceFloppy => "Show floppy buffer",
Key::DeviceHdd => "Show HDD buffer",
Key::DeviceNetwork => "Show network buffer",
Key::DevicePrinter => "Show printer buffer",
Key::ViewStackArea => "Show stack memory area",
Key::MonitorUnifiedScreen => "KR580 screen",
Key::MonitorTextLayer => "Text layer",
Key::MonitorPixelLayer => "Graphics layer",
Key::MonitorHexBuffer => "Byte stream",
Key::MonitorClose => "Close",
Key::MonitorDetach => "Detach into a separate window",
Key::MonitorAttach => "Return to the emulator window",
Key::MonitorPin => "Keep above other windows",
Key::MonitorUnpin => "Stop keeping above other windows",
Key::MonitorViewSplit => "Split",
Key::MonitorViewUnified => "Unified",
Key::MonitorClearBuffer => "Clear buffer",
Key::MonitorSaveImage => "Save image",
Key::MonitorImageSaved => "Monitor image saved",
Key::MonitorImageSaveFailed => "Failed to save monitor image",
Key::MonitorHexFilterAll => "Filter: all",
Key::MonitorHexFilterGraphics => "Filter: graphics",
Key::MonitorHexFilterText => "Filter: text",
Key::FloppyContent => "Floppy buffer contents",
Key::FloppyImageContent => "Image contents",
Key::FloppyStatus => "Status",
Key::FloppyPath => "File",
Key::FloppyPathMissing => "no file attached",
Key::FloppyImagePathMissing => "No file attached",
Key::FloppyBytesQueued => "bytes queued",
Key::FloppyClearBuffer => "Clear floppy buffer",
Key::FloppyShowImageContents => "Show image file contents",
Key::FloppyOpenImage => "Open floppy image file",
Key::FloppyDetachImage => "Detach floppy image file",
Key::FloppySaveBuffer => "Save current buffer to file",
Key::FloppyDebugBuffer => "Debug buffer mode",
Key::FloppyImageAttached => "Floppy image attached",
Key::FloppyImageDetached => "Floppy image detached",
Key::FloppyDebugEnabled => "debug mode",
Key::FloppyBufferSaved => "Floppy buffer saved",
Key::HddContent => "HDD buffer contents",
Key::HddImageContent => "File contents",
Key::HddStatus => "Status",
Key::HddPath => "File",
Key::HddPathMissing => "no file attached",
Key::HddImagePathMissing => "No file attached",
Key::HddBytesQueued => "bytes queued",
Key::HddClearBuffer => "Clear HDD buffer",
Key::HddClose => "Close",
Key::HddChooseDirectory => "Choose directory",
Key::HddDebugBuffer => "Debug buffer mode",
Key::HddDeleteFile => "Delete HDD file",
Key::HddCreateFile => "Create HDD file",
Key::HddDebugEnabled => "debug mode",
Key::HddShowImageContents => "Show file contents",
Key::HddFileDeleted => "HDD file deleted",
Key::Network(key) => network::translate_en(key),
Key::Printer(key) => printer::translate_en(key),
Key::DeviceStatusReady => "ready",
Key::DeviceStatusNotReady => "not ready",
Key::DeviceStatusBusy => "busy",
Key::DeviceStatusNoData => "no data",
Key::DeviceStatusConnected => "connected",
Key::DeviceStatusListening => "listening",
Key::DeviceStatusDisconnected => "disconnected",
Key::ColCmdCode => "Code",
Key::ColCmdMnemonic => "Command",
Key::ColCmdOperand => "Operand",
Key::ColCmdLength => "Length",
Key::ColCmdKind => "Kind",
Key::ColCmdAddressing => "Addressing",
Key::CmdLengthByte => "1 byte",
Key::CmdLengthBytes2 => "2 bytes",
Key::CmdLengthBytes3 => "3 bytes",
Key::CmdKindUnknown => "unknown",
Key::CmdKindControl => "control",
Key::CmdKindBranch => "branch",
Key::CmdKindStack => "stack",
Key::CmdKindIo => "I/O",
Key::CmdKindMove => "move",
Key::CmdKindLogic => "logic",
Key::CmdKindArithmetic => "arithmetic",
Key::CmdAddrImplicit => "implicit",
Key::CmdAddrImmediate => "immediate",
Key::CmdAddrDirect => "direct",
Key::CmdAddrIndirect => "indirect",
Key::CmdAddrRegister => "register",
Key::OpcodeSearchPlaceholder => "Search: hex or mnemonic",
Key::StatusByteHeader => "Status byte T1: what the CPU is doing on this tact.",
Key::StatusPrefix => "Status:",
Key::StatusNoProgramAt => "No program at address",
Key::StatusNothingToUndo => "Nothing to undo",
Key::StatusNothingToRedo => "Nothing to redo",
Key::StatusEnterHexPattern => "Enter a hex pattern to search",
Key::StatusInvalidMemoryBytes => "Invalid bytes: use space-separated hex pairs",
Key::StatusMemoryBytesOutOfRange => "The byte sequence does not fit in memory",
Key::StatusPatternFound => "Found pattern",
Key::StatusAtAddress => "at address",
Key::StatusNoMatchesFor => "No addresses match",
Key::ErrNotA580File => "Not a .580 file – only .580 extension is supported",
Key::ErrFileEmpty => "File is empty",
Key::ErrWrong580Size => "Not a valid .580 file (must be exactly 65549 bytes)",
Key::ErrLegacyTrailerCorrupt => "File trailer is corrupted – this is not a valid .580 file",
Key::ErrSettingsNewerVersion => {
"Settings file was saved by a newer version – please update the application"
}
Key::ErrSettingsCorrupt => "Settings file is corrupted",
Key::ErrCannotReadFileFormat => "Failed to read the file – check the format",
Key::ErrCannotReadFile => "Failed to read the file",
Key::ErrCannotWriteTable => "Failed to write the table",
Key::ErrCannotWriteFile => "Failed to write the file",
Key::ErrFileNotFound => "File not found",
Key::ErrPermissionDenied => "Permission denied for file",
Key::ErrFileAlreadyExists => "File already exists",
Key::ErrDiskFull => "Not enough disk space",
Key::ErrIoGeneric => "Read or write error",
Key::ErrAddressOutOfRange => "Address out of memory range",
Key::ErrHddDirectoryNotWritable => "Cannot use this directory – no write permission",
Key::ErrUnknownRegister => "Unknown register name",
Key::ErrUndocumentedOpcode => "Undocumented opcode",
Key::ErrFloppyImageNotAttached => "Floppy image file is not attached",
Key::ErrInternal => "Internal application error",
Key::ErrGenericFailed => "Operation failed",
}
}