CoverFlow - Problem multi-language site
Hi,
I tried to develop the SDK Coverflow sample.
When i try to run it didn't show any images.
I verified the AlbumTitle property and it was ok (Default Album) and the images were in the Publish status.
Then i tried to debug and this is what i discovered :
- the lambda to sql generated query is selecting the "title_pt" field of the database (see sc_1.gif)
- then i went to the database table "sf_libraries" and i verified that "title_pt" is empty and "title_" have the correct name (see sc_2.gif).
Because of the empty "title_pt" in the database the :
var images = App.WorkWith().Images()
.Where(
(w) => w.Parent.Title == title &&
w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
.Get();
returns nothing to title="Default Album"
After that i went to the backend and i verified that my default album appears as expected in PT (see sc_3.gif)
Hello JV,
Excuse us for the late response. We are experiencing enormous interest in our Sitefinity 4.0 RC and we are doing our best to reply as soon as possible.
The problem comes from the fact that you are using multi-lingual support for Portuguese. Once you have enabled multi-lingual support the database model has been modified to support that. By default the code that you are executing should return the title based on your current culture. However, there seems to be a bug with the default culture and parent.Title doesn't return the correct value. Moreover, the localization of album titles shouldn't be supported and you shouldn't have those fields in the table at all. I have logged those two bugs in our bug tracking system and we will do our best to resolve them as soon as possible. Once this is resolved parent.Title will return the default title based on your culture, and parent.Title["en"] will return the english version of the title for any Lstring.
As a workaround you can create a new album from your code with a specific ID. Then upload all your images to this album and retrieve the images based on the ID of your album that is static. Your code should look similar to this:
private
static
Guid myAlbumGuid = Guid.Parse(
"5C14F374-5E52-4896-B4E8-9D0621B73AC5"
);
private
bool
CreateAlbum()
return
App.WorkWith().Album()
.CreateNew(myAlbumGuid)
.Do((a) =>
a.Title =
"MyNewAlbum"
;
).SaveChanges();
private
List<Hashtable> GetImages()
List<Hashtable> results =
new
List<Hashtable>();
////get IQueryable of images from the Fluent API.
var images = App.WorkWith().Images()
.Where(
(w) => w.Parent.Id == myAlbumGuid &&
w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
.Get();