More in this section

Forums / General Discussions / Translating Images for all languages

Translating Images for all languages

2 posts, 0 answered
  1. Jared
    Jared avatar
    122 posts
    04 Apr 2013
    28 Oct 2013
    Link to this post
    Is there a way to translate an image across all languages at once versus translating them one at a time?
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    18 Sep 2017
    31 Oct 2013
    Link to this post

    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";
                Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
                image.Title = "ImageFrench";

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

    Stanislav Velikov
    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
2 posts, 0 answered