Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Lang Class Reference

Classes

class  Words
 

Public Types

enum  LangCode { None = 0 , JP = 10 , EN = 20 , CN = 30 }
 

Static Public Member Functions

static bool IsBuiltin (string id)
 
static void Init (string lang)
 
static string Get (string id)
 
static bool Has (string id)
 
static string TryGet (string id)
 
static string[] GetList (string id)
 
static string ParseRaw (string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
 
static string Parse (string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
 
static string LoadText (string id)
 
static string _Number (int a)
 
static string _currency (object a, string IDCurrency)
 
static string _currency (object a, bool showUnit=false, int unitSize=14)
 
static string _weight (int a, int b, bool showUnit=true, int unitSize=0)
 
static string _gender (int id)
 
static string _weight (int a, bool showUnit=true, int unitSize=0)
 
static string _rarity (int a)
 
static string _ChangeNum (int prev, int now)
 
static string[] GetDialog (string idSheet, string idTopic)
 

Static Public Attributes

static NaturalStringComparer comparer = new NaturalStringComparer()
 
static bool runUpdate
 
static Words words = new Words()
 
static string langCode = ""
 
static string suffix = ""
 
static string space = ""
 
static List< Dictionary< string, object > > listName
 
static List< Dictionary< string, object > > listAlias
 
static bool isJP
 
static bool isEN
 
static bool isBuiltin
 
static List< char[]> articlesToRemove
 
static LangGeneral General
 
static LangGame Game
 
static LangNote Note
 
static SourceData List
 
static LangSetting setting
 
static ExcelData alias
 
static ExcelData names
 
static ExcelData excelDialog
 

Detailed Description

Definition at line 5 of file Lang.cs.

Member Enumeration Documentation

◆ LangCode

Enumerator
None 
JP 
EN 
CN 

Definition at line 7 of file Lang.cs.

8 {
9 None = 0,
10 JP = 10,
11 EN = 20,
12 CN = 30
13 }

Member Function Documentation

◆ _ChangeNum()

static string Lang._ChangeNum ( int  prev,
int  now 
)
inlinestatic

Definition at line 200 of file Lang.cs.

201 {
202 return prev + " ⇒ " + now;
203 }

Referenced by LittlePopper._OnAddStockpile().

◆ _currency() [1/2]

static string Lang._currency ( object  a,
bool  showUnit = false,
int  unitSize = 14 
)
inlinestatic

Definition at line 167 of file Lang.cs.

168 {
169 return $"{a:#,0}" + ((!showUnit) ? "" : ((unitSize == 0) ? "u_money".lang(a?.ToString() ?? "") : ("<size=" + unitSize + "> " + "u_money".lang(a?.ToString() ?? "") + "</size>")));
170 }

References $.

◆ _currency() [2/2]

◆ _gender()

static string Lang._gender ( int  id)
inlinestatic

Definition at line 177 of file Lang.cs.

178 {
179 return GetList("genders")[id];
180 }
static string[] GetList(string id)
Definition: Lang.cs:114

References GetList().

Referenced by Person.GetDramaTitle(), UICharaMaker.Refresh(), ButtonChara.SetChara(), and Biography.TextBio().

◆ _Number()

static string Lang._Number ( int  a)
inlinestatic

Definition at line 157 of file Lang.cs.

158 {
159 return $"{a:#,0}";
160 }

References $.

Referenced by UIRecipeInfo.RefreshBalance().

◆ _rarity()

static string Lang._rarity ( int  a)
inlinestatic

Definition at line 187 of file Lang.cs.

188 {
189 return a switch
190 {
191 4 => "SSR",
192 3 => "SR",
193 2 => "R",
194 1 => "C",
195 0 => "K",
196 _ => "LE",
197 };
198 }

Referenced by Hoard.Item.Name().

◆ _weight() [1/2]

static string Lang._weight ( int  a,
bool  showUnit = true,
int  unitSize = 0 
)
inlinestatic

Definition at line 182 of file Lang.cs.

183 {
184 return (0.001f * (float)a).ToString("#0.0") + ((!showUnit) ? "" : ((unitSize == 0) ? "s" : ("<size=" + unitSize + "> s</size>")));
185 }

◆ _weight() [2/2]

static string Lang._weight ( int  a,
int  b,
bool  showUnit = true,
int  unitSize = 0 
)
inlinestatic

Definition at line 172 of file Lang.cs.

173 {
174 return (0.001f * (float)a).ToString("#0.0") + "/" + (0.001f * (float)b).ToString("#0.0") + ((!showUnit) ? "" : ((unitSize == 0) ? "s" : ("<size=" + unitSize + "> s</size>")));
175 }

Referenced by InvOwnerDeliver._OnProcess(), UICurrency.Build(), Thing.GetHoverText(), QuestHarvest.GetTextProgress(), ZoneEventHarvest.OnReachTimeLimit(), WindowCharaMini.Refresh(), UIInventory.RefreshGrid(), UIInventory.RefreshList(), WindowChara.RefreshProfile(), ButtonGrid.SetCard(), Thing.ShowSplitMenu(), and Thing.ShowSplitMenu2().

◆ Get()

◆ GetDialog()

static string[] Lang.GetDialog ( string  idSheet,
string  idTopic 
)
inlinestatic

Definition at line 205 of file Lang.cs.

206 {
207 if (excelDialog == null)
208 {
209 string path = CorePath.CorePackage.TextDialog + "dialog.xlsx";
210 excelDialog = new ExcelData();
211 excelDialog.path = path;
212 }
213 excelDialog.BuildMap(idSheet);
214 ExcelData.Sheet sheet = excelDialog.sheets[idSheet];
215 string key = "text" + (isBuiltin ? ("_" + langCode) : "");
216 Dictionary<string, string> dictionary = sheet.map.TryGetValue(idTopic);
217 if (dictionary == null || !dictionary.ContainsKey(key))
218 {
219 return new string[1] { idTopic };
220 }
221 string text = dictionary[key];
222 if (text.IsEmpty())
223 {
224 text = dictionary["text_EN"];
225 }
226 return text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
227 }
Dictionary< string, Dictionary< string, string > > map
Definition: ExcelData.cs:14
Dictionary< string, Sheet > sheets
Definition: ExcelData.cs:25
virtual void BuildMap(string sheetName="_default")
Definition: ExcelData.cs:77
static string langCode
Definition: Lang.cs:28
static ExcelData excelDialog
Definition: Lang.cs:60
static bool isBuiltin
Definition: Lang.cs:42

References ExcelData.BuildMap(), excelDialog, isBuiltin, langCode, ExcelData.Sheet.map, and ExcelData.sheets.

Referenced by DramaCustomSequence.GetText(), and TraitFortuneCookie.OnEat().

◆ GetList()

◆ Has()

static bool Lang.Has ( string  id)
inlinestatic

Definition at line 100 of file Lang.cs.

101 {
102 return General.map.ContainsKey(id);
103 }

References General.

Referenced by Act.GetText(), LayerWorldSetting.Refresh(), ELayer.TryShowHint(), and Thing.WriteNote().

◆ Init()

static void Lang.Init ( string  lang)
inlinestatic

Definition at line 71 of file Lang.cs.

72 {
73 setting = MOD.langs.TryGetValue(lang) ?? MOD.langs["EN"];
74 langCode = lang;
75 isJP = lang == "JP";
76 isEN = lang == "EN";
77 isBuiltin = lang == "JP" || lang == "EN";
78 suffix = ((!isBuiltin) ? "_L" : (isJP ? "_JP" : ""));
79 space = (setting.useSpace ? " " : "");
80 char.TryParse("_comma".lang(), out words.comma);
81 char.TryParse("_period".lang(), out words.period);
82 SourceData.LangSuffix = suffix;
83 articlesToRemove = new List<char[]>();
84 string[] list = GetList("_articlesToRemove");
85 foreach (string text in list)
86 {
87 articlesToRemove.Add(text.ToCharArray());
88 }
89 }
char period
Definition: Lang.cs:19
char comma
Definition: Lang.cs:17
static Words words
Definition: Lang.cs:26
static LangSetting setting
Definition: Lang.cs:54
static string suffix
Definition: Lang.cs:30
static List< char[]> articlesToRemove
Definition: Lang.cs:44
static bool isEN
Definition: Lang.cs:40
static string space
Definition: Lang.cs:32
static bool isJP
Definition: Lang.cs:38
Definition: MOD.cs:7
static Dictionary< string, LangSetting > langs
Definition: MOD.cs:8

References articlesToRemove, Lang.Words.comma, GetList(), isBuiltin, isEN, isJP, langCode, MOD.langs, Lang.Words.period, setting, space, suffix, and words.

Referenced by Core.SetLang().

◆ IsBuiltin()

static bool Lang.IsBuiltin ( string  id)
inlinestatic

Definition at line 62 of file Lang.cs.

63 {
64 if (!(id == "JP"))
65 {
66 return id == "EN";
67 }
68 return true;
69 }

Referenced by ModManager.ParseExtra().

◆ LoadText()

static string Lang.LoadText ( string  id)
inlinestatic

Definition at line 152 of file Lang.cs.

153 {
154 return null;
155 }

◆ Parse()

static string Lang.Parse ( string  idLang,
string  val1,
string  val2 = null,
string  val3 = null,
string  val4 = null,
string  val5 = null 
)
inlinestatic

Definition at line 147 of file Lang.cs.

148 {
149 return ParseRaw(Get(idLang), val1, val2, val3, val4, val5);
150 }
static string Get(string id)
Definition: Lang.cs:91
static string ParseRaw(string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:119

References Get(), and ParseRaw().

Referenced by UIBook.Page.BuildNote(), Cell.GetBlockName(), Cell.GetBridgeName(), Person.GetDramaTitle(), Cell.GetFloorName(), Cell.GetLiquidName(), ClassExtension.lang(), ClassExtension.langPlural(), ContentTop.OnSwitchContent(), ContentHallOfFame.Refresh(), ButtonChara.SetChara(), Biography.TextAppearance(), Biography.TextBio(), Biography.TextBio2(), and Biography.TextBirthDate().

◆ ParseRaw()

static string Lang.ParseRaw ( string  text,
string  val1,
string  val2 = null,
string  val3 = null,
string  val4 = null,
string  val5 = null 
)
inlinestatic

Definition at line 119 of file Lang.cs.

120 {
121 StringBuilder stringBuilder = new StringBuilder(text);
122 stringBuilder.Replace("#1", val1 ?? "");
123 if (val2 != null)
124 {
125 stringBuilder.Replace("#(s2)", (val2.Replace(",", "").ToInt() <= 1) ? "" : "_s".lang());
126 }
127 stringBuilder.Replace("#(s)", (val1.Replace(",", "").ToInt() <= 1) ? "" : "_s".lang());
128 if (val2 != null)
129 {
130 stringBuilder.Replace("#2", val2);
131 }
132 if (val3 != null)
133 {
134 stringBuilder.Replace("#3", val3);
135 }
136 if (val4 != null)
137 {
138 stringBuilder.Replace("#4", val4);
139 }
140 if (val5 != null)
141 {
142 stringBuilder.Replace("#5", val5);
143 }
144 return stringBuilder.ToString();
145 }

Referenced by ZoneEvent.GetText(), Act.GetText(), and Parse().

◆ TryGet()

static string Lang.TryGet ( string  id)
inlinestatic

Definition at line 105 of file Lang.cs.

106 {
107 if (!General.map.ContainsKey(id))
108 {
109 return null;
110 }
111 return Get(id);
112 }

References General, and Get().

Referenced by TraitPerfume.GetName(), TraitPotionRandom.GetName(), and TraitScrollRandom.GetName().

Member Data Documentation

◆ alias

ExcelData Lang.alias
static

Definition at line 56 of file Lang.cs.

◆ articlesToRemove

List<char[]> Lang.articlesToRemove
static

Definition at line 44 of file Lang.cs.

Referenced by Init(), and GameLang.Parse().

◆ comparer

NaturalStringComparer Lang.comparer = new NaturalStringComparer()
static

Definition at line 22 of file Lang.cs.

Referenced by Card.SecondaryCompare(), and LayerEditPCC.SetPortraitSlider().

◆ excelDialog

ExcelData Lang.excelDialog
static

Definition at line 60 of file Lang.cs.

Referenced by GetDialog().

◆ Game

LangGame Lang.Game
static

◆ General

LangGeneral Lang.General
static

Definition at line 46 of file Lang.cs.

Referenced by Get(), Has(), and TryGet().

◆ isBuiltin

◆ isEN

bool Lang.isEN
static

Definition at line 40 of file Lang.cs.

Referenced by Init().

◆ isJP

◆ langCode

◆ List

SourceData Lang.List
static

Definition at line 52 of file Lang.cs.

Referenced by GetList().

◆ listAlias

List<Dictionary<string, object> > Lang.listAlias
static

Definition at line 36 of file Lang.cs.

◆ listName

List<Dictionary<string, object> > Lang.listName
static

Definition at line 34 of file Lang.cs.

◆ names

ExcelData Lang.names
static

Definition at line 58 of file Lang.cs.

◆ Note

LangNote Lang.Note
static

Definition at line 50 of file Lang.cs.

Referenced by Thing.GetName().

◆ runUpdate

bool Lang.runUpdate
static

Definition at line 24 of file Lang.cs.

Referenced by ModManager.ParseExtra().

◆ setting

◆ space

string Lang.space = ""
static

Definition at line 32 of file Lang.cs.

Referenced by Religion.GetTextBenefit(), Init(), and ActEffect.Wish().

◆ suffix

string Lang.suffix = ""
static

Definition at line 30 of file Lang.cs.

Referenced by SourceData< T, T2 >.BaseRow.GetTextArray(), and Init().

◆ words

Words Lang.words = new Words()
static

Definition at line 26 of file Lang.cs.

Referenced by Init(), ClassExtension.StripLastPun(), and ClassExtension.StripPun().


The documentation for this class was generated from the following file: