Class Localization
Class handling localization.
Assembly: Dalamud.dll
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.
public CultureInfo DalamudLanguageCultureInfo { get; }
Fields
ApplicableLangCodes
Array of language codes which have a valid translation in Dalamud.
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>.
public static CultureInfo GetCultureInfoFromLangCode(string langCode)
Returns
System.Globalization.CultureInfo: The corresponding instance of System.Globalization.CultureInfo.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | langCode | The 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.
public static string Localize(string key, string fallBack)
Returns
System.String: The localized string, fallback or string key if not found.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | key | The string key to be returned. |
System.String | fallBack | The fallback string, usually your source language. |
SetupWithUiCulture()
Set up the UI language with the users' local UI culture.
public void SetupWithUiCulture()
SetupWithFallbacks()
Set up the UI language with "fallbacks" (original English text).
public void SetupWithFallbacks()
SetupWithLangCode(string)
Set up the UI language with the provided language code.
public void SetupWithLangCode(string langCode)
Parameters
| Type | Name | Description |
|---|---|---|
System.String | langCode | The language code to set up the UI language with. |
ExportLocalizable(bool)
Saves localizable JSON data in the current working directory for the provided assembly.
public void ExportLocalizable(bool ignoreInvalidFunctions = false)
Parameters
| Type | Name | Description |
|---|---|---|
System.Boolean | ignoreInvalidFunctions | If set to true, this ignores malformed Localize functions instead of failing. |
Events
LocalizationChanged
Event that occurs when the language is changed.
public event Localization.LocalizationChangedDelegate? LocalizationChanged
Event Type
Dalamud.Localization.LocalizationChangedDelegate