Class StringFormatMessageFormatter
- Namespace
- RentADeveloper.ResXLocalization
- Assembly
- ResXLocalization.Core.dll
The default IMessageFormatter: returns a value without arguments unchanged, and formats a value with arguments with Format(IFormatProvider, string, params object[]) in the lookup's culture. Argument names are ignored; only positions count.
public sealed class StringFormatMessageFormatter : IMessageFormatter
- Inheritance
-
StringFormatMessageFormatter
- Implements
- Inherited Members
Fields
Instance
The shared instance, and the default of MessageFormatter.
public static readonly StringFormatMessageFormatter Instance
Field Value
Methods
Format(string, MessageArguments, CultureInfo)
Returns pattern unchanged when arguments is empty;
otherwise formats it as a composite format string with the argument values in
culture. Each value fills the placeholder of its
Position: the argument at position 1 fills {1}, whatever its index
in the enumeration.
public string Format(string pattern, MessageArguments arguments, CultureInfo culture)
Parameters
patternstringThe resolved resource value.
argumentsMessageArgumentsThe arguments of the lookup; never null.
cultureCultureInfoThe culture to format in.
Returns
- string
The formatted string, or
patternwhen there are no arguments.
Exceptions
- FormatException
patternis not a valid composite format string forarguments. The localizer catches it and returns the failure text.