private CultureInfo GetCulture(DataRow row) { string cultureString = ""; if (!string.IsNullOrEmpty(this.CountryColumnName) && this.CountryColumnName == this.LanguageColumnName) { cultureString = row[this.CountryColumnName].ToStringOrEmpty(); } else { // Is the country "US" in a column? string countryString = ""; if (!string.IsNullOrEmpty(this.CountryColumnName)) { countryString = row[this.CountryColumnName].ToStringOrEmpty(); } // Is the language "en" in a column? string languageString = ""; if (!string.IsNullOrEmpty(this.LanguageColumnName)) { languageString = row[this.LanguageColumnName].ToStringOrEmpty(); } // language an country? -> build "en-US" if (!string.IsNullOrEmpty(languageString) && !string.IsNullOrEmpty(countryString)) { cultureString = languageString.ToLower() + "-" + countryString; } else { // otherwise just take "US" cultureString = countryString; } } var culture = CultureUtil.GetCultureFromString(cultureString); if (culture == null) { culture = this.DefaultCulture; } return(culture); }