Class Localization
Class handling localization.
Assembly: Dalamud.dll
View Source
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
public CultureInfo DalamudLanguageCultureInfo { get; }
Fields
ApplicableLangCodes
Array of language codes which have a valid translation in Dalamud.
View Source
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
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.
View Source
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.
View Source
public void SetupWithUiCulture()
SetupWithFallbacks()
Set up the UI language with "fallbacks"(original English text).
View Source
public void SetupWithFallbacks()
SetupWithLangCode(string)
Set up the UI language with the provided language code.
View Source
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.
View Source
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.
View Source
public event Localization.LocalizationChangedDelegate? LocalizationChanged
Event Type
Dalamud.Localization.LocalizationChangedDelegate