Table of Contents

Class Translation

Namespace
Tlumach.Base
Assembly
Tlumach.Base.dll

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.

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
Inheritance
Translation
Implements
Inherited Members

Constructors

Translation(string?, string?, bool)

Initializes a new instance of the Translation class.

public Translation(string? locale, string? context = null, bool keepEntryOrder = false)

Parameters

locale string

An optional locale if one was specified in the translation file.

context string

An optional value of the Context property if one was specified in the translation file.

keepEntryOrder bool

Specifies whether the translation should keep the list of entries in the order in which they exist in the source file.

Properties

Author

May contain the value of the @@author key of an ARB file.

public string? Author { get; set; }

Property Value

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.

public string? Context { get; }

Property Value

string

CreatedBy

May contain the name of the person/entity who created this translation. Used in XLIFF format.

public string? CreatedBy { get; set; }

Property Value

string

CreatedDate

May contain the date when this translation was created. Used in XLIFF format.

public DateTime? CreatedDate { get; set; }

Property Value

DateTime?

CustomProperties

Gets the container that stores custom properties of an ARB file.

public Dictionary<string, string> CustomProperties { get; }

Property Value

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".

public bool IsBasicCulture { get; set; }

Property Value

bool

LastModified

May contain the value of the @@last_modified key of an ARB file.

public DateTime? LastModified { get; set; }

Property Value

DateTime?

LastModifiedBy

May contain the name of the person/entity who last modified this translation. Used in XLIFF format.

public string? LastModifiedBy { get; set; }

Property Value

string

LastModifiedDate

May contain the date of the last modification to this translation. Used in XLIFF format.

public DateTime? LastModifiedDate { get; set; }

Property Value

DateTime?

Locale

Contains the locale of the file, from which the translation was loaded, if this locale was specified in the file.

public string? Locale { get; }

Property Value

string

OrderedEntries

public List<TranslationEntry>? OrderedEntries { get; }

Property Value

List<TranslationEntry>

OriginalAssembly

Optionally contains a reference to the assembly, from which the translation was loaded.

public Assembly? OriginalAssembly { get; }

Property Value

Assembly

OriginalFile

Optionally contains the path to the original file, from which the translation was loaded.

public string? OriginalFile { get; }

Property Value

string

OriginalFilename

Optionally contains just the filename (without path) from which the translation was loaded. Used for file references in formats like XLIFF.

public string? OriginalFilename { get; }

Property Value

string

Phase

May contain the phase of the translation (e.g., "extraction", "translation", "review"). Used in XLIFF format.

public string? Phase { get; set; }

Property Value

string

Methods

Add(string, TranslationEntry)

public void Add(string key, TranslationEntry value)

Parameters

key string
value TranslationEntry

SetOrigin(Assembly?, string?)

Sets the source of the translation.

public Translation SetOrigin(Assembly? originalAssembly, string? originalFile)

Parameters

originalAssembly Assembly

may specify an assembly if the translation was loaded from assembly resources.

originalFile string

may specify the file if the translation was loaded from a file (and not obtained via the event).

Returns

Translation

The object, for which the method was called.