Table of Contents

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 LocaleString

The locale string to get the localized message of.

returnNullIfNotFound bool

Whether 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 if returnNullIfNotFound is true and the key does not have a message.

GetLocaleKey(ConfigSection, string)

Creates a locale key prefixed with the FullId in the format: $"{configSection.FullId}.{key}".

public static string GetLocaleKey(this ConfigSection configSection, string key)

Parameters

configSection ConfigSection
key string

Returns

string

The prefixed locale key.

GetLocaleKey(IDefiningConfigKey, string)

Creates a locale key prefixed with the FullId in the format: $"{configKey.FullId}.{key}".

public static string GetLocaleKey(this IDefiningConfigKey configKey, string key)

Parameters

configKey IDefiningConfigKey
key string

Returns

string

The prefixed locale key.

GetLocaleKey(IMonkey, string)

Creates a locale key prefixed with the monkey's FullId in the format: $"{monkey.FullId}.{key}".

public static string GetLocaleKey(this IMonkey monkey, string key)

Parameters

monkey IMonkey
key string

Returns

string

The prefixed locale key.

GetLocaleKey(Mod, string)

Creates a locale key prefixed with the Id in the format: $"{mod.Id}.{key}".

public static string GetLocaleKey(this Mod mod, string key)

Parameters

mod Mod
key string

Returns

string

The prefixed locale key.

GetLocaleString(Mod, string, bool, Dictionary<string, object>?)

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, bool continuous, Dictionary<string, object>? arguments = null)

Parameters

mod Mod
key string
continuous bool
arguments Dictionary<string, object>

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.

GetLocaleString(Mod, string, string?, bool, Dictionary<string, object>?)

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, string? format = null, bool continuous = true, Dictionary<string, object>? arguments = null)

Parameters

mod Mod
key string
format string
continuous bool
arguments Dictionary<string, object>

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.

GetLocaleString(Mod, string, string, object)

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, string argName, object argField)

Parameters

mod Mod
key string
argName string
argField object

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.

GetLocaleString(Mod, string, string, string, object)

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, string format, string argName, object argField)

Parameters

mod Mod
key string
format string
argName string
argField object

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.

GetLocaleString(Mod, string, string, params (string, object)[])

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, string format, params (string, object)[] arguments)

Parameters

mod Mod
key string
format string
arguments (string, object)[]

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.

GetLocaleString(Mod, string, params (string, object)[])

Uses $"{mod.Id}.{key}" as the key to create a Elements.Core.LocaleString using the other arguments.

public static LocaleString GetLocaleString(this Mod mod, string key, params (string, object)[] arguments)

Parameters

mod Mod
key string
arguments (string, object)[]

Returns

LocaleString

The Elements.Core.LocaleString created from the key with the arguments.