Retrieve content for the current language
Hi,
I'd like to retrieve the Events for the current language. I can't manage to do it using the fluent API.
I tried using the AvailableCultures or AvailableLanguages properties, but they can't be used in fluent.
Code sample (does not work):
App.WorkWith().Events().Publihed().Where(e => e.AvailableCultures.Contains(Thread.CurrentThread.CurrentCulture)).Get();
To clarify: this problem only hits me for items that are only available in one language and not in the other.
Example: an item has a French version but no English version. In this case, I want this item to be visible on the French site, but not on the English site. Yet, in the English site, the French item shows up.
Hi Thomas,
This can be done by simply changing a configuration setting called fallback. It is responsible for loading the default translation of content items, when there are no translations for the Current Culture.
Here's how to do it:
Go to Administration >> Settings >> Advanced >> Resources and uncheck the Fallback checkbox.
If you need any further assistance, please feel free to get back to me.
Hi Svetoslav,
Thanks for your help.
I tried your suggestion. First, unchecking the Fallback box did nothing. So I stopped the server and restarted it, and then I could see its effects. However, it's not quite as expected.
I have 18 list items, 14 of which are available in both languages, and 4 of which are French only.
I have a page where I retrieve all list items of a certain list, and show their title and content.
Since I changed that setting, I still retrieve 18 items on the English side. It's just that 4 of them no longer have a title, but they still show up.
This sounds like a bug. Can you confirm?
I'm on 4.2 SP1.
Thanks.
Hello Thomas,
I tried to reproduce this with almost all of the templates of the List Items widget but was unsuccessful. Maybe I'm missing some of the steps to reproduce it. Does the list itself have a translation, or it's just the List Items? Also, are the pages synchronized or not? Can you please help me reproduce this bug with some more specific information on your case (including the creation of the News Items themselves and the exact template you use in your ListItems widget). A picture or two (a video would be even greater) would be of great assistance to me.
Looking forward to your answer.
Svetoslav,
I'm not using the List items widget, but a custom one. That could be the problem.
But I'll still answer each of your questions just in case: the list itself does not have a translation, the list items do. They're synchronized.
The relevant line in my code:
var listItems = list.ListItems().Publihed().OrderBy(i => i.Ordinal).Get();
Hi Thomas,
Yes, it is probably something in your control, as there was not problem with the default ListItems widget, most probably the way you are getting the items. This line of code, however, is not enough for me to tell what the problem is, so would it be possible for you to send me the whole control so I can test it locally and see what is the issue?
Best wishes,