Files
StockSharp/Localization
mika@stocksharp.com 65a2f1b2eb Complete the Avalonia public samples and the captions the heads need
Finish the sample migration: the tree now carries all 28 public UI heads with
their _fromsrc twins, the shared connector coordinator they were missing, and a
contract suite that runs 72 passed, 0 failed. PublicSampleInventoryTests is the
parity gate - every head must stay present when a public WPF sample is added,
renamed or removed.

Add the 57 captions the Avalonia heads spelled in markup because no resource
said them: the Terminal, Hydra and Designer menus, and the panel labels beneath
them - drive and fields, spread chart, order-log builder, new index and
continuous securities, the analytics source actions, candle build and
timeframes, exchanges, permissions, rollover date, security selection, solution
explorer and the rest. Each one is translated into all 38 languages beside the
English master.

Two captions needed their own names rather than the obvious ones: Suspend
already meant enqueue non ordered, and TaskSettings already held a format
string.
2026-08-28 18:16:38 +03:00
..
2024-08-18 22:03:05 +03:00
2024-08-18 22:42:54 +03:00
2025-09-05 22:47:15 +03:00
2024-08-18 22:42:54 +03:00
2024-08-18 22:42:54 +03:00
2025-07-19 22:52:17 +03:00

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.json holds the default English text for all UI elements and messages.
  • Source generator – during build Localization.Generator converts the JSON file into strongly typed properties of the LocalizedStrings class.
  • Runtime language switching – any number of language packs can be added and activated through LocalizedStrings.AddLanguage and LocalizedStrings.ActiveLanguage.
  • Missing translation tracking – the Missing event notifies when a resource key or text does not have a translation.
  • Automatic culture update – setting ActiveLanguage updates Thread.CurrentCulture and Thread.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:

  1. Create a strings.json file with translations where keys match those in the base project.
  2. Include the JSON in a new .csproj referencing common_lang.props (see examples in Localization.Langs).
  3. Reference the resulting assembly in your application. LocalizedStrings will automatically pick it up when available.

Languages can also be loaded dynamically using AddLanguage(string langCode, Stream stream) at runtime.