Skip to main content

Class Localization

Class handling localization.

Assembly: Dalamud.dll
View Source
Declaration
public class Localization : IServiceType

Implements:
Dalamud.IServiceType

Properties

DalamudLanguageCultureInfo

Gets an instance of System.Globalization.CultureInfo that corresponds to the language configured from Dalamud Settings.

View Source
Declaration
public CultureInfo DalamudLanguageCultureInfo { get; }

Fields

ApplicableLangCodes

Array of language codes which have a valid translation in Dalamud.

View Source
Declaration
public static readonly string[] ApplicableLangCodes

Methods

GetCultureInfoFromLangCode(string)

Gets an instance of System.Globalization.CultureInfo that corresponds to a Dalamud <code class="paramref">langCode</code>.

View Source
Declaration
public static CultureInfo GetCultureInfoFromLangCode(string langCode)
Returns

System.Globalization.CultureInfo: The corresponding instance of System.Globalization.CultureInfo.

Parameters
TypeNameDescription
System.StringlangCodeThe language code which should be in Dalamud.Localization.ApplicableLangCodes.

Localize(string, string)

Search the set-up localization data for the provided assembly for the given string key and return it. If the key is not present, the fallback is shown. The fallback is also required to create the string files to be localized.

View Source
Declaration
public static string Localize(string key, string fallBack)
Returns

System.String: The localized string, fallback or string key if not found.

Parameters
TypeNameDescription
System.StringkeyThe string key to be returned.
System.StringfallBackThe fallback string, usually your source language.

SetupWithUiCulture()

Set up the UI language with the users' local UI culture.

View Source
Declaration
public void SetupWithUiCulture()

SetupWithFallbacks()

Set up the UI language with "fallbacks"(original English text).

View Source
Declaration
public void SetupWithFallbacks()

SetupWithLangCode(string)

Set up the UI language with the provided language code.

View Source
Declaration
public void SetupWithLangCode(string langCode)
Parameters
TypeNameDescription
System.StringlangCodeThe language code to set up the UI language with.

ExportLocalizable(bool)

Saves localizable JSON data in the current working directory for the provided assembly.

View Source
Declaration
public void ExportLocalizable(bool ignoreInvalidFunctions = false)
Parameters
TypeNameDescription
System.BooleanignoreInvalidFunctionsIf set to true, this ignores malformed Localize functions instead of failing.

Events

LocalizationChanged

Event that occurs when the language is changed.

View Source
Declaration
public event Localization.LocalizationChangedDelegate? LocalizationChanged
Event Type

Dalamud.Localization.LocalizationChangedDelegate

Implements