public static string GetLanguage(this ReCaptchaLanguage language) { if (language == ReCaptchaLanguage.Auto) { var newLanguage = GetLanguageByCulture(CultureInfo.CurrentUICulture); return(GetLanguage(newLanguage.GetValueOrDefault())); } var attribute = language.GetType().GetMember(language.ToString()).Select(m => m.GetCustomAttribute <LanguageAttribute>()).FirstOrDefault() ?? new LanguageAttribute(string.Empty); return(attribute.Value); }
public static string GetLanguage(this ReCaptchaLanguage language) { var attribute = language.GetType().GetMember(language.ToString()).Select(m => m.GetCustomAttribute <LanguageAttribute>()).FirstOrDefault() ?? new LanguageAttribute(string.Empty); return(attribute.Value); }