tModLoader v2024.11
A mod to make and play Terraria mods
LocalizationLoader Class Reference

Classes

class  CommentedWscJsonObject
 

Public Member Functions

record LocalizationEntry (string key, string value, string comment, JsonType type=JsonType.String)
 
record LocalizationFile (string path, string prefix, List< LocalizationEntry > Entries)
 

Static Public Member Functions

static GameCulture string prefix GetCultureAndPrefixFromPath (string path)
 
static void LoadModTranslations (GameCulture culture)
 
static bool TryGetCultureAndPrefixFromPath (string path, [NotNullWhen(true)] out GameCulture? culture, [NotNullWhen(true)] out string? prefix)
 Derives a culture and shared prefix from a localization file path. Prefix will be found after culture, either separated by an underscore or nested in the folder.
Some examples: More...
 

Static Public Attributes

static GameCulture culture
 

Member Function Documentation

◆ TryGetCultureAndPrefixFromPath()

static bool LocalizationLoader.TryGetCultureAndPrefixFromPath ( string  path,
[NotNullWhen(true)] out GameCulture culture,
[NotNullWhen(true)] out string?  prefix 
)
static

Derives a culture and shared prefix from a localization file path. Prefix will be found after culture, either separated by an underscore or nested in the folder.
Some examples:

Localization/en-US_Mods.ExampleMod.hjson Localization/en-US/Mods.ExampleMod.hjson en-US_Mods.ExampleMod.hjson en-US/Mods.ExampleMod.hjson

Parameters
path
culture
prefix
Returns