Пример #1
0
 public CulturesViewModel Create()
 {
     return(new CulturesViewModel()
     {
         Cultures = CultureManager.GetCultures(this.RequestHandler.Storage).Where(c => !c.IsNeutral).Select(
             c => new CultureViewModelFactory(this.RequestHandler).Create(c)
             )
     });
 }
Пример #2
0
        private void ConstructProperty(ObjectBuilderBase objectBuilder, Object @object, Member member)
        {
            Property property = this.propertyRepository.WithObjectIdAndMemberId(@object.Id, member.Id);
            IDictionary <Culture, Localization> localizationsByCultures = new Dictionary <Culture, Localization>();

            foreach (Culture culture in CultureManager.GetCultures(this.requestHandler.Storage))
            {
                localizationsByCultures.Add(culture, this.localizationRepository.WithDictionaryIdAndCultureId(property.HtmlId, culture.Id));
            }

            objectBuilder.BuildProperty(@object, member, property, localizationsByCultures);
        }
Пример #3
0
        private IDictionary <string, string> GetLocalizationValuesByCultureCodes(Property property)
        {
            Dictionary <string, string> localizationValuesByCultureCodes = new Dictionary <string, string>();

            foreach (Culture culture in CultureManager.GetCultures(this.requestHandler.Storage))
            {
                localizationValuesByCultureCodes.Add(
                    culture.Code,
                    this.localizationRepository.WithDictionaryIdAndCultureId((int)property.StringValueId, culture.Id)?.Value
                    );
            }

            return(localizationValuesByCultureCodes);
        }
Пример #4
0
        private DomainProperty CreateDomainProperty(Property property)
        {
            DomainProperty domainProperty = new DomainProperty();

            if (property != null)
            {
                foreach (Culture culture in CultureManager.GetCultures(this.handler.Storage))
                {
                    Localization localization = this.handler.Storage.GetRepository <ILocalizationRepository>().WithDictionaryIdAndCultureId(property.HtmlId, culture.Id);

                    domainProperty.Add(culture.Code, localization?.Value);
                }
            }

            return(domainProperty);
        }