Class BobLocalizer<T>
- Namespace
- BlazOrbit.Localization
- Assembly
- BlazOrbit.Core.dll
Adapter that exposes the BOBLocalize runtime as a Microsoft
Microsoft.Extensions.Localization.IStringLocalizer<T>. Components and services continue to inject
IStringLocalizer<TResource> exactly as they did with the resx-based stack -
the registration in AddBlazOrbitLocalization(IServiceCollection, Action<BobLocalizationOptions>?)
reroutes that resolution to this adapter.
public sealed class BobLocalizer<T>
Type Parameters
TBundle marker type - see BobLocalizationBundleAttribute.
- Inheritance
-
objectBobLocalizer<T>
- Extension Methods
Remarks
The adapter holds the bundle spec for T (looked up lazily from
BobLocalize) and caches the resolved provider chain per
System.IServiceProvider scope to avoid repeated DI walks on hot paths.
When the generator is active for the consumer assembly, call sites of the form
Loc["literal"] are intercepted into direct accessor methods that bypass this
adapter entirely - measured in single-digit nanoseconds. This adapter is the dynamic
fallback for runtime-supplied names.
Constructors
BobLocalizer(IServiceProvider)
Creates a localizer scoped to T.
public BobLocalizer(IServiceProvider services)
Parameters
servicesIServiceProvider
Properties
this[string]
Gets the string resource with the given name.
public LocalizedString this[string name] { get; }
Parameters
namestringThe name of the string resource.
Property Value
- LocalizedString
The string resource as a Microsoft.Extensions.Localization.LocalizedString.
this[string, object[]]
Gets the string resource with the given name and formatted with the supplied arguments.
public LocalizedString this[string name, params object[] arguments] { get; }
Parameters
namestringThe name of the string resource.
argumentsobject[]The values to format the string with.
Property Value
- LocalizedString
The formatted string resource as a Microsoft.Extensions.Localization.LocalizedString.
Methods
GetAllStrings(bool)
Gets all string resources.
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
Parameters
includeParentCulturesboolA bool indicating whether to include strings from parent cultures.
Returns
- IEnumerable<LocalizedString>
The strings.