Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.ModTranslation Class Reference
+ Collaboration diagram for Terraria.ModLoader.ModTranslation:

Public Member Functions

void AddTranslation (int culture, string value)
 
void AddTranslation (string culture, string value)
 
void AddTranslation (GameCulture culture, string value)
 
string GetDefault ()
 
string GetTranslation (int culture)
 
string GetTranslation (string culture)
 
string GetTranslation (GameCulture culture)
 
bool IsDefault ()
 
void SetDefault (string value)
 

Public Attributes

readonly string Key
 

Private Attributes

const int fallback = 1
 
Dictionary< int, string > translations
 

Detailed Description

Definition at line 7 of file ModTranslation.cs.

Member Function Documentation

void Terraria.ModLoader.ModTranslation.AddTranslation ( int  culture,
string  value 
)

Definition at line 25 of file ModTranslation.cs.

25  {
26  translations[culture] = value;
27  }
Dictionary< int, string > translations
void Terraria.ModLoader.ModTranslation.AddTranslation ( string  culture,
string  value 
)

Definition at line 29 of file ModTranslation.cs.

29  {
30  AddTranslation(GameCulture.FromName(culture).LegacyId, value);
31  }
void AddTranslation(int culture, string value)
void Terraria.ModLoader.ModTranslation.AddTranslation ( GameCulture  culture,
string  value 
)

Definition at line 33 of file ModTranslation.cs.

33  {
34  AddTranslation(culture.LegacyId, value);
35  }
void AddTranslation(int culture, string value)
string Terraria.ModLoader.ModTranslation.GetDefault ( )

Definition at line 41 of file ModTranslation.cs.

41  {
42  return GetTranslation(fallback);
43  }
string GetTranslation(int culture)
string Terraria.ModLoader.ModTranslation.GetTranslation ( int  culture)

Definition at line 45 of file ModTranslation.cs.

Referenced by Terraria.ModLoader.ModContent.RefreshModLanguage().

45  {
46  if (translations.ContainsKey(culture)) {
47  return translations[culture];
48  }
49  return translations[fallback];
50  }
Dictionary< int, string > translations

+ Here is the caller graph for this function:

string Terraria.ModLoader.ModTranslation.GetTranslation ( string  culture)

Definition at line 52 of file ModTranslation.cs.

52  {
53  return GetTranslation(GameCulture.FromName(culture).LegacyId);
54  }
string GetTranslation(int culture)
string Terraria.ModLoader.ModTranslation.GetTranslation ( GameCulture  culture)

Definition at line 56 of file ModTranslation.cs.

56  {
57  return GetTranslation(culture.LegacyId);
58  }
string GetTranslation(int culture)
bool Terraria.ModLoader.ModTranslation.IsDefault ( )

Definition at line 37 of file ModTranslation.cs.

37  {
38  return translations[fallback] == Key;
39  }
Dictionary< int, string > translations
void Terraria.ModLoader.ModTranslation.SetDefault ( string  value)

Definition at line 21 of file ModTranslation.cs.

21  {
22  AddTranslation(fallback, value);
23  }
void AddTranslation(int culture, string value)

Member Data Documentation

const int Terraria.ModLoader.ModTranslation.fallback = 1
private

Definition at line 9 of file ModTranslation.cs.

readonly string Terraria.ModLoader.ModTranslation.Key
Dictionary<int, string> Terraria.ModLoader.ModTranslation.translations
private

Definition at line 11 of file ModTranslation.cs.