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.
Get started with Integration Hub | Sitefinity Cloud
This free lesson teaches administrators, marketers, and other business professionals how to use Sitefinity Integration Hub to create automated workflows between Sitefinity and other business systems.
Web Security for Sitefinity Administrators
This free lesson teaches administrators the basics about protecting your Sitefinity instance and your sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
Foundations of Sitefinity ASP.NET Core Development
The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.