DatabaseExporter wrapped every 50 rows in its own transaction, although the target table already splits a package into statements that fit the provider's parameter limit - so the small default bought nothing and multiplied durable commits and network round trips. The default is raised to 10000, the property documents why, and the localized description is updated in all 39 languages. ExportTests was serialized by DoNotParallelize because its tests shared one fixed table prefix and each dropped and recreated the same tables. Table names are now unique per test, so the attribute is gone and the twelve export legs overlap.
StockSharp.Localization
Overview
StockSharp.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.
Features
- JSON based resources – human readable
strings.jsonholds the default English text for all UI elements and messages. - Source generator – during build
Localization.Generatorconverts the JSON file into strongly typed properties of theLocalizedStringsclass. - Runtime language switching – any number of language packs can be added and activated through
LocalizedStrings.AddLanguageandLocalizedStrings.ActiveLanguage. - Missing translation tracking – the
Missingevent notifies when a resource key or text does not have a translation. - Automatic culture update – setting
ActiveLanguageupdatesThread.CurrentCultureandThread.CurrentUICulture.
Installation
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.
Usage
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;
Extending Language Support
To add your own language:
- Create a
strings.jsonfile with translations where keys match those in the base project. - Include the JSON in a new
.csprojreferencingcommon_lang.props(see examples inLocalization.Langs). - Reference the resulting assembly in your application.
LocalizedStringswill automatically pick it up when available.
Languages can also be loaded dynamically using AddLanguage(string langCode, Stream stream) at runtime.