Class TlumachStringLocalizerFactory
- Namespace
- Tlumach.Extensions.Localization
- Assembly
- Tlumach.Extensions.Localization.dll
Creates instances of TlumachStringLocalizer.
public sealed class TlumachStringLocalizerFactory : IStringLocalizerFactory
- Inheritance
-
TlumachStringLocalizerFactory
- Implements
- Inherited Members
Constructors
TlumachStringLocalizerFactory(ITlumachSettingsProvider)
Initializes a new instance of the TlumachStringLocalizerFactory class using the given configuration provider.
public TlumachStringLocalizerFactory(ITlumachSettingsProvider settingsProvider)
Parameters
settingsProviderITlumachSettingsProviderThe options to use when creating TlumachStringLocalizer instances.
Methods
Create(string, string)
Creates an instance of TlumachStringLocalizer from the default file, embedded into resources of the assembly that is calling this method.
The created localizer uses CurrentCulture for a culture and DotNet text processing mode for texts with placeholders. An application can change either of these settings later by calling WithCulture(CultureInfo) or WithTextProcessingMode(TextFormat) method respectively.
public IStringLocalizer Create(string baseName, string location)
Parameters
Returns
- IStringLocalizer
An instance of TlumachStringLocalizer.
Exceptions
- TlumachException
Thrown if the default file provided in
baseNamewas not found.- ArgumentNullException
Thrown if the
baseNameis null or empty.
Create(Type)
Creates an instance of TlumachStringLocalizer from the options or from the reference to the generated class.
public IStringLocalizer Create(Type resourceSource)
Parameters
resourceSourceTypeThe type of the class created by Tlumach Generator.
Returns
- IStringLocalizer
An instance of TlumachStringLocalizer.
Exceptions
- TlumachException
Thrown if the TranslationManager instance cannot be obtained from the class provided in
resourceSource.