Implemented copy function for text element's keys

This commit is contained in:
tsommer committed 2023-02-15 20:32:47 +01:00
1 parent bbc10de9ff
commit 8314e7157b
4 files changed
+48 -18

No files matched your search

@@ -58,23 +58,11 @@ public class GodotCSV : IGenerator
foreach (var section in sections.OrderBy(n => n.DataKey))
foreach (var textElement in section.TextElements.OrderBy(n => n.Code))
{
//
// Build the path to the text element:
//
var textElementPath = new List<string>(section.Depth + 2)
{
textElement.Code
};
var parent = section;
while (parent is not null)
{
textElementPath.Add(parent.DataKey);
parent = parent.Parent;
}
// Get the key for this text element:
var key = await TextElementProcessor.GetKey(textElement.Id);
// Write the path to the text element as key:
await writer.WriteAsync($"{string.Join(".", textElementPath.ReverseIt())}{delimiter}");
await writer.WriteAsync($"{key}{delimiter}");
// Load all translations:
var translations = textElement.Translations.DistinctBy(n => n.Culture).ToDictionary(translation => translation.Culture, translation => translation.Text);