Example #1
0
 public IEnumerable <Models.Language> GetSelectedLanguages()
 {
     //TODO: check if there is any? because maybe the cookie lived long and some languages got deleted?
     // otherwise something was changed/cached
     return(LocalizationContext.CurrentBackEndUserLanguages()
            .Select(o => o.CultureInfo)
            .Select(o => new Models.Language
     {
         ISOCode = o.Name,
         Name = o.EnglishName
     }));
 }
        public IEnumerable <Models.Language> GetSelectedLanguages()
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies[Core.Constants.Cache.BackendLanguages];

            // This is equivalent to all languages or default language
            if (cookie == null || string.IsNullOrWhiteSpace(cookie.Value))
            {
                return(Enumerable.Empty <Models.Language>());
            }

            // otherwise something was changed/cached
            IEnumerable <ILanguage> languages = LocalizationContext.CurrentBackEndUserLanguages();

            return(languages.Select(o => o.CultureInfo)
                   .Select(o => new Models.Language
            {
                ISOCode = o.Name,
                DisplayName = o.DisplayName,
                NativeName = o.NativeName
            }));
        }