Translating Images for all languages

Posted by Community Admin on 03-Aug-2018 19:32

Translating Images for all languages

All Replies

Posted by Community Admin on 28-Oct-2013 00:00

Is there a way to translate an image across all languages at once versus translating them one at a time?

Posted by Community Admin on 31-Oct-2013 00:00

Hello,

Retrieve the image tough the API and then change the current culture of the Thread to modify the image for each separate language, a sample is below:

LibrariesManager librariesManager = LibrariesManager.GetManager();
            var image = librariesManager.GetImages().Where(i => i.Title == "Image" && i.Status==ContentLifecycleStatus.Master).FirstOrDefault();
 
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
 
            image.Title = "ImageEnglish";
            librariesManager.SaveChanges();
            librariesManager.Lifecycle.Publish(image);
            librariesManager.SaveChanges();
 
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
 
            image.Title = "ImageFrench";
            librariesManager.SaveChanges();
            librariesManager.Lifecycle.Publish(image);
            librariesManager.SaveChanges();

Sitfinity uses the Thread culture to control which language version of the item queried are retrieved.

Regards,
Stanislav Velikov
Telerik
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