10 Commits
Author SHA1 Message Date
mika@stocksharp.com e3a115b7b1 Let a language be read while another is being registered
The language registry kept a dictionary of codes to indices beside a list of
translations, and mutated both without synchronisation while every localized
string in the product read them. Removing a language renumbered the rest, so a
reader could take an index under one numbering and read the list under another -
not a torn read but a wrong answer, one language's text returned under another's
code, and an index out of range when the list had shrunk.

A language is now addressed by its code rather than by a position, so there is
nothing left to renumber. Writers build the next map and publish it with a
single assignment under a lock, never touching a map that has been published;
a reader takes one snapshot and reads it to the end, so resolving the active
language and translating against it can no longer disagree. Lookups stay free of
locks and of interlocked operations, which matters on a path every string takes.

The generated properties had the same defect one floor up: each cached its text
in a field that ResetCache set back to null, so a reader that began before a
language changed could write its stale word into the cache afterwards and leave
it there for good. The cache is now an object that is replaced whole, published
after the registry, so a reader that sees the new cache sees the new registry
too.

Four tests were leaving process-wide registrations behind them for whatever ran
next, and two of those ran in the parallel phase.
2026-09-19 14:00:02 +03:00
mika@stocksharp.com d9f1eb3949 Stabilize configuration alerts and generated resources 2026-09-13 18:03:23 +03:00
mikasoukhov 874c2554d7 Fix duplicates check 2024-08-24 22:43:35 +03:00
mikasoukhov fd3561d1c7 Localization. Extra langs moved to separated projects. 2024-04-28 22:03:18 +03:00
mikasoukhov 78eb32a26e Incremental source generators. 2023-08-15 15:41:02 +03:00
mikasoukhov 25c3bd1fea LocalizedStrings. ResetCache method. 2023-05-02 19:56:06 +03:00
mikasoukhov ff46ef6220 Fix commit cb14631a3a 2023-02-22 00:37:37 +03:00
mikasoukhov 9d3c8c9884 Code cleanup. 2022-09-24 14:25:55 +03:00
mikasoukhov 93d70ec327 Build fix. 2022-09-10 17:26:40 +03:00
mikasoukhov cb14631a3a Localization.Generator 2022-08-14 23:30:23 +03:00