Image gallery and localization
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
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 >>
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"
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