static void LoadLanguageFile(string sLangFile)
{
XmlDocument xmlLanguage = new XmlDocument();
if (sLangFile == "Български" || sLangFile == "English")
xmlLanguage.InnerXml = Properties.Resources.Bulgarian;
else
xmlLanguage.Load(sLangFile);
translatedBy = xmlLanguage.SelectSingleNode("lang//translatedby").InnerText;
website = xmlLanguage.SelectSingleNode("lang//website").InnerText;
contacts = xmlLanguage.SelectSingleNode("lang//corrections").InnerText;
XmlNodeList xmlStringList = xmlLanguage.GetElementsByTagName("str");
int iStrings = xmlStringList.Count;
dictLanguage = new Dictionary<string, string>(iStrings);
foreach (XmlNode nodeString in xmlStringList)
{
string sMain = nodeString.SelectSingleNode("main").InnerText;
string sAlt = nodeString.SelectSingleNode("alt").InnerText;
if (Data.Debug && dictLanguage.ContainsValue(sAlt))
{
string sMessage = "The string" + ": " + sAlt + Environment.NewLine + "appears more than once in the language file";
System.Windows.Forms.MessageBox.Show(sMessage, "Language Files Loading", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
if (dictLanguage.ContainsKey(sMain))
{
string sMessage = "The string" + ": " + sMain + Environment.NewLine + "appears more than once in the language file";
System.Windows.Forms.MessageBox.Show(sMessage, "Language Files Loading", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
dictLanguage.Add(sMain, sAlt);
}
}
return;
}