Class TranslationEntry
Represents an entry in the translation file. An entry may have a value (some text in a specific language) or be a reference to an external file with a translation.
Instances of this class are always owned by a dictionary which keeps the keys, and that dictionary is transferred in a way that specifies the locale. For this reason, TranslationEntry does not hold a key or locale ID.
Inherited Members
Namespace: Tlumach.Base
Assembly: Tlumach.Base.dll
Syntax
public class TranslationEntry
Constructors
TranslationEntry()
Initializes a new instance of the TranslationEntry class.
Declaration
public TranslationEntry()
TranslationEntry(string, string?, string?, string?)
Initializes a new instance of the TranslationEntry class.
Declaration
public TranslationEntry(string key, string? text, string? escapedText = null, string? reference = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key to which the translation entry corresponds. |
| string | text | An optional localized text of the translation entry that has been un-escaped if necessary. |
| string | escapedText | An optional localized text of the translation entry that has not been un-escaped. |
| string | reference | An optional reference to an external file with the text. |
Properties
Context
Gets or sets an optional description of the context.
Declaration
public string? Context { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Description
Gets or sets an optional description of the entry.
Declaration
public string? Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Empty
Declaration
public static TranslationEntry Empty { get; }
Property Value
| Type | Description |
|---|---|
| TranslationEntry |
EscapedText
Gets or sets a localized text that has not been un-escaped. This text is used when evaluating if the localized text contains templates and when processing those templates.
Declaration
public string? EscapedText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
IsTemplated
Indicates that the text is a template. When it is, use the ProcessTemplatedValue(CultureInfo, TextFormat, params object?[]) method to format the template.
Declaration
public bool IsTemplated { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Key
Gets the original key of the entry.
Declaration
public string Key { get; }
Property Value
| Type | Description |
|---|---|
| string |
Placeholders
Gets an optional collection of placeholder descriptions.
Declaration
public List<Placeholder>? Placeholders { get; }
Property Value
| Type | Description |
|---|---|
| List<Placeholder> |
Reference
Gets or sets an optional reference to an external file with the translation value.
A reference is set by the parser when the text starts with '@' (at) and the RecognizeFileRefs property is true.
Declaration
public string? Reference { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Screen
Gets or sets an optional reference to a screenshot of the entry.
Declaration
public string? Screen { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SourceText
Gets or sets an optional original text that was translated.
Declaration
public string? SourceText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Target
Gets or sets an optional target of the entry.
Targets are defined in the ARB specification as attributes of HTML elements to which the content should be assigned.
Declaration
public string? Target { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Text
Gets or sets a localized text. This text has been un-escaped (if needed) during loading from the translation file.
Declaration
public string? Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Type
Gets or sets an optional type of the entry.
Describes the type of resource. Possible values are "text", "image", "css".
Declaration
public string? Type { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Video
Gets or sets an optional reference to a video of the entry.
Declaration
public string? Video { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
AddPlaceholder(Placeholder)
Declaration
public void AddPlaceholder(Placeholder placeholder)
Parameters
| Type | Name | Description |
|---|---|---|
| Placeholder | placeholder |
InternalProcessTemplatedValue(Func<string, int, object?>, CultureInfo, TextFormat)
Declaration
public string InternalProcessTemplatedValue(Func<string, int, object?> getParamValueFunc, CultureInfo culture, TextFormat textProcessingMode = TextFormat.None)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<string, int, object> | getParamValueFunc | |
| CultureInfo | culture | |
| TextFormat | textProcessingMode |
Returns
| Type | Description |
|---|---|
| string |
Lock()
For internal use only.
Declaration
public void Lock()
ProcessTemplatedValue(CultureInfo, TextFormat, IDictionary<string, object?>)
Declaration
public string ProcessTemplatedValue(CultureInfo culture, TextFormat textProcessingMode, IDictionary<string, object?> parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | |
| TextFormat | textProcessingMode | |
| IDictionary<string, object> | parameters |
Returns
| Type | Description |
|---|---|
| string |
ProcessTemplatedValue(CultureInfo, TextFormat, OrderedDictionary)
Declaration
public string ProcessTemplatedValue(CultureInfo culture, TextFormat textProcessingMode, OrderedDictionary parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | |
| TextFormat | textProcessingMode | |
| OrderedDictionary | parameters |
Returns
| Type | Description |
|---|---|
| string |
ProcessTemplatedValue(CultureInfo, TextFormat, object)
Declaration
public string ProcessTemplatedValue(CultureInfo culture, TextFormat textProcessingMode, object parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | |
| TextFormat | textProcessingMode | |
| object | parameters |
Returns
| Type | Description |
|---|---|
| string |
ProcessTemplatedValue(CultureInfo, TextFormat, params object?[])
Declaration
public string ProcessTemplatedValue(CultureInfo culture, TextFormat textProcessingMode, params object?[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | |
| TextFormat | textProcessingMode | |
| object[] | parameters |
Returns
| Type | Description |
|---|---|
| string |
Unlock()
For internal use only.
Declaration
public void Unlock()