Example #1
0
        public IEnumerable <Models.Language> GetAllLanguages()
        {
            List <Models.Language> languages = new List <Models.Language>();

            languages.AddRange(
                LocalizationContext.Languages
                .Select(o => o.CultureInfo)
                .Select(o => new Models.Language
            {
                ISOCode = o.Name,
                Name    = o.EnglishName
            }));

            if (languages.Any(o => o.IsDefault) == false)
            {
                ILanguage defaultLanguage = LocalizationContext.GetDefaultLanguage(LocalizationContext.Languages);
                languages.Single(o => o.ISOCode == defaultLanguage.CultureInfo.Name).IsDefault = true;
            }

            return(languages);
        }