Skip to main content

LanguageManager

Allows the default error message translations to be managed.

Assembly: ServiceStack.dll
View Source
Declaration
public class LanguageManager : ILanguageManager

Properties

Enabled

Whether localization is enabled.

View Source
Declaration
public bool Enabled { get; set; }

Culture

Default culture to use for all requests to the LanguageManager. If not specified, uses the current UI culture.

View Source
Declaration
public CultureInfo Culture { get; set; }

Methods

Clear()

Removes all languages except the default.

View Source
Declaration
public void Clear()

GetString(String, CultureInfo)

Gets a translated string based on its key. If the culture is specific and it isn't registered, we try the neutral culture instead. If no matching culture is found to be registered we use English.

View Source
Declaration
public virtual string GetString(string key, CultureInfo culture = null)
Returns

System.String

Parameters
TypeNameDescription
System.StringkeyThe key

| | System.Globalization.CultureInfo | culture | The culture to translate into

|

AddTranslation(String, String, String)

View Source
Declaration
public void AddTranslation(string language, string key, string message)
Parameters
TypeName
System.Stringlanguage
System.Stringkey
System.Stringmessage

Implements