Try our conversational search powered by Generative AI!

Replacement for PageLanguage Property in PageData ?


PageLanguages property in PageData is deprecated.
It suggests to use ExistingLanguages property instead of the PageLanguages

However, when comes to the filtering, previously the language filtering has been handled by

.Filter(x => !((PageData)(object)x).PageLanguages.MatchCaseInsensitive(lang))

But when used the below,

.Filter(x => !((PageData)(object)x).ExistingLanguages.ToString().MatchCaseInsensitive(lang))

it gives a different result.

How to get the same result as before by using the ExistingLanguages property (or from other property)? Thanks in advance.

Note: I am working on EPiServer.Find.Cms -->  ,   CMS ---> 

Edited, Jun 06, 2018 7:12

I would setup an extension method or a readonly property that returns something that works well with Find filtering and the input data in question.

Jun 08, 2018 23:52

I agree with Johan, you should/can add an extensions method that converts the list of cultureinfo to a list of strings (I do not think ToString do that) and add that to the indexeing and then filter on that.

Jun 11, 2018 7:08

This has been resolved Using ExistingLanguages() from EPiServer.Find.Cms instead of the ExistingLanguages property from the EPiServer.Core.PageData.

It returns IEnumerable<string> instead of IEnumerable<CultureInfo>.

The final codebase looks like this,

.Filter(x => !((PageData)(object)x).ExistingLanguages().MatchCaseInsensitive(lang))

Jun 12, 2018 8:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.