public override IEnumerable <global::EPiServer.Framework.Localization.ResourceItem> GetAllStrings(string originalKey, string[] normalizedKey, CultureInfo culture)
        {
            var q = new GetAllTranslations.Query(originalKey, culture);

            return(q.Execute()
                   .Select(r => new global::EPiServer.Framework.Localization.ResourceItem(r.Key, r.Value, r.SourceCulture)));
        }
        public override IEnumerable<global::EPiServer.Framework.Localization.ResourceItem> GetAllStrings(string originalKey, string[] normalizedKey, CultureInfo culture)
        {
            var q = new GetAllTranslations.Query(originalKey, culture);

            return q.Execute()
                    .Select(r => new global::EPiServer.Framework.Localization.ResourceItem(r.Key, r.Value, r.SourceCulture));
        }
        public override IEnumerable <global::EPiServer.Framework.Localization.ResourceItem> GetAllStrings(string originalKey, string[] normalizedKey, CultureInfo culture)
        {
            // this is special case for Episerver ;)
            // https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/10/takes-a-lot-of-time-for-epi-cms-resources-to-load-on-dxc-service/
            if (originalKey.StartsWith("/") && !ConfigurationContext.Current.ModelMetadataProviders.EnableLegacyMode())
            {
                return(Enumerable.Empty <global::EPiServer.Framework.Localization.ResourceItem>());
            }

            var q = new GetAllTranslations.Query(originalKey, culture);

            return(q.Execute()
                   .Select(r => new global::EPiServer.Framework.Localization.ResourceItem(r.Key, r.Value, r.SourceCulture)));
        }
Esempio n. 4
0
        public IEnumerable <ResourceItem> Execute(GetAllTranslations.Query query)
        {
            var q            = new GetAllResources.Query();
            var allResources = q.Execute().Where(r =>
                                                 r.ResourceKey.StartsWith(query.Key) &&
                                                 r.Translations != null && r.Translations.Any(t => t.Language == query.Language.Name)).ToList();

            if (!allResources.Any())
            {
                return(Enumerable.Empty <ResourceItem>());
            }

            return(allResources.Select(r => new ResourceItem(r.ResourceKey,
                                                             r.Translations.First(t => t.Language == query.Language.Name).Value,
                                                             query.Language)).ToList());
        }
        public async Task <IActionResult> GetAllTranslations([FromQuery] GetAllTranslations.Query query)
        {
            var result = await _mediator.Send(query);

            return(Json(result));
        }