Table of Contents

Class BobLocalize

Namespace
BlazOrbit.Localization
Assembly
BlazOrbit.Core.dll

Global registry of localization bundles. Each bundle's owning assembly registers itself via a [ModuleInitializer]-marked method emitted by the source generator; consumer code rarely touches this type directly.

public static class BobLocalize
Inheritance
object
BobLocalize

Remarks

The registry is process-wide. Bundles are immutable once registered; re-registering the same TResource replaces the previous entry (handy in hot-reload / test contexts, never expected in production).

Culture changes are signalled via CultureChanged so consumer caches (e.g. rendered output) can invalidate. The culture itself is read from System.Globalization.CultureInfo.CurrentUICulture - this type does not own the active culture.

Properties

AllBundles

Snapshot of every registered bundle. Read-only.

public static IReadOnlyCollection<BobLocalizationBundleSpec> AllBundles { get; }

Property Value

IReadOnlyCollection<BobLocalizationBundleSpec>

Methods

NotifyCultureChanged(CultureInfo)

Notifies subscribers that the active UI culture changed. Called by the localization host integration (Server cookie endpoint, Wasm localStorage handler) after updating System.Globalization.CultureInfo.CurrentUICulture.

public static void NotifyCultureChanged(CultureInfo culture)

Parameters

culture CultureInfo

RegisterBundle(BobLocalizationBundleSpec)

Registers a bundle. The source generator emits a [ModuleInitializer] method that calls this when the owning assembly loads, so bundles are available before any consumer resolves IStringLocalizer<TResource>.

public static void RegisterBundle(BobLocalizationBundleSpec spec)

Parameters

spec BobLocalizationBundleSpec

TryGetBundle(Type, out BobLocalizationBundleSpec?)

Attempts to resolve a registered bundle by its marker type.

public static bool TryGetBundle(Type resourceType, out BobLocalizationBundleSpec? spec)

Parameters

resourceType Type
spec BobLocalizationBundleSpec

Returns

bool

UnregisterBundle(Type)

Removes a registered bundle. Used by tests; not expected in production.

public static bool UnregisterBundle(Type resourceType)

Parameters

resourceType Type

Returns

bool

Events

CultureChanged

Raised after the active culture changes. Consumers - typically components rendering localized strings - subscribe to re-render on switch.

public static event Action<CultureInfo>? CultureChanged

Event Type

Action<CultureInfo>