Vixen
dd8b0a81
csharp
public static class Strings

Which language an application is showing, and what each string says in it.

Read the guide page for this →

Remarks

Static, which is the one place in this assembly that is. Every other service is an instance a shell owns, because a document may have two of them; a language is a property of the person using the application rather than of a window, and threading a localiser through every control that shows a word is the design that makes people write the literal instead.

⚠ The catalog in use is a Signal`1, and that is what makes a language change re-label a running interface. Every @expr in a .vxml is a region-scoped Effect, so an expression that reads a string is a consumer of this signal without saying so: Use marks it dirty, the document's next flush re-runs it, and the label changes. No application writes a line of code for that, nothing subscribes, and nothing is asked to restart.

⚠ A label assigned once in C# is not an expression. A control whose constructor writes Button.Label = ControlStrings.Close.Text reads the signal outside any effect, so it shows whatever language was in use when it was built — which is the standard control set's behaviour today. Changed is what such a surface subscribes to in order to rebuild itself, and it is a plain event because a rebuild is a side effect rather than a value.

Fields and properties (2)

  • public static StringCatalog Catalog

    The catalog in use.

  • public static IReadOnlyCollection<string> Missing

    Ids asked for that the current catalog does not have, in id order.

Events (1)

  • public static Action<StringCatalog>? Changed

    Raised after Use changes it.

Methods (3)

  • public static void Use(StringCatalog? catalog)

    Shows the interface in a language.

  • public static string Get(StringId id)

    What a string says in the current language.

  • public static StringCatalog Template(string language, IEnumerable<StringId> ids)

    A catalog holding every string a set of declarations names, for a translator to start from.

Used by (11)

  • AccessibleNameLocalisationTestsVixen.Ui.Controls.Advanced.Tests
  • AccessibleNameLocalisationTestsVixen.Ui.Controls.Tests
  • LocalisationTestsVixen.Ui.Controls.Tests
  • StringFamilyTestsVixen.Ui.Tests
  • StringIdVixen.Ui
  • EditorApplicationVixen.Editor.App
  • EditorShellTestsVixen.Editor.Ui.Tests
  • EditorStringsVixen.Editor.Ui
  • MenuPresenterVixen.Editor.Ui
  • ServiceTestsVixen.Editor.Ui.Tests
  • StringCatalogChainTestsVixen.Editor.App.Tests