Repository navigation
Expand file tree
/
Copy pathModLangGenBase.cs
More file actions
83 lines (68 loc) · 2.11 KB
/
Copy pathModLangGenBase.cs
File metadata and controls
83 lines (68 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using Bark.BetterCCL;
using BepInEx.Logging;
namespace Bark.Base;
public abstract class ModLangGenBase
{
private bool _isInitialized;
private ManualLogSource _log = null!;
protected abstract string LanguageCode { get; }
protected abstract string NameSpace { get; }
public int Count { get; private set; }
public void Initialize(ManualLogSource logger)
{
if (_isInitialized) return;
_log = logger;
BuildLocaleData();
_isInitialized = true;
_log.LogInfo($"[ModLangGenBase] [{LanguageCode}] Registered {Count} defaults");
}
protected abstract void BuildLocaleData();
protected void Add(string category, string key, string value)
{
if (string.IsNullOrEmpty(key)) return;
BetterLocale.SetDefault(LanguageCode, NameSpace, category, key, value);
Count++;
}
protected void Other(string key, string value)
{
Add("other", key, value);
}
protected void Log(string key, string value)
{
Add("log", key, value);
}
protected void Command(string key, string value)
{
Add("command", key, value);
}
protected void Item(string key, string value, string description)
{
Add("item", key, value);
Add("item", key + "dsc", description);
}
protected void Building(string key, string value, string description)
{
Add("build", key, value);
Add("build", key + "dsc", description);
}
protected void Moodle(string key, string value, string description)
{
Add("moodle", key, value);
Add("moodle", key + "dsc", description);
}
protected void Option(string key, string value, string description)
{
Add("option", key, value);
Add("option", key + "dsc", description);
}
protected void Liquid(string key, string value, string description)
{
Add("liquid", key, value);
Add("liquid", key + "dsc", description);
}
protected void Tile(string key, string value, string description)
{
Add("tile", key, value);
Add("tile", key + "dsc", description);
}
}