private static bool VariesByCulture(string propertyTypeAlias, IContentTypeComposition contentType) { // will throw if the property type is not found var variesByCulture = contentType.VariesByCulture() // only look up the property type if the content type varies else there's no point ? contentType.CompositionPropertyTypes.First(x => x.Alias.InvariantEquals(propertyTypeAlias)).VariesByCulture() : false; return(variesByCulture); }
public static void SetInvariantOrDefaultCultureName( this IContentBase content, string name, IContentTypeComposition contentType, ILocalizationService localizationService) { if (contentType is null) { throw new ArgumentNullException(nameof(contentType)); } var variesByCulure = contentType.VariesByCulture(); if (variesByCulure) { content.SetCultureName(name, localizationService.GetDefaultLanguageIsoCode()); } else { content.Name = name; } }