-
Notifications
You must be signed in to change notification settings - Fork 0
/
TranslationKey.cs
34 lines (33 loc) · 1.07 KB
/
TranslationKey.cs
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
using System.Text.RegularExpressions;
namespace CobbleBuild {
public class TranslationKey : Dictionary<string, string> {
public string getBedrockKey() {
string output = "";
foreach (var key in this) {
output += $"{key.Key}={key.Value}\n";
}
return output;
}
/// <summary>
/// Does necessary operations on the translation key
/// </summary>
[Obsolete]
public void Prepare() {
var exp = new Regex(@"cobblemon\.species\..*\.name");
//Creates valid translations for pokemon
foreach (var item in this.Where(x => exp.IsMatch(x.Key)).ToList()) {
this.Add($"entity.cobblemon:{item.Key.Substring(18)}", item.Value);
}
}
/// <summary>
/// Overwrites this key with the provided translation key.
/// MUTATES THE ORIGINAL TRANSLATIONKEY
/// </summary>
public TranslationKey Merge(TranslationKey other) {
foreach (var item in other) {
this[item.Key] = item.Value;
}
return this;
}
}
}