Localization components. More info on web site https://stocksharp.com/store/
$ dotnet add package StockSharp.LocalizationStockSharp.Localization provides a flexible and extensible localization system for the entire StockSharp framework. The package contains the default English resources and utilities for switching languages at runtime. It works together with language specific packages located in Localization.Langs.
strings.json holds the default English text for all UI elements and messages.Localization.Generator converts the JSON file into strongly typed properties of the LocalizedStrings class.LocalizedStrings.AddLanguage and LocalizedStrings.ActiveLanguage.Missing event notifies when a resource key or text does not have a translation.ActiveLanguage updates Thread.CurrentCulture and Thread.CurrentUICulture.Add StockSharp.Localization as a NuGet package to your project. To include additional languages, reference the corresponding package such as StockSharp.Localization.ru or the meta package StockSharp.Localization.All.
The source generator is included automatically and requires no manual configuration.
Retrieve a localized string via the generated properties:
// get text for the current language
string text = LocalizedStrings.About;
// explicitly translate from one language to another
string russian = "About".Translate(from: LocalizedStrings.EnCode, to: LocalizedStrings.RuCode);
Switch the active language at runtime:
// change UI culture to Russian
LocalizedStrings.ActiveLanguage = LocalizedStrings.RuCode;To add your own language:
strings.json file with translations where keys match those in the base project..csproj referencing common_lang.props (see examples in Localization.Langs).LocalizedStrings will automatically pick it up when available.Languages can also be loaded dynamically using AddLanguage(string langCode, Stream stream) at runtime.