CoverFlow - Problem multi-language site

Posted by Community Admin on 03-Aug-2018 18:14

CoverFlow - Problem multi-language site

All Replies

Posted by Community Admin on 06-Dec-2010 00:00

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)

Posted by Community Admin on 10-Dec-2010 00:00

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();

Note that in order to create the album you should be logged in the backend so that you don't get a permission exception. Then simply retrieve the images based on this ID:

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();

I hope this helps and please let me know if you need further instructions. Thank you once again for contacting us, and we look forward to responding to all your inquiries.

Best wishes,
Hristo Borisov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed