Mark for translation

The following code sample demonstrates how you can mark programmatically items for translation. The sample marks all News items for translation, so that later, you can send them to the translation agency:

C#
using System.Globalization;
using System.Linq;
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Modules.News;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Translations;

namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Modules
{
   public partial class TranslationsSnippets
   {
       /// <summary>
       /// Marks all news from the default provider for translation.
       /// They can later be send to the translation agency from Administration > Translations
       /// </summary>
       public static void MarkAllNewsForTranslation()
       {
           // Get a list of news items for translation
           var newsManager = NewsManager.GetManager();
           var newsItemsToTranslate = newsManager.GetNewsItems().Where(i => i.Status == ContentLifecycleStatus.Master);

           // Send the items to the translation agency
           TranslationService.Current.MarkForTranslation(
               newsItemsToTranslate,
               SystemManager.CurrentContext.AppSettings.GetCultureByName("en"),
               new CultureInfo[] { SystemManager.CurrentContext.AppSettings.GetCultureByName("fr"), SystemManager.CurrentContext.AppSettings.GetCultureByName("de") });
       }
   }
}
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?