Skip to content

Commit 9e3c4e6

Browse files
committed
v2.5.0 content.
1 parent edfb4cc commit 9e3c4e6

File tree

8 files changed

+2522
-2311
lines changed

8 files changed

+2522
-2311
lines changed

ExtractTranslations/CardTrans.cs

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Xml.Linq;
1+
using System.Text.RegularExpressions;
2+
using System.Xml.Linq;
23
using Newtonsoft.Json;
34

45
namespace ExtractTranslations;
@@ -16,29 +17,40 @@ public static void ExtractCardText(string directoryPath, string outJsonPath)
1617
foreach (var filePath in Directory.GetFiles(directoryPath, "*.xml", SearchOption.AllDirectories))
1718
{
1819
FileInfo fi = new FileInfo(filePath);
19-
var parentName = fi.Directory.Name;
20-
var doc = XDocument.Load(filePath);
21-
var mainClass = doc.Root.Element("mainClass")?.Value;
22-
var name = doc.Root.Element("name")?.Value;
23-
var context = doc.Root.Element("context")?.Value;
24-
25-
if (mainClass != null)
20+
var parentName = fi.Name;
21+
var fileNumber = 0;
22+
Match match = Regex.Match(parentName, @"\d+");
23+
if (match.Success)
2624
{
27-
translations.Add(new Dictionary<string, object>
28-
{
29-
{ "key", $"{parentName}.{fi.Name}.name" },
30-
{ "original", name },
31-
{ "translation", name },
32-
{ "context", null }
33-
});
25+
fileNumber = int.Parse(match.Value);
26+
}
27+
var txt = File.ReadAllLines(filePath);
28+
foreach (var line in txt)
29+
{
30+
var doc = XDocument.Parse(line);
31+
var mainClass = doc.Root.Element("mainClass")?.Value;
32+
var name = doc.Root.Element("name")?.Value;
33+
var id = doc.Root.Element("id")?.Value;
34+
var context = doc.Root.Element("context")?.Value;
3435

35-
translations.Add(new Dictionary<string, object>
36+
if (mainClass != null)
3637
{
37-
{ "key", $"{parentName}.{fi.Name}.context" },
38-
{ "original", context },
39-
{ "translation", context },
40-
{ "context", null }
41-
});
38+
translations.Add(new Dictionary<string, object>
39+
{
40+
{ "key", $"{fileNumber}.{id}.xml.name" },
41+
{ "original", name },
42+
{ "translation", name },
43+
{ "context", null }
44+
});
45+
46+
translations.Add(new Dictionary<string, object>
47+
{
48+
{ "key", $"{fileNumber}.{id}.xml.context" },
49+
{ "original", context },
50+
{ "translation", context },
51+
{ "context", null }
52+
});
53+
}
4254
}
4355
}
4456

ExtractTranslations/CharacterTrans.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ namespace ExtractTranslations;
66
public class CharacterTrans
77
{
88

9-
public static void ExtractCharacterText(string directoryPath, string outJsonPath)
9+
public static void ExtractCharacterText(string directoryPath, string directoryPath2, string outJsonPath)
1010
{
1111

1212
var translations = new List<Dictionary<string, object>>();
1313

14-
15-
14+
var anotherDir = Directory.GetFiles(directoryPath2, "*.xml", SearchOption.AllDirectories);
15+
var elements = Directory.GetFiles(directoryPath, "*.xml", SearchOption.AllDirectories).Concat(anotherDir);
1616

17-
foreach (var filePath in Directory.GetFiles(directoryPath, "*.xml", SearchOption.AllDirectories))
17+
foreach (var filePath in elements)
1818
{
1919
FileInfo fi = new FileInfo(filePath);
2020
var parentName = fi.Directory.Name;

ExtractTranslations/Extracted/enchant.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@
175175
},
176176
{
177177
"key": "21.xml.context",
178-
"original": "受けるダメージが+{0}される。ダメージを受ける毎に傷の値を+1する。自分のターン終了時に傷の値を0にする。",
179-
"translation": "受けるダメージが+{0}される。ダメージを受ける毎に傷の値を+1する。自分のターン終了時に傷の値を0にする。",
178+
"original": "自分の受けるダメージが+{0}される。ダメージを受ける毎に傷の値を+1する。自分のターン終了時に傷の値を0にする。",
179+
"translation": "自分の受けるダメージが+{0}される。ダメージを受ける毎に傷の値を+1する。自分のターン終了時に傷の値を0にする。",
180180
"context": null
181181
},
182182
{
@@ -191,6 +191,18 @@
191191
"translation": "帯電の値が変動する毎に、周囲2マスの最も近い敵に帯電の値に等しいダメージを与える。",
192192
"context": null
193193
},
194+
{
195+
"key": "23.xml.name",
196+
"original": "錬成",
197+
"translation": "錬成",
198+
"context": null
199+
},
200+
{
201+
"key": "23.xml.context",
202+
"original": "自分のターン開始時に、ファントムブレードを手札に加える。それは錬成の値に等しいダメージを与える。",
203+
"translation": "自分のターン開始時に、ファントムブレードを手札に加える。それは錬成の値に等しいダメージを与える。",
204+
"context": null
205+
},
194206
{
195207
"key": "3.xml.name",
196208
"original": "軽量化",
@@ -199,8 +211,8 @@
199211
},
200212
{
201213
"key": "3.xml.context",
202-
"original": "元々のコストが5以上のカードのコストを-{0}する。",
203-
"translation": "元々のコストが5以上のカードのコストを-{0}する。",
214+
"original": "元々のMPコストが5以上のカードのコストを-{0}する。",
215+
"translation": "元々のMPコストが5以上のカードのコストを-{0}する。",
204216
"context": null
205217
},
206218
{

ExtractTranslations/Extracted/entity.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,8 @@
133133
},
134134
{
135135
"key": "Entity.player.xml.name",
136-
"original": "リディア",
137-
"translation": "リディア",
138-
"context": null
139-
},
140-
{
141-
"key": "Entity.rock.xml.name",
142-
"original": "かかし",
143-
"translation": "かかし",
136+
"original": "Player",
137+
"translation": "Player",
144138
"context": null
145139
},
146140
{

0 commit comments

Comments
 (0)