Exemple #1
0
        private static Dictionary <string, string> getLangFiles()
        {
            Dictionary <string, string> langfile = new Dictionary <string, string>();

            string basedir = AppSettings.RootPath;

            string langpath = System.IO.Path.Combine(AppSettings.RootPath, "lang");

            if (System.IO.Directory.Exists(langpath))
            {
                var allfiles = System.IO.Directory.GetFiles(langpath, "*.xml");

                if (allfiles != null && allfiles.Count() > 0)
                {
                    foreach (var item in allfiles)
                    {
                        var    info = new System.IO.FileInfo(item);
                        string name = info.Name;
                        string key  = name.ToLower().Replace(".xml", "");

                        if (ISOTwoLetterCode.ContainsKey(key))
                        {
                            langfile[key] = item;
                        }
                    }
                }
            }
            else
            {
#if Release
                {
                    throw new Exception("lang file not found");
                }
#endif
            }

            return(langfile);
        }
Exemple #2
0
        private static Dictionary <string, string> initcmsLangs()
        {
            var _cmslang = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            if (LangFiles.Count() > 0)
            {
                foreach (var item in LangFiles)
                {
                    string langkey = item.Key;

                    if (ISOTwoLetterCode.ContainsKey(langkey))
                    {
                        var value = ISOTwoLetterCode[langkey];
                        _cmslang.Add(langkey, value);
                    }
                }
            }

            if (!_cmslang.ContainsKey("en"))
            {
                _cmslang.Add("en", "English");
            }
            return(_cmslang);
        }