private static void Parse()
{
Dictionary = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
_AvailableLanguages = new SortedSet<string>();
try
{
var Document = new XmlDocument();
Document.LoadXml(ResourceArchive.GetTranslationsStream().ReadAllContentsAsString());
foreach (var CategoryNode in Document.SelectNodes("/translations/category").Cast<XmlNode>())
{
var CategoryId = CategoryNode.Attributes["id"].Value;
if (!Dictionary.ContainsKey(CategoryId)) Dictionary[CategoryId] = new Dictionary<string, Dictionary<string, string>>();
foreach (var TextNode in CategoryNode.SelectNodes("text").Cast<XmlNode>())
{
var TextId = TextNode.Attributes["id"].Value;
if (!Dictionary[CategoryId].ContainsKey(TextId)) Dictionary[CategoryId][TextId] = new Dictionary<string, string>();
foreach (var TranslationNode in TextNode.SelectNodes("translation").Cast<XmlNode>())
{
var LangId = TranslationNode.Attributes["lang"].Value;
var Text = TranslationNode.InnerText;
if (DefaultLanguage == null)
{
DefaultLanguage = LangId;
}
if (LangId != "xx")
{
AvailableLanguages.Add(LangId);
}
//Console.WriteLine("{0}.{1}.{2} = {3}", CategoryId, TextId, LangId, Text);
Dictionary[CategoryId][TextId][LangId] = Text;
}
}
}
}
catch (Exception Exception)
{
Console.Error.WriteLine(Exception);
}
}