using System; namespace Clave.Glass { /// /// The words a bindings screen shows, for an app to translate. /// public class KeyBindingsText { public static readonly KeyBindingsText English = new KeyBindingsText(); public string CapturePrompt { get; init; } = "Press keys..."; public string AddChord { get; init; } = "+ Add"; public string RemoveChord { get; init; } = "x"; public string Undo { get; init; } = "Undo"; public string ResetToDefaults { get; init; } = "Reset to defaults"; /// /// Gets the note for a binding that fires along with another, with {0} for what the other does. /// public string BothFireFormat { get; init; } = "Also {0}"; /// /// Gets the note for a binding whose keys go to something else first, with {0} for what that does. /// public string HiddenByFormat { get; init; } = "Taken by {0}"; /// /// Gets what a clash names a binding that has no name. /// public string Unnamed { get; init; } = "another shortcut"; /// /// Gets the note under a binding that clashes, with {0} for the binding's keys and {1} for its clashes. /// public string ClashNoteFormat { get; init; } = "{0}: {1}"; /// /// Gets the text between two clashes in one note. /// public string ClashSeparator { get; init; } = ". "; public string Describe(KeyClash clash) { string name = clash.Name ?? Unnamed; switch (clash.Kind) { case ChordConflictKind.BothFire: return string.Format(BothFireFormat, name); case ChordConflictKind.HiddenBy: return string.Format(HiddenByFormat, name); default: throw new ArgumentOutOfRangeException(nameof(clash), clash.Kind, "A bindings screen shows no such clash."); } } } }