public sealed class StringCatalogOne language's worth of editor strings, by id.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A flat id-to-text map, and the flatness is the point. An id is editor.command.file.save — a dotted path that says where the string is used rather than what it says — so a translator's file is diffable, an untranslated entry is a missing key rather than an English string masquerading as a translation, and two places that happen to say "Open" can be translated differently where a language needs them to be.
⚠ A catalog holds no fallbacks. The English text lives beside the id at the declaration — see StringId — so a catalog that is missing an entry falls back to something that is in the source rather than to another file that may also be missing it. This is what makes shipping with no catalog at all work, which is what the editor does today.
Fields and properties (4)
public string LanguageWhich language this is, as a BCP-47 tag.
public int CountHow many strings it has.
public IReadOnlyCollection<string> IdsThe ids it holds, in no particular order.
public static StringCatalog SourceThe catalog used when nothing has been loaded: empty, so every string falls back.
Methods (5)
public StringCatalog(string language)Creates an empty catalog for a language.
public StringCatalog Set(string id, string text)Adds or replaces a string.
public string? Find(string id)What a string says here, or null if this language does not have it.
public string Save()Writes the catalog as YAML.
public static StringCatalog Load(string yaml, string language = "source")Reads a catalog back.
Used by (4)
- EditorShellTestsVixen.Editor.Ui.Tests
- MenuPresenterVixen.Editor.Ui
- ServiceTestsVixen.Editor.Ui.Tests
- StringsVixen.Editor.Ui