コード例 #1
0
        public Language FindBestLanguage(string languageName)
        {
            if (string.IsNullOrEmpty(languageName))
            {
                languageName = "en";
            }

            try
            {
                var cultureInfo = new CultureInfo(languageName);
                return(LanguageLoader.FindBestLanguage(cultureInfo));
            }
            catch (CultureNotFoundException)
            {
            }

            var language = LanguageLoader.GetAvailableLanguages().FirstOrDefault(x => x.Iso2 == languageName);

            if (language != null)
            {
                return(language);
            }

            return(LanguageLoader.FindBestLanguage(new CultureInfo("en")));
        }
コード例 #2
0
 public Language FindBestLanguage(CultureInfo culture)
 {
     return(LanguageLoader.FindBestLanguage(culture));
 }