Elin Decompiled Documentation EA 23.306 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 ExcelData.Sheet GetDialogSheet (string idSheet)
 
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
 
static HashSet< string > extraExcelDialogs = new HashSet<string>()
 

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 202 of file Lang.cs.

203 {
204 return prev + " ⇒ " + now;
205 }

Referenced by LittlePopper._OnAddStockpile().

◆ _currency() [1/2]

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

Definition at line 169 of file Lang.cs.

170 {
171 return $"{a:#,0}" + ((!showUnit) ? "" : ((unitSize == 0) ? "u_money".lang(a?.ToString() ?? "") : ("<size=" + unitSize + "> " + "u_money".lang(a?.ToString() ?? "") + "</size>")));
172 }
$
Definition: ModManager.cs:87

References $.

◆ _currency() [2/2]

◆ _gender()

static string Lang._gender ( int  id)
inlinestatic

Definition at line 179 of file Lang.cs.

180 {
181 return GetList("genders")[id];
182 }
static string[] GetList(string id)
Definition: Lang.cs:116

References GetList().

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

◆ _Number()

static string Lang._Number ( int  a)
inlinestatic

Definition at line 159 of file Lang.cs.

160 {
161 return $"{a:#,0}";
162 }

References $.

Referenced by UIRecipeInfo.RefreshBalance().

◆ _rarity()

static string Lang._rarity ( int  a)
inlinestatic

Definition at line 189 of file Lang.cs.

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

Referenced by Hoard.Item.Name().

◆ _weight() [1/2]

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

Definition at line 184 of file Lang.cs.

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

◆ _weight() [2/2]

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

Definition at line 174 of file Lang.cs.

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

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 248 of file Lang.cs.

249 {
250 Dictionary<string, string> dictionary = GetDialogSheet(idSheet).map.TryGetValue(idTopic);
251 if (dictionary == null)
252 {
253 return new string[1] { idTopic };
254 }
255 string key = "text_" + langCode;
256 string text = dictionary.GetValueOrDefault(key) ?? dictionary.GetValueOrDefault("text");
257 if (text.IsEmpty())
258 {
259 text = dictionary["text_EN"];
260 }
261 return text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
262 }
static string langCode
Definition: Lang.cs:28
static ExcelData.Sheet GetDialogSheet(string idSheet)
Definition: Lang.cs:207

References GetDialogSheet(), and langCode.

Referenced by DramaCustomSequence.GetText(), BottleMessageList.Init(), TraitFortuneCookie.OnEat(), and TraitASMR.Update().

◆ GetDialogSheet()

static ExcelData.Sheet Lang.GetDialogSheet ( string  idSheet)
inlinestatic

Definition at line 207 of file Lang.cs.

208 {
209 if (excelDialog == null)
210 {
211 excelDialog = new ExcelData(CorePath.CorePackage.TextDialog + "dialog.xlsx");
213 List<ExcelData> list = new List<ExcelData>();
214 if (!isBuiltin)
215 {
216 list.Add(new ExcelData(CorePath.CorePackage.TextDialogLocal + "dialog.xlsx"));
217 }
218 foreach (string extraExcelDialog in extraExcelDialogs)
219 {
220 list.Add(new ExcelData(extraExcelDialog));
221 }
222 for (int i = 0; i < excelDialog.book.NumberOfSheets; i++)
223 {
224 string sheetName = excelDialog.book.GetSheetAt(i).SheetName;
225 excelDialog.BuildMap(sheetName);
226 foreach (ExcelData item in list)
227 {
228 item.BuildMap(sheetName);
229 ExcelData.Sheet sheet = item.sheets[sheetName];
230 if (item.book.GetSheet(sheetName) == null)
231 {
232 sheet.list.Clear();
233 sheet.map.Clear();
234 }
235 foreach (var (text2, value) in sheet.map)
236 {
237 if (!text2.IsEmpty())
238 {
239 excelDialog.sheets[sheetName].map[text2] = value;
240 }
241 }
242 }
243 }
244 }
245 return excelDialog.sheets[idSheet];
246 }
static string TextDialog
Definition: CorePath.cs:51
static string TextDialogLocal
Definition: CorePath.cs:53
List< Dictionary< string, string > > list
Definition: ExcelData.cs:16
Dictionary< string, Dictionary< string, string > > map
Definition: ExcelData.cs:14
Dictionary< string, Sheet > sheets
Definition: ExcelData.cs:25
void LoadBook()
Definition: ExcelData.cs:49
virtual void BuildMap(string sheetName="_default")
Definition: ExcelData.cs:77
XSSFWorkbook book
Definition: ExcelData.cs:21
static ExcelData excelDialog
Definition: Lang.cs:60
static HashSet< string > extraExcelDialogs
Definition: Lang.cs:62
static bool isBuiltin
Definition: Lang.cs:42

References ExcelData.book, ExcelData.BuildMap(), excelDialog, extraExcelDialogs, isBuiltin, item, ExcelData.Sheet.list, ExcelData.LoadBook(), ExcelData.Sheet.map, ExcelData.sheets, CorePath.CorePackage.TextDialog, and CorePath.CorePackage.TextDialogLocal.

Referenced by GetDialog(), DramaCustomSequence.HasTopic(), and TraitASMR.OnCreate().

◆ GetList()

◆ Has()

static bool Lang.Has ( string  id)
inlinestatic

Definition at line 102 of file Lang.cs.

103 {
104 return General.map.ContainsKey(id);
105 }

References General.

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

◆ Init()

static void Lang.Init ( string  lang)
inlinestatic

Definition at line 73 of file Lang.cs.

74 {
75 setting = MOD.langs.TryGetValue(lang) ?? MOD.langs["EN"];
76 langCode = lang;
77 isJP = lang == "JP";
78 isEN = lang == "EN";
79 isBuiltin = lang == "JP" || lang == "EN";
80 suffix = ((!isBuiltin) ? "_L" : (isJP ? "_JP" : ""));
81 space = (setting.useSpace ? " " : "");
82 char.TryParse("_comma".lang(), out words.comma);
83 char.TryParse("_period".lang(), out words.period);
84 SourceData.LangSuffix = suffix;
85 articlesToRemove = new List<char[]>();
86 string[] list = GetList("_articlesToRemove");
87 foreach (string text in list)
88 {
89 articlesToRemove.Add(text.ToCharArray());
90 }
91 }
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 64 of file Lang.cs.

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

Referenced by ModPackage.AddOrUpdateLang().

◆ LoadText()

static string Lang.LoadText ( string  id)
inlinestatic

Definition at line 154 of file Lang.cs.

155 {
156 return null;
157 }

◆ 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 149 of file Lang.cs.

150 {
151 return ParseRaw(Get(idLang), val1, val2, val3, val4, val5);
152 }
static string Get(string id)
Definition: Lang.cs:93
static string ParseRaw(string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:121

References Get(), and ParseRaw().

Referenced by UIBook.Page.BuildNote(), Cell.GetBlockName(), Cell.GetBridgeName(), Cell.GetFloorName(), Cell.GetLiquidName(), ClassExtension.lang(), ClassExtension.langPlural(), ContentTop.OnSwitchContent(), ContentHallOfFame.Refresh(), Biography.TextAge(), Biography.TextAppearance(), 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 121 of file Lang.cs.

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

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

◆ TryGet()

static string Lang.TryGet ( string  id)
inlinestatic

Definition at line 107 of file Lang.cs.

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

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

◆ excelDialog

ExcelData Lang.excelDialog
static

Definition at line 60 of file Lang.cs.

Referenced by GetDialogSheet().

◆ extraExcelDialogs

HashSet<string> Lang.extraExcelDialogs = new HashSet<string>()
static

Definition at line 62 of file Lang.cs.

Referenced by GetDialogSheet(), and ModManager.ImportAllModDialogs().

◆ 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 ModPackage.AddOrUpdateLang().

◆ setting

◆ space

string Lang.space = ""
static

Definition at line 32 of file Lang.cs.

Referenced by CardRow.GetName(), Religion.GetTextBenefit(), and Init().

◆ suffix

string Lang.suffix = ""
static

Definition at line 30 of file Lang.cs.

Referenced by 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: