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
defaultValuestringoptionsTranslationOptions
Properties
ArgumentCount
public virtual int ArgumentCount { get; }
Property Value
Collection
public TranslationCollection Collection { get; }
Property Value
Data
public TranslationData Data { get; }
Property Value
IsInitialized
public bool IsInitialized { get; }
Property Value
Key
public string Key { get; }
Property Value
LanguageService
public LanguageService LanguageService { get; }
Property Value
Options
public TranslationOptions Options { get; }
Property Value
Original
public TranslationValue Original { get; }
Property Value
Table
public SharedTranslationDictionary Table { get; }
Property Value
TranslationService
public ITranslationService TranslationService { get; }
Property Value
Methods
AssertInitialized()
protected void AssertInitialized()
GetArgumentFormat(int)
Returns the format of a given argument index.
public virtual ArgumentFormat GetArgumentFormat(int index)
Parameters
indexint
Returns
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
languageLanguageInfo
Returns
HasLanguage(LanguageInfo?)
Checks if the translation has a value specifically for language.
public bool HasLanguage(LanguageInfo? language)
Parameters
languageLanguageInfo
Returns
UnsafeTranslate(in TranslationArguments, object?[])
Translate using an object[] instead of type-safe generics.
public string UnsafeTranslate(in TranslationArguments arguments, object?[] formatting)
Parameters
argumentsTranslationArgumentsformattingobject[]
Returns
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
argumentsTranslationArgumentsformattingParametersobject[]
Returns
Remarks
formattingParameters have already been verified to be the correct type by this point.