Class LocaleExtensions
- Namespace
- MonkeyLoader.Resonite
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Contains helper methods to create Elements.Core.LocaleStrings prefixed with a Id.
public static class LocaleExtensions
- Inheritance
-
LocaleExtensions
- Inherited Members
Properties
CurrentLocale
Gets the latest loaded Elements.Assets.LocaleResource data.
public static LocaleResource CurrentLocale { get; }
Property Value
- LocaleResource
Methods
Format(LocaleString, bool)
Gets the formatted, localized message of this Elements.Core.LocaleString according to the current locale.
public static string? Format(this LocaleString localeString, bool returnNullIfNotFound = false)
Parameters
localeString
LocaleStringThe locale string to get the localized message of.
returnNullIfNotFound
boolWhether to return
null
if the current locale does not have a message for the locale key.
Returns
- string
Elements.Core.LocaleString.content if it's not a locale key; otherwise, the formatted, localized message, or
null
ifreturnNullIfNotFound
istrue
and the key does not have a message.
GetLocaleKey(ConfigSection, string)
public static string GetLocaleKey(this ConfigSection configSection, string key)
Parameters
configSection
ConfigSectionkey
string
Returns
- string
The prefixed locale key.
GetLocaleKey(IDefiningConfigKey, string)
public static string GetLocaleKey(this IDefiningConfigKey configKey, string key)
Parameters
configKey
IDefiningConfigKeykey
string
Returns
- string
The prefixed locale key.
GetLocaleKey(IMonkey, string)
public static string GetLocaleKey(this IMonkey monkey, string key)
Parameters
Returns
- string
The prefixed locale key.
GetLocaleKey(Mod, string)
public static string GetLocaleKey(this Mod mod, string key)
Parameters
Returns
- string
The prefixed locale key.
GetLocaleString(Mod, string, bool, Dictionary<string, object>?)
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, bool continuous, Dictionary<string, object>? arguments = null)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.
GetLocaleString(Mod, string, string?, bool, Dictionary<string, object>?)
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, string? format = null, bool continuous = true, Dictionary<string, object>? arguments = null)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.
GetLocaleString(Mod, string, string, object)
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, string argName, object argField)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.
GetLocaleString(Mod, string, string, string, object)
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, string format, string argName, object argField)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.
GetLocaleString(Mod, string, string, params (string, object)[])
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, string format, params (string, object)[] arguments)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.
GetLocaleString(Mod, string, params (string, object)[])
Uses $"{
as the key to create a Elements.Core.LocaleString using the other arguments.mod
.Id}.{key
}"
public static LocaleString GetLocaleString(this Mod mod, string key, params (string, object)[] arguments)
Parameters
Returns
- LocaleString
The Elements.Core.LocaleString created from the key with the arguments.