Class Translation
Contains translation entries that belong to one locale. Each entry is identified by the unique key, which is composed of the key name and the names of all its parent group names joined by dot ".", e.g., "group.subgroup.key". Key names are stored without case conversion but are searched for in a case-insensitive manner.
Implements
Inherited Members
Namespace: Tlumach.Base
Assembly: Tlumach.Base.dll
Syntax
public class Translation : Dictionary<string, TranslationEntry>, IDictionary<string, TranslationEntry>, ICollection<KeyValuePair<string, TranslationEntry>>, IReadOnlyDictionary<string, TranslationEntry>, IReadOnlyCollection<KeyValuePair<string, TranslationEntry>>, IEnumerable<KeyValuePair<string, TranslationEntry>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable
Constructors
Translation(string?, string?)
Initializes a new instance of the Translation class.
Declaration
public Translation(string? locale, string? context = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | locale | An optional locale if one was specified in the translation file. |
| string | context | An optional value of the Context property if one was specified in the translation file. |
Properties
Author
May contain the value of the @@author key of an ARB file.
Declaration
public string? Author { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Context
Contains the context of the file, from which the translation was loaded, if this context was specified in the file. Contexts are specified in ARB files and are supported and preserved by Tlumach converters.
Declaration
public string? Context { get; }
Property Value
| Type | Description |
|---|---|
| string |
CustomProperties
Gets the container that stores custom properties of an ARB file.
Declaration
public Dictionary<string, string> CustomProperties { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, string> |
IsBasicCulture
Gets or sets the indicator that the translation belongs to the "basic" culture. Basic cultures are the ones to which neutral cultures resolve. E.g.: "de-DE" is the basic culture for "de-AT" because "de" resolves to specific culture "de-DE".
Declaration
public bool IsBasicCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LastModified
May contain the value of the @@last_modified key of an ARB file.
Declaration
public DateTime? LastModified { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Locale
Contains the locale of the file, from which the translation was loaded, if this locale was specified in the file.
Declaration
public string? Locale { get; }
Property Value
| Type | Description |
|---|---|
| string |
OriginalAssembly
Optionally contains a reference to the assembly, from which the translation was loaded.
Declaration
public Assembly? OriginalAssembly { get; }
Property Value
| Type | Description |
|---|---|
| Assembly |
OriginalFile
Optionally contains the path to the original file, from which the translation was loaded.
Declaration
public string? OriginalFile { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
SetOrigin(Assembly?, string?)
Sets the source of the translation.
Declaration
public Translation SetOrigin(Assembly? originalAssembly, string? originalFile)
Parameters
| Type | Name | Description |
|---|---|---|
| Assembly | originalAssembly | may specify an assembly if the translation was loaded from assembly resources. |
| string | originalFile | may specify the file if the translation was loaded from a file (and not obtained via the event). |
Returns
| Type | Description |
|---|---|
| Translation | The object, for which the method was called. |