Table of Contents

Class Translation

Namespace
Uncreated.Warfare.Translations
Assembly
Uncreated.Warfare.dll

Base class for all translations. Also represents a translation with no arguments.

public class Translation : IDisposable
Inheritance
Translation
Implements
Derived
Inherited Members
Extension Methods

Remarks

Signs should use SignTranslation instead.

Constructors

Translation(string, TranslationOptions)

public Translation(string defaultValue, TranslationOptions options = TranslationOptions.None)

Parameters

defaultValue string
options TranslationOptions

Properties

ArgumentCount

public virtual int ArgumentCount { get; }

Property Value

int

Collection

public TranslationCollection Collection { get; }

Property Value

TranslationCollection

Data

public TranslationData Data { get; }

Property Value

TranslationData

IsInitialized

public bool IsInitialized { get; }

Property Value

bool

Key

public string Key { get; }

Property Value

string

LanguageService

public LanguageService LanguageService { get; }

Property Value

LanguageService

Options

public TranslationOptions Options { get; }

Property Value

TranslationOptions

Original

public TranslationValue Original { get; }

Property Value

TranslationValue

Table

public SharedTranslationDictionary Table { get; }

Property Value

SharedTranslationDictionary

TranslationService

public ITranslationService TranslationService { get; }

Property Value

ITranslationService

Methods

AssertInitialized()

protected void AssertInitialized()

GetArgumentFormat(int)

Returns the format of a given argument index.

public virtual ArgumentFormat GetArgumentFormat(int index)

Parameters

index int

Returns

ArgumentFormat

GetValueForLanguage(LanguageInfo?)

Get the value-set for a given language from the table. Defaults to the default language if null.

public TranslationValue GetValueForLanguage(LanguageInfo? language)

Parameters

language LanguageInfo

Returns

TranslationValue

HasLanguage(LanguageInfo?)

Checks if the translation has a value specifically for language.

public bool HasLanguage(LanguageInfo? language)

Parameters

language LanguageInfo

Returns

bool

UnsafeTranslate(in TranslationArguments, object?[])

Translate using an object[] instead of type-safe generics.

public string UnsafeTranslate(in TranslationArguments arguments, object?[] formatting)

Parameters

arguments TranslationArguments
formatting object[]

Returns

string

Exceptions

ArgumentException

One of the values wasn't the right type.

UnsafeTranslateIntl(in TranslationArguments, object?[])

Overridden in generic translation classes to cast the arguments without reflection.

protected virtual string UnsafeTranslateIntl(in TranslationArguments arguments, object?[] formattingParameters)

Parameters

arguments TranslationArguments
formattingParameters object[]

Returns

string

Remarks

formattingParameters have already been verified to be the correct type by this point.