Translate the content in workflow

Posted by Community Admin on 04-Aug-2018 04:07

Translate the content in workflow

All Replies

Posted by Community Admin on 28-Aug-2014 00:00

Our site is available in 3 languages, traditional chinese(ZH-HK), simplified chinese(ZH-CN) and english (EN). And I applied the translation activity (from ZH-HK to ZH-CN) inside the approval workflow once the user modified the content. The translation is work and I can set the attribute for SC. However, in the content list page, the system show the item is not available for ZH-CN but the content for ZH-CN is ready.

Posted by Community Admin on 01-Sep-2014 00:00

Hello Gary,

Can you verify that the page translation is available in the table sf_page_node. For example if there is column for the translated title (title_ ; title_zh_cn ; title_zh_hk).

In addition, could you please provide more information about the translation - how it is done, the scenario you are trying to achieve?

Regards,
Svetoslav Manchev
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 03-Sep-2014 00:00

Hi,

Thanks for your assistant on this issue. Let me describe my scenario more concrete. 

My case is that I apply two steps approval on News item. And I modified the approval workflow and added a translation activity, in order to translate some field in News item, when user perform some actions (save as draft, send for approval & send for publishing).  The translation activity will translate some fields from zh-HK to zh-CN. 

I debugged and found that the translation is work(the database record has translated  content). But, in sitefinity's backend, the news item only existed in zh-HK (blue) but not zh-CN (gray). 

Thanks,

Gary

Posted by Community Admin on 05-Sep-2014 00:00

Hi Gary,

Which version you are using? In case of 7.0/7.1 you can translate the page by using the following code snippet:

public static void CopyLocalizedPage(string title)
        
            const string CultureName = "zh-hk"; //new translation culture
            var settings = Telerik.Sitefinity.Abstractions.AppSettings.CurrentSettings;
  
            using (new CultureRegion(CultureName))
            
                var manager = PageManager.GetManager();
                var nodeId = manager.GetPageNodes()
                    .Where(p => p.RootNodeId ==
                        SystemManager.CurrentContext.CurrentSite.SiteMapRootNodeId
                        && p.LocalizationStrategy == LocalizationStrategy.NotSelected
                        && p.NodeType == NodeType.Standard
                        && p.Title == title)
                    .Select(p => p.Id)
                    .FirstOrDefault();
 
                    var node = manager.GetPageNode(nodeId);
                    if (node.AvailableLanguages.Contains(CultureName))
                        continue;
                    if (node.LocalizationStrategy != LocalizationStrategy.NotSelected)
                        continue;
  
                    node.Title = node.UrlName + "_" + CultureName;
                    node.UrlName = node.UrlName + "_" + CultureName;
  
                    var pageData = node.GetPageData();
                    if (pageData != null && pageData.Culture == null)
                    
                        pageData.Culture = settings.DefaultFrontendLanguage.Name;
                    
  
                    manager.InitializePageLocalizationStrategy(node, LocalizationStrategy.Split, true);
                    manager.SaveChanges();
  
                    WorkflowManager.MessageWorkflow(
                        node.Id,
                        node.GetType(),
                        "",
                        "Publish",
                        false,
                        new Dictionary<string, string>());
            
        

I hope this helps.

Regards,
Svetoslav Manchev
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed