Elin Decompiled Documentation EA 23.289 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 6 of file Lang.cs.

Member Enumeration Documentation

◆ LangCode

Enumerator
None 
JP 
EN 
CN 

Definition at line 8 of file Lang.cs.

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

Member Function Documentation

◆ _ChangeNum()

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

Definition at line 203 of file Lang.cs.

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

Referenced by LittlePopper._OnAddStockpile().

◆ _currency() [1/2]

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

Definition at line 170 of file Lang.cs.

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

References $.

◆ _currency() [2/2]

◆ _gender()

static string Lang._gender ( int  id)
inlinestatic

Definition at line 180 of file Lang.cs.

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

References GetList().

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

◆ _Number()

static string Lang._Number ( int  a)
inlinestatic

Definition at line 160 of file Lang.cs.

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

References $.

Referenced by UIRecipeInfo.RefreshBalance().

◆ _rarity()

static string Lang._rarity ( int  a)
inlinestatic

Definition at line 190 of file Lang.cs.

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

Referenced by Hoard.Item.Name().

◆ _weight() [1/2]

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

Definition at line 185 of file Lang.cs.

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

◆ _weight() [2/2]

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

Definition at line 175 of file Lang.cs.

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

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

241 {
242 Dictionary<string, string> dictionary = GetDialogSheet(idSheet).map.TryGetValue(idTopic);
243 if (dictionary == null)
244 {
245 return new string[1] { idTopic };
246 }
247 string key = "text_" + langCode;
248 string text = dictionary.GetValueOrDefault(key) ?? dictionary.GetValueOrDefault("text");
249 if (text.IsEmpty())
250 {
251 text = dictionary["text_EN"];
252 }
253 return text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
254 }
static string langCode
Definition: Lang.cs:29
static ExcelData.Sheet GetDialogSheet(string idSheet)
Definition: Lang.cs:208

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

209 {
210 if (excelDialog == null)
211 {
212 excelDialog = new ExcelData(CorePath.CorePackage.TextDialog + "dialog.xlsx");
214 for (int i = 0; i < excelDialog.book.NumberOfSheets; i++)
215 {
216 string sheetName = excelDialog.book.GetSheetAt(i).SheetName;
217 excelDialog.BuildMap(sheetName);
218 foreach (ExcelData item in extraExcelDialogs.Select((string f) => new ExcelData(f)))
219 {
220 item.BuildMap(sheetName);
221 ExcelData.Sheet sheet = item.sheets[sheetName];
222 if (item.book.GetSheet(sheetName) == null)
223 {
224 sheet.list.Clear();
225 sheet.map.Clear();
226 }
227 foreach (var (text2, value) in sheet.map)
228 {
229 if (!text2.IsEmpty())
230 {
231 excelDialog.sheets[sheetName].map[text2] = value;
232 }
233 }
234 }
235 }
236 }
237 return excelDialog.sheets[idSheet];
238 }
static string TextDialog
Definition: CorePath.cs:52
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:61
static HashSet< string > extraExcelDialogs
Definition: Lang.cs:63

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

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

◆ GetList()

◆ Has()

static bool Lang.Has ( string  id)
inlinestatic

Definition at line 103 of file Lang.cs.

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

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

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

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

Referenced by ModPackage.AddOrUpdateLang().

◆ LoadText()

static string Lang.LoadText ( string  id)
inlinestatic

Definition at line 155 of file Lang.cs.

156 {
157 return null;
158 }

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

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

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

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

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

◆ TryGet()

static string Lang.TryGet ( string  id)
inlinestatic

Definition at line 108 of file Lang.cs.

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

References General, and Get().

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

Member Data Documentation

◆ alias

ExcelData Lang.alias
static

Definition at line 57 of file Lang.cs.

◆ articlesToRemove

List<char[]> Lang.articlesToRemove
static

Definition at line 45 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 61 of file Lang.cs.

Referenced by GetDialogSheet().

◆ extraExcelDialogs

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

Definition at line 63 of file Lang.cs.

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

◆ Game

LangGame Lang.Game
static

◆ General

LangGeneral Lang.General
static

Definition at line 47 of file Lang.cs.

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

◆ isBuiltin

◆ isEN

bool Lang.isEN
static

Definition at line 41 of file Lang.cs.

Referenced by Init().

◆ isJP

◆ langCode

◆ List

SourceData Lang.List
static

Definition at line 53 of file Lang.cs.

Referenced by GetList().

◆ listAlias

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

Definition at line 37 of file Lang.cs.

◆ listName

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

Definition at line 35 of file Lang.cs.

◆ names

ExcelData Lang.names
static

Definition at line 59 of file Lang.cs.

◆ Note

LangNote Lang.Note
static

Definition at line 51 of file Lang.cs.

Referenced by Thing.GetName().

◆ runUpdate

bool Lang.runUpdate
static

Definition at line 25 of file Lang.cs.

Referenced by ModPackage.AddOrUpdateLang().

◆ setting

◆ space

string Lang.space = ""
static

Definition at line 33 of file Lang.cs.

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

◆ suffix

string Lang.suffix = ""
static

Definition at line 31 of file Lang.cs.

Referenced by Init().

◆ words

Words Lang.words = new Words()
static

Definition at line 27 of file Lang.cs.

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


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