Image gallery and localization

Posted by Community Admin on 03-Aug-2018 16:08

Image gallery and localization

All Replies

Posted by Community Admin on 23-Aug-2011 00:00

hi,
I am using Arabic and English language localizations.I have created an album with Arabic and English version of images.I have an image gallery and when I change language selector, I need to change the image also(language wise)
How can I do this?
I tried with this

       CultureInfo currentCulture=CultureInfo.CurrentCulture;
         
        var images = App.WorkWith().Images().Where(i => i.Parent.Id == albumId)
             .Where(i => i.AvailableCultures.Contains(currentCulture))
            .Where(i => i.Visible == true)
            .Get();   
     
        foreach (Telerik.Sitefinity.Libraries.Model.Image img in images)
       
       

but I got an error saying

Identifier 'AvailableCultures' is not a parameter or variable or field of 'Telerik.Sitefinity.Libraries.Model.Image'. If 'AvailableCultures' is a property please add the FieldAlias or Storage attribute to it or declare it as a field's alias


please help me....

Posted by Community Admin on 26-Aug-2011 00:00

Hello Rakesh,

AvailableCultures is not a persistable property so it can not be used in linq expression. You can modify your code to get all visible images and then itterate through them checking the AvailableLanguages Property.

One other approach is to use the PublishedTranslations property which is persistable and could be used in linq expression.

CultureInfo currentCulture=CultureInfo.CurrentUICulture;
         
        var images = App.WorkWith().Images().Where(i => i.Parent.Id == albumId)
             .Where(i => i.PublishedTranslations.Contains(currentCulture.Name))
            .Get();   
     
        foreach (Telerik.Sitefinity.Libraries.Model.Image img in images)
       
       

Note that the code above will work properly only when the project is multilingual as it is in your case.

The code above provides access to all images in an album in a specific language.

The language selector should navigate to different language versions of a specific page. If you have placed image galery in that page then the images should change automatically when the language is changed so they correspond to the language of the page.

Please let me know if you have further problems.

Greetings,
Lilia Messechkova
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 08-Nov-2011 00:00

Hi,

How can I give Arabic title and description for the image libraries created...
I could not find any option for this.
Is their any for doing this .
Please help......

When going to Manage Libraries,it shows only English versions ,no option for "AR"

Posted by Community Admin on 09-Nov-2011 00:00

Hi Rakesh,

The libraries are not localizable, only the items in  the library are localizable. The same is valid for the blogs and videos. The title of libraries is only visible in the admin section so you can give it Arabic name if you like instead of English. If you really need to have English and Arabic title, then you will have to create two libraries and spit the items across these libraries.

All the best,
Lilia Messechkova
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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