FluentLocalizer 1.1.0
dotnet add package FluentLocalizer --version 1.1.0
NuGet\Install-Package FluentLocalizer -Version 1.1.0
<PackageReference Include="FluentLocalizer" Version="1.1.0" />
<PackageVersion Include="FluentLocalizer" Version="1.1.0" />
<PackageReference Include="FluentLocalizer" />
paket add FluentLocalizer --version 1.1.0
#r "nuget: FluentLocalizer, 1.1.0"
#:package FluentLocalizer@1.1.0
#addin nuget:?package=FluentLocalizer&version=1.1.0
#tool nuget:?package=FluentLocalizer&version=1.1.0
FluentLocalizer
Version 1.1.0 adds a native net11.0 target alongside netstandard2.0, net8.0 and net10.0. Public APIs are unchanged; building this repository requires the .NET 11 SDK.
FluentLocalizer is the core package for building culture-aware translation pipelines in .NET applications. It provides a fluent API around an ITranslationStore, with templates written in the ICU message syntax, runtime arguments, and configurable fallback behavior. Under the hood, templates are parsed and formatted by MessageFormat, the open-source .NET library by Jeff Hansen.
ICU (International Components for Unicode) is the Unicode standard for culture-aware formatting. It defines how languages handle plurals, numbers, dates, and message selection rules, so the same template can adapt to different locales without custom code. The official reference is https://unicode-org.github.io/icu/, and the message formatting guide describes the template syntax. A simple example is a plural rule such as one{# item} vs other{# items}, which is selected automatically for the current culture.
Install
For every public type and member in this package, see the API reference. The online documentation covers templates, requests, culture, errors and logging step by step.
dotnet add package FluentLocalizer
Why use it?
- A fluent builder API for composing translation requests in a readable way
- Culture-aware resolution that follows
CultureInfo.CurrentUICultureautomatically, with fallback cultures handled by the store;WithCulture(...)only forces a different culture for a single request - Templates in the ICU message syntax, including named placeholders,
pluralandselect - Built-in helpers for pluralization, gender-aware formatting, and case transformation
- Support for sync and async resolution, plus custom handling for missing keys and formatting errors
Quick start
The core package defines the translation engine and contracts. You provide a store implementation (for example the official FluentLocalizer.Store.Json package or your own custom ITranslationStore) and then resolve translations through a fluent builder.
using FluentLocalizer;
using System.Collections.Generic;
using System.Globalization;
public sealed class InMemoryStore : ITranslationStore
{
private readonly Dictionary<string, string> _templates = new(StringComparer.OrdinalIgnoreCase)
{
["welcome"] = "Hello {name}!"
};
public Task<string?> GetTemplateAsync(string key, CultureInfo culture, CancellationToken cancellationToken = default)
=> Task.FromResult(_templates.TryGetValue(key, out var value) ? value : null);
public string? GetTemplate(string key, CultureInfo culture)
=> _templates.TryGetValue(key, out var value) ? value : null;
}
var store = new InMemoryStore();
var translator = new Translator(store);
var message = translator
.Get("welcome")
.WithArg("name", "Ada")
.Resolve();
Console.WriteLine(message); // Hello Ada!
Culture selection
You normally don't call WithCulture(...). translator.Get(key) uses CultureInfo.CurrentUICulture, the culture of your user interface, both to look up the template and to format it, with Resolve() and ResolveAsync() alike. Set the UI culture where your application decides the user's language, and every request follows it:
using System.Globalization;
var culture = CultureInfo.GetCultureInfo("it-IT");
CultureInfo.CurrentUICulture = culture; // Translation lookup and message formatting.
CultureInfo.CurrentCulture = culture; // Standard .NET number/date formatting elsewhere in the app.
var message = translator.Get("Welcome").WithArg("name", "Ada").Resolve(); // Italian
WithCulture(...) exists only to force a culture that differs from the UI culture for one message, such as an email written in the recipient's language or a page that shows the same text in several languages:
var subject = translator.Get("Email:Subject").WithCulture(recipientCulture).Resolve();
It affects that request only and never changes CurrentUICulture or CurrentCulture. If you pass the same culture to every request, set CurrentUICulture instead: repeating WithCulture(...) hides the real culture of the application and ignores later language changes.
Get(key) captures the culture when it creates the builder, so create a new builder after changing it. Components that cache rendered text need their own update or rerender. On modern .NET, the ambient culture flows through task-based asynchronous operations.
For application-wide thread defaults, set CultureInfo.DefaultThreadCurrentUICulture and CultureInfo.DefaultThreadCurrentCulture at startup; these do not override explicitly set thread cultures. In ASP.NET Core, app.UseRequestLocalization(...) sets both cultures for each request, so Get(key) already follows the user's language; don't change the process-wide defaults per user.
See Microsoft's CurrentUICulture and CurrentCulture documentation.
ICU message syntax
Templates use the ICU message syntax: named arguments such as {name}, plus plural and select branches that each language can phrase in its own way. FluentLocalizer formats them with MessageFormat, whose documentation lists the ICU features it supports. The fluent API makes it easy to supply the argument values at runtime.
public sealed class InMemoryStore : ITranslationStore
{
private readonly Dictionary<string, string> _templates = new(StringComparer.OrdinalIgnoreCase)
{
["items"] = "You have {quantity, plural, one{# item} other{# items}}.",
["profile"] = "{gender, select, female{She} male{He} other{They}} liked {name}.",
["welcome"] = "Hello {name}!"
};
public Task<string?> GetTemplateAsync(string key, CultureInfo culture, CancellationToken cancellationToken = default)
=> Task.FromResult(_templates.TryGetValue(key, out var value) ? value : null);
public string? GetTemplate(string key, CultureInfo culture)
=> _templates.TryGetValue(key, out var value) ? value : null;
}
var store = new InMemoryStore();
var translator = new Translator(store);
var itemSummary = translator
.Get("items")
.Pluralize(2)
.Resolve();
var profileMessage = translator
.Get("profile")
.WithArg("name", "Ada")
.Genderize(Gender.Female)
.Resolve();
Fluent API in action
You can chain the fluent methods to build expressive translation requests:
var message = translator
.Get("dashboard")
.WithArg("name", "Ada")
.WithArgs(new Dictionary<string, object?>
{
["city"] = "Torino",
["address"] = "Via Montebello 20"
})
.Pluralize(3)
.Genderize(Gender.Female)
.WithCase(LetterCase.PascalCase)
.Resolve();
WithArg and WithArgs use case-insensitive argument names; runtime values override configured default arguments with the same name. Resolve() and ResolveAsync() return the formatted message. Their result depends on the configured missing-key and formatting-error policies, which can return placeholders, configured fallback strings, or throw exceptions. Nothing is looked up until Resolve()/ResolveAsync(); ToString() and the implicit string conversion call Resolve() each time.
Available fluent methods
WithCulture(...)is optional: it forces a culture other thanCurrentUICulturefor the current request onlyWithArg(...)andWithArgs(...)add runtime argumentsPluralize(...)sets thequantityargument used by plural formatting; it is equivalent toWithArg("quantity", ...).Genderize(...)sets thegenderargument used by gender-aware formatting; it is equivalent toWithArg("gender", ...).WithCase(...)applies casing transforms such as upper, lower, camelCase, PascalCase, snake_case, or kebab-caseWithOptions(...)replaces the wholeTranslationOptionsobject for a single request (nullrestores the defaults)Resolve()resolves synchronouslyResolveAsync()resolves asynchronously, passing theCancellationTokento the store
Template and resolution rules
- Every placeholder needs a value: a missing argument is a formatting error (
[Format Error]by default), never empty text.nullvalues print nothing. - Each request starts with
quantity = nullandgender = "unspecified".Pluralize(int)andGenderize(Gender)overwrite them, soDefaultArgumentsentries for these names are never used. Apluralblock treats anullquantity as0. - If a template contains
{Length}and noLengthargument is supplied, it receives the count of non-null arguments, including the built-ingender. selectcompares branch names case-sensitively; enums match by name.pluralandselectneed anotherbranch for unmatched values.#is replaced only directly inside apluralbranch, not inside aselectnested in it: nestpluralinsideselect.- MessageFormat supports
number(default,integer,percent,currency— the currency of the culture),date(default/short,full),time(default,short),selectordinal,offset:and=Nbranches. Other styles are formatting errors. Literal braces are quoted with apostrophes ('{name}'),''prints one apostrophe, backslashes are not escapes. WithCaseruns after formatting.Upper/Loweruse invariant casing; the four identifier casings split words at spaces, punctuation, case and digit boundaries and drop spaces and punctuation.- A
null, empty or whitespace template, or aKeyNotFoundExceptionfrom the store, is a missing translation. Other store exceptions propagate unchanged. WithCulture(null)selectsCultureInfo.CurrentCulture, not the UI culture. Even when the store serves a fallback culture's template, formatting and plural rules use the request culture.Translatoris stateless and thread-safe;TranslationBuilderis mutable and not thread-safe. The translator keeps a reference to itsTranslationOptions, so later changes to that object affect new requests.
Translation options
| Property | Default | Behavior |
|---|---|---|
MissingKeyBehavior |
ReturnPlaceholder |
ReturnPlaceholder returns [key] (ignoring MissingKeyFallbackValue); ReturnConfiguredValue returns MissingKeyFallbackValue; ThrowException throws. |
MissingKeyFallbackValue |
"[{key}]" |
Used with ReturnConfiguredValue. |
MissingKeyExceptionFactory |
null |
(key, culture) => Exception used with ThrowException; must not return null. |
FormattingErrorBehavior |
ReturnPlaceholder |
ReturnPlaceholder returns FormattingErrorFallbackValue; ThrowException throws. |
FormattingErrorFallbackValue |
"[Format Error]" |
Returned for parse and formatting failures. |
FormattingErrorExceptionFactory |
null |
Used with ThrowException; a null result falls back to the missing-key exception. |
DefaultArguments |
null |
Merged into every request; request values win. |
Fallback values replace {key}/{0} and {culture}/{1} case-insensitively, as plain text. The default exception is a TranslationException with Key and Culture; for formatting errors its message includes the formatter's explanation, but InnerException is not set. Custom factory exceptions are thrown as they are. With ThrowException, an empty or whitespace key throws ArgumentException. CreateMissingKeyException and CreateFormattingException return the exception without throwing it.
Logging with ITranslationLogger
FluentLocalizer also supports an optional ITranslationLogger contract. This is useful when you want to observe missing keys, formatting errors, or other translation events while keeping the logging behavior fully under your control.
using FluentLocalizer;
using FluentLocalizer.Logging;
public sealed class ConsoleTranslationLogger : ITranslationLogger
{
public void Log(TranslationLogLevel level, string message, Exception? exception = null)
{
Console.WriteLine($"[{level}] {message}");
if (exception is not null)
{
Console.WriteLine(exception.Message);
}
}
}
The translator writes Debug entries for every request (start, template retrieved — async only —, formatting, completion), a Warning whenever a fallback value is returned, and an Error before an exception leaves Resolve()/ResolveAsync(), including store exceptions. Trace, Information and Critical are not used. Formatting warnings do not include the formatter's message. Stores do not log.
You can pass the logger to the translator when you create it:
var logger = new ConsoleTranslationLogger();
var translator = new Translator(store, options, logger);
Complete configuration example
The following example shows a full setup with a custom store, explicit options, and a logger. It is useful when you want to configure FluentLocalizer once and reuse the translator throughout the application.
using FluentLocalizer;
using FluentLocalizer.Logging;
using System.Collections.Generic;
using System.Globalization;
public sealed class DemoStore : ITranslationStore
{
private readonly Dictionary<string, string> _templates = new(StringComparer.OrdinalIgnoreCase)
{
["welcome"] = "Hello {name}!",
["items"] = "You have {quantity, plural, one{# item} other{# items}}.",
["profile"] = "{gender, select, female{She} male{He} other{They}} liked {name}."
};
public Task<string?> GetTemplateAsync(string key, CultureInfo culture, CancellationToken cancellationToken = default)
=> Task.FromResult(_templates.TryGetValue(key, out var value) ? value : null);
public string? GetTemplate(string key, CultureInfo culture)
=> _templates.TryGetValue(key, out var value) ? value : null;
}
public sealed class DemoLogger : ITranslationLogger
{
public void Log(TranslationLogLevel level, string message, Exception? exception = null)
{
Console.WriteLine($"[{level}] {message}");
}
}
var store = new DemoStore();
var options = new TranslationOptions
{
MissingKeyBehavior = MissingTranslationBehavior.ReturnConfiguredValue,
MissingKeyFallbackValue = "Missing '{key}' for culture '{culture}'.",
FormattingErrorBehavior = FormattingErrorBehavior.ThrowException,
DefaultArguments = new Dictionary<string, object?>
{
["name"] = "Ada"
}
};
var logger = new DemoLogger();
var translator = new Translator(store, options, logger);
var welcome = translator
.Get("welcome")
.Resolve();
var summary = translator
.Get("items")
.Pluralize(2)
.Resolve();
var profile = translator
.Get("profile")
.Genderize(Gender.Female)
.Resolve();
This example shows how the core package can be configured for a real application: default arguments are supplied once, missing keys and formatting errors are handled consistently, and logging is available without needing a DI container.
Async support
var message = await translator
.Get("welcome")
.WithArg("name", "Ada")
.ResolveAsync();
Notes
FluentLocalizer is intentionally small and extensible. It focuses on the translation engine and leaves storage concerns to implementations such as FluentLocalizer.Store.Json or your own custom ITranslationStore.
Acknowledgments
Message parsing and formatting are provided by MessageFormat by Jeff Hansen (@jeffijoe), distributed under the MIT License. Many thanks to its author and contributors. See THIRD-PARTY-NOTICES.md for the full notice.
API reference
Public types and members declared by FluentLocalizer, grouped by package and namespace. Includes constructors, overloads, properties, enum values, inherited library members and deprecated APIs. Standard inherited .NET members are omitted.
Version numbers shown for a type or member refer to the NuGet package named on that type.
Signatures use C# notation; parameter names, defaults, return values and relevant exceptions are described alongside each member. Every type states the version that introduced it; later additions and deprecations are marked on each member, and the changes between versions are listed in the changelog. The searchable WebUI API reference uses the same catalog and can show any earlier version; the changelog lists the changes of every release.
- ITranslator
- Translator
- TranslationBuilder
- TranslationOptions
- ITranslationStore
- TranslationException
- Gender
- LetterCase
- MissingTranslationBehavior
- FormattingErrorBehavior
- ITranslationLogger
- TranslationLogLevel
<a id="api-itranslator"></a>
ITranslator
Kind: interface · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Contract for creating translation requests by key.
Implemented by Translator. Each Get call creates a separate mutable builder.
| Member | Parameters, return value and behavior |
|---|---|
TranslationBuilder Get(string key) |
key is the translation identifier. Returns a new builder; Translator captures CurrentUICulture at this call. A null key throws ArgumentNullException in Translator; empty keys are forwarded to the store. |
<a id="api-translator"></a>
Translator
Kind: class · Package: FluentLocalizer · Namespace: FluentLocalizer · Inherits: ITranslator · Since: 0.0.1
Default ITranslator implementation, combining a store, translation policies and optional logging.
The translator can be reused after a culture change. Create a new builder for each translation; existing builders retain their captured culture.
| Member | Parameters, return value and behavior |
|---|---|
Translator(ITranslationStore store, TranslationOptions? options = null, ITranslationLogger? logger = null) |
store supplies templates and must not be null. options defaults to a new TranslationOptions; logger defaults to no logging. Stores the supplied references. Throws ArgumentNullException for a null store. |
TranslationBuilder Get(string key) |
Returns a new builder for key using the configured store, options and logger. Captures CurrentUICulture for lookup and ICU message formatting. Throws ArgumentNullException for a null key. |
<a id="api-translationbuilder"></a>
TranslationBuilder
Kind: class · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Mutable fluent request that resolves a template, applies arguments and formats the result.
All With*, Pluralize and Genderize methods return the same builder. Culture is captured at construction; WithCulture is optional and affects this request only. Do not share one mutable builder between concurrent operations.
| Member | Parameters, return value and behavior |
|---|---|
TranslationBuilder(ITranslationStore store, string key, TranslationOptions? options = null, CultureInfo? culture = null, ITranslationLogger? logger = null) |
store and key identify the template and cannot be null (ArgumentNullException). options defaults to a new TranslationOptions, culture to CurrentUICulture at construction and logger to no logging. |
TranslationBuilder WithCulture(CultureInfo culture) |
culture overrides lookup and ICU message formatting for this request. Does not change CurrentUICulture or CurrentCulture. Although the parameter is declared non-nullable, passing null currently selects CurrentCulture, not CurrentUICulture. |
TranslationBuilder WithCulture(string cultureName) |
cultureName is a .NET culture name, such as it-IT. Uses CultureInfo.GetCultureInfo. Throws ArgumentNullException for null and CultureNotFoundException for an unrecognized name. |
TranslationBuilder WithOptions(TranslationOptions options) |
Replaces this builder's missing-key, formatting and default-argument policies with options. Passing null resets them to a new TranslationOptions despite the non-nullable signature. |
TranslationBuilder WithArg(string name, object? value) |
Adds or replaces the named argument. Names are case-insensitive; value may be null. Runtime arguments override configured defaults. A null name throws ArgumentNullException. |
TranslationBuilder WithArgs(Dictionary<string, object?> args) |
Merges args into the runtime arguments using WithArg. Matching names are replaced, case-insensitively. A null dictionary is ignored. |
TranslationBuilder Pluralize(int quantity) |
Sets the quantity argument to quantity. Equivalent to WithArg("quantity", quantity); the template's plural expression selects the branch. |
TranslationBuilder Genderize(Gender gender) |
Sets the gender argument to the lowercase enum name (unspecified, male, female or neuter). Equivalent to WithArg with that string; select expressions choose the template branch. |
TranslationBuilder WithCase(LetterCase letterCase) |
Selects a text transformation applied after formatting. Default is AsIs. Upper and Lower use invariant casing; the other transformations split words before recombining them. |
string Resolve() |
Synchronously retrieves and formats the template. Returns a message or the configured fallback. Null, empty, whitespace templates and KeyNotFoundException are treated as missing translations. Missing-key or formatting policies may throw; other store errors propagate. HTTP stores require preloading for synchronous lookup. |
Task<string> ResolveAsync(CancellationToken cancellationToken = default) |
Asynchronously retrieves the template using cancellationToken, then formats it with the builder's captured culture. Returns the message or configured fallback. Resolution policies match Resolve(); store failures and cancellation propagate. |
string ToString() |
Overrides ToString by calling Resolve(). Performs a synchronous lookup each time and has the same fallback and exception behavior. |
static implicit operator string(TranslationBuilder builder) |
Converts builder to a string by calling Resolve(). Supports assignments such as string message = translator.Get("Welcome"); performs synchronous resolution. |
<a id="api-translationoptions"></a>
TranslationOptions
Kind: sealed class · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Policies for missing translations, formatting failures and default arguments.
Fallback strings replace {key} and {0} with the key, and {culture} and {1} with the requested culture name. The builder's default arguments include gender = unspecified and quantity = null.
| Member | Parameters, return value and behavior |
|---|---|
TranslationOptions() |
Creates mutable options with the defaults listed below. |
MissingTranslationBehavior MissingKeyBehavior { get; set; } |
Default: ReturnPlaceholder. Selects placeholder, configured value or exception when the template is missing. |
string MissingKeyFallbackValue { get; set; } |
Default: [{key}]. Used with ReturnConfiguredValue. ReturnPlaceholder always produces [key] independently of this property. |
Func<string, CultureInfo?, Exception>? MissingKeyExceptionFactory { get; set; } |
Default: null. Optional factory receiving key and culture when missing-key behavior is ThrowException. It must return a non-null exception. Its returned exception is thrown; factory errors propagate. |
FormattingErrorBehavior FormattingErrorBehavior { get; set; } |
Default: ReturnPlaceholder. Selects the configured formatting fallback or an exception when a template cannot be parsed or formatted. |
string FormattingErrorFallbackValue { get; set; } |
Default: [Format Error]. Returned with ReturnPlaceholder; supports the fallback tokens described above. |
Func<string, CultureInfo?, Exception>? FormattingErrorExceptionFactory { get; set; } |
Default: null. Factory receiving key and culture with ThrowException. A null result falls back to CreateMissingKeyException; errors thrown by the factory propagate. |
IReadOnlyDictionary<string, object?>? DefaultArguments { get; set; } |
Default: null. Arguments merged into each translation. Runtime values replace matching names without regard to case. |
IReadOnlyDictionary<string, object?> CreateArgumentSet(IReadOnlyDictionary<string, object?>? runtimeArguments) |
Returns a new case-insensitive dictionary merging DefaultArguments and runtimeArguments. Runtime values win; null inputs are allowed and neither input dictionary is modified. |
Exception CreateMissingKeyException(string key, CultureInfo? culture) |
Returns the configured factory result or a TranslationException for key and culture. Direct calls do not throw the returned exception. Rejects null, empty or whitespace keys with ArgumentException (ArgumentNullException for null on modern targets); factory failures propagate. |
Exception CreateFormattingException(string key, CultureInfo? culture, Exception? innerException) |
Returns the configured factory result, or a TranslationException whose message includes innerException.Message when available. The default exception does not attach innerException as InnerException. A null factory result uses CreateMissingKeyException. Key validation and factory failures match CreateMissingKeyException. |
<a id="api-itranslationstore"></a>
ITranslationStore
Kind: interface · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Storage contract returning raw templates before formatting.
Implementations own their fallback rules. A null result or KeyNotFoundException is treated as a missing translation by TranslationBuilder. Other failures propagate.
| Member | Parameters, return value and behavior |
|---|---|
string? GetTemplate(string key, CultureInfo culture) |
key identifies the template; culture selects the translation. Returns the unformatted template or null. Must complete synchronously; cannot rely on asynchronous loading. |
Task<string?> GetTemplateAsync(string key, CultureInfo culture, CancellationToken cancellationToken = default) |
Asynchronous counterpart returning the raw template or null. cancellationToken allows stores performing asynchronous I/O to cancel the operation. |
<a id="api-translationexception"></a>
TranslationException
Kind: class · Package: FluentLocalizer · Namespace: FluentLocalizer · Inherits: Exception · Since: 0.0.1
Exception carrying the translation key and requested culture. Inherits System.Exception.
Standard Exception members, including Message and InnerException, are inherited from .NET.
| Member | Parameters, return value and behavior |
|---|---|
TranslationException(string key, CultureInfo? culture, string message, Exception? innerException = null) |
Creates an exception with the supplied key, optional culture, message and optional innerException. Does not validate the key. |
string Key { get; } |
The translation key supplied to the constructor. |
CultureInfo? Culture { get; } |
The requested culture supplied to the constructor; may be null. |
<a id="api-gender"></a>
Gender
Kind: enum · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Enum values accepted by Genderize.
| Member | Parameters, return value and behavior |
|---|---|
Unspecified |
No explicit gender; supplies unspecified to the template. The default builder value. |
Male |
Supplies male to a select expression. |
Female |
Supplies female to a select expression. |
Neuter |
Supplies neuter to a select expression. |
<a id="api-lettercase"></a>
LetterCase
Kind: enum · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Enum transformations applied after message formatting.
| Member | Parameters, return value and behavior |
|---|---|
AsIs |
Preserves the formatted text; default transformation. |
Upper |
Converts text with ToUpperInvariant. |
Lower |
Converts text with ToLowerInvariant. |
CamelCase |
Joins words in camelCase. |
PascalCase |
Joins words in PascalCase. |
SnakeCase |
Joins lowercase words with underscores. |
KebabCase |
Joins lowercase words with hyphens. |
<a id="api-missingtranslationbehavior"></a>
MissingTranslationBehavior
Kind: enum · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Enum controlling missing-key resolution.
| Member | Parameters, return value and behavior |
|---|---|
ReturnPlaceholder |
Returns [key]; default behavior. |
ThrowException |
Throws the configured missing-key exception or TranslationException. |
ReturnConfiguredValue |
Returns MissingKeyFallbackValue after token replacement. |
<a id="api-formattingerrorbehavior"></a>
FormattingErrorBehavior
Kind: enum · Package: FluentLocalizer · Namespace: FluentLocalizer · Since: 0.0.1
Enum controlling template parsing and formatting failures.
| Member | Parameters, return value and behavior |
|---|---|
ReturnPlaceholder |
Returns FormattingErrorFallbackValue after token replacement; default behavior. |
ThrowException |
Throws the configured formatting exception or TranslationException. |
<a id="api-itranslationlogger"></a>
ITranslationLogger
Kind: interface · Package: FluentLocalizer · Namespace: FluentLocalizer.Logging · Since: 0.0.1
Optional contract for translation diagnostics.
| Member | Parameters, return value and behavior |
|---|---|
void Log(TranslationLogLevel level, string message, Exception? exception = null) |
Writes message at level, with an optional exception. Implement this interface and pass it to Translator, or use the dependency injection logger adapter. |
<a id="api-translationloglevel"></a>
TranslationLogLevel
Kind: enum · Package: FluentLocalizer · Namespace: FluentLocalizer.Logging · Since: 0.0.1
Enum severity levels passed to ITranslationLogger.
| Member | Parameters, return value and behavior |
|---|---|
Trace |
Most verbose tracing. |
Debug |
Detailed resolution diagnostics. |
Information |
Informational events. |
Warning |
Recoverable issues, including fallback results. |
Error |
Failures that stop normal resolution. |
Critical |
Unrecoverable failures. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- MessageFormat (>= 8.0.0)
-
net10.0
- MessageFormat (>= 8.0.0)
-
net11.0
- MessageFormat (>= 8.0.0)
-
net8.0
- MessageFormat (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on FluentLocalizer:
| Package | Downloads |
|---|---|
|
FluentLocalizer.Store.Json
JSON translation stores for FluentLocalizer with culture-aware loading from files, embedded resources, or HTTP. |
|
|
FluentLocalizer.Extensions.DependencyInjection
Dependency injection extensions for registering FluentLocalizer translators, stores, and logging services in .NET applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 175 | 11/16/2026 |
| 1.0.0 | 222 | 10/2/2026 |
| 0.1.0-alpha | 170 | 9/30/2026 |
| 0.0.1 | 224 | 7/30/2026 |
Add a native .NET 11 target while retaining .NET Standard 2.0, .NET 8 and .NET 10 support. Public APIs and translation behavior are unchanged.