public IEnumerable <T> GetChildrenWithReviews <T>(ContentReference contentLink, CultureInfo language) where T : IContentData { return(GetChildrenWithReviews <T>(contentLink, new LoaderOptions() { LanguageLoaderOption.Specific(language) }, -1, -1)); }
public virtual IEnumerable <T> GetReferencesToCategories <T>(IEnumerable <ContentReference> categories, CultureInfo culture) where T : ICategorizableContent, IContentData { var loaderOptions = new LoaderOptions { LanguageLoaderOption.Specific(culture) }; return(GetReferencesToCategories <T>(categories, loaderOptions)); }
public T GetFirstBySegment <T>(string urlSegment, CultureInfo culture) where T : CategoryData { var loaderOptions = new LoaderOptions { LanguageLoaderOption.Specific(culture) }; return(GetFirstBySegment <T>(urlSegment, loaderOptions)); }
private LoaderOptions GetLoaderOptions(string languageCode) { if (string.IsNullOrEmpty(languageCode)) { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.Add <LanguageLoaderOption>(LanguageLoaderOption.FallbackWithMaster((CultureInfo)null)); return(loaderOptions); } CultureInfo language = languageCode == "iv" ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(languageCode); LoaderOptions loaderOptions1 = new LoaderOptions(); loaderOptions1.Add <LanguageLoaderOption>(LanguageLoaderOption.Specific(language)); return(loaderOptions1); }
public static LoaderOptions CreateLoaderOptionsFromAgruments <TSource>(this ResolveFieldContext <TSource> context) { if (!context.HasArgument(Constants.Arguments.ARGUMENT_ALLOWFALLBACK_LANG)) { throw new ArgumentException($"ResolveFieldContext does not contain any argument \"{Constants.Arguments.ARGUMENT_ALLOWFALLBACK_LANG}\""); } var allowFallbackLang = context.GetArgument <bool>(Constants.Arguments.ARGUMENT_ALLOWFALLBACK_LANG); var locale = context.GetLocaleFromArgument(); return(new LoaderOptions { allowFallbackLang ? LanguageLoaderOption.Fallback(locale) : LanguageLoaderOption.Specific(locale) }); }
public static IEnumerable <IContent> GetAllLanguageVersions(this IContentLoader contentLoader, ContentReference contentReference) { var content = contentLoader.Get <IContent>(contentReference); if (content is ILocalizable rootContent) { foreach (var cultureInfo in rootContent.ExistingLanguages) { var loaderOptions = new LoaderOptions { LanguageLoaderOption.Specific(cultureInfo) }; var contentInSpecificLanguage = contentLoader.Get <IContent>(contentReference.ToReferenceWithoutVersion(), loaderOptions); yield return(contentInSpecificLanguage); } } else { yield return(content); } }