Exemple #1
0
        public ExternalLanguageManager(DirectoryInfo target)
        {
            textList = new Dictionary <CultureInfo, LanguageDocument>();

            foreach (FileInfo fi in target.GetFiles("*.xml"))
            {
                if (fi.Name.ToLower() == "default.xml")
                {
                    defaultText = new LanguageDocument(fi);
                }
                else
                {
                    try
                    {
                        CultureInfo ci = new CultureInfo(fi.Name.ToLower().Replace(".xml", ""));
                        if (ci == null)
                        {
                            throw new ArgumentException("Unable to find language!");
                        }
                        textList.Add(ci, new LanguageDocument(fi));
                    }
                    catch (Exception e)
                    {
                        LOG.Warn("Cannot handle language '" + fi.Name.ToLower().Replace(".xml", ""), e);
                    }
                }
            }
        }
        public ExternalLanguageManager(DirectoryInfo target)
        {
            textList = new Dictionary<CultureInfo, LanguageDocument>();

            foreach (FileInfo fi in target.GetFiles("*.xml"))
            {
                if (fi.Name.ToLower() == "default.xml")
                    defaultText = new LanguageDocument(fi);
                else
                {
                    try
                    {
                        CultureInfo ci = new CultureInfo(fi.Name.ToLower().Replace(".xml", ""));
                        if (ci == null)
                            throw new ArgumentException("Unable to find language!");
                        textList.Add(ci, new LanguageDocument(fi));
                    }
                    catch (Exception e)
                    {
                        LOG.Warn("Cannot handle language '" + fi.Name.ToLower().Replace(".xml", ""), e);
                    }
                }
            }
        }