Interface IFormattingInfo
Contains all necessary info for formatting a value
Namespace: UnityEngine.Localization.SmartFormat.Core.Extensions
Syntax
public interface IFormattingInfo
Examples
In "{Items.Length:choose(1,2,3):one|two|three}", the CurrentValue would be the value of "Items.Length", the FormatterOptions would be "1,2,3", and the Format would be "one|two|three".
Properties
Alignment
Alignment inserts spaces into the output to ensure consistent length. Positive numbers insert spaces to the left, to right-align the text. Negative numbers insert spaces to the right, to left-align the text. This should only work with the Default Formatter, but is optional with custom formatters. This is primarily for compatibility with String.Format.
Declaration
int Alignment { get; }
Property Value
Type | Description |
---|---|
Int32 |
CurrentValue
The current value that is to be formatted.
Declaration
object CurrentValue { get; }
Property Value
Type | Description |
---|---|
Object |
Format
This format specifies how to output the CurrentValue.
Declaration
Format Format { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Localization.SmartFormat.Core.Parsing.Format |
FormatDetails
Infrequently used details, often used for debugging
Declaration
FormatDetails FormatDetails { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Localization.SmartFormat.Core.Formatting.FormatDetails |
FormatterOptions
When a named formatter is used, this will hold the options. For example, in "{0:choose(1,2,3):one|two|three}", FormatterOptions is "1,2,3".
Declaration
string FormatterOptions { get; }
Property Value
Type | Description |
---|---|
String |
Placeholder
Contains all the details about the current placeholder.
Declaration
Placeholder Placeholder { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Localization.SmartFormat.Core.Parsing.Placeholder |
Methods
FormattingException(String, FormatItem, Int32)
Creates a FormattingException(String, FormatItem, Int32) associated with the Format.
Declaration
FormattingException FormattingException(string issue, FormatItem problemItem = null, int startIndex = -1)
Parameters
Type | Name | Description |
---|---|---|
String | issue | |
UnityEngine.Localization.SmartFormat.Core.Parsing.FormatItem | problemItem | |
Int32 | startIndex |
Returns
Type | Description |
---|---|
UnityEngine.Localization.SmartFormat.Core.Formatting.FormattingException |
Write(String)
Writes a string to the output.
Declaration
void Write(string text)
Parameters
Type | Name | Description |
---|---|---|
String | text |
Write(String, Int32, Int32)
Writes a substring to the output.
Declaration
void Write(string text, int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
String | text | |
Int32 | startIndex | |
Int32 | length |
Write(Format, Object)
Writes the nested format to the output.
Declaration
void Write(Format format, object value)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Localization.SmartFormat.Core.Parsing.Format | format | |
Object | value |