Create extract.csx
Browse files- extract.csx +22 -0
extract.csx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.IO;
|
| 2 |
+
using System.Text.Json;
|
| 3 |
+
using System.Collections.Generic;
|
| 4 |
+
|
| 5 |
+
var dict = new Dictionary<string, string>();
|
| 6 |
+
|
| 7 |
+
foreach (var str in Data.Strings) {
|
| 8 |
+
if (!string.IsNullOrWhiteSpace(str.Content)) {
|
| 9 |
+
if(!dict.ContainsKey(str.Content)) {
|
| 10 |
+
dict.Add(str.Content, str.Content);
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
// Türkçe karakterlerin bozulmaması için özel kodlayıcı kullanıyoruz
|
| 16 |
+
var options = new JsonSerializerOptions {
|
| 17 |
+
WriteIndented = true,
|
| 18 |
+
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
string json = JsonSerializer.Serialize(dict, options);
|
| 22 |
+
File.WriteAllText("strings.json", json);
|