RLang class
Il riferimento e' in inglese: viene dai commenti del sorgente di RAVAL, che dalla 2.0 ha nomi e commenti in inglese.
public static class RLangThe texts of the application in the language chosen, changed live.
ProprietÃ
static string Folder { get; }The folder of the language files (null: only the defaults of the code).
static string Language { get; }The language in use, a code as «it», «en», «de» («en» before Open).
static string Extension { get; set; }The extension of new language files: «.json» or «.ini» (.json).
static int BoundCount { get; }How many controls are bound now (the dead ones are dropped at the next change).
Metodi
static void Open(string folder, string language = "")Uses the language files of a folder (created if missing) and the given language («»: the language of the system, as «it»).
static void Use(string language)Changes the language: reads its file, if there is one, updates every bound control and the texts of RAVAL, then tells Changed.
static List<string> Languages()The languages with a file in the folder, by code.
static string T(string key, string def)The text of a key in the language in use: from its file, else from the texts of RAVAL already translated, else the default (which is then written into the file, to be translated).
static string T(string key, string def, params object[] values)The text of a key with values put in its {0}, {1}... (the invariant culture).
static void Save()Writes the texts added to the file now (it is saved by itself anyway).
static void Bind(AvaloniaObject o, AvaloniaProperty p, string key, string def)Binds a property of a control to a key: set now, and again at every change of language.
static T Tr<T>(T c, string key, string def)The text of a control bound to a key: Text of a TextBlock, Header of a menu item or an expander, Title of a window, PlaceholderText of a text box, Content of a button or a check box.
Eventi
event Action ChangedAfter the language has changed (the bound controls are already updated).