+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Translate the content in workflow

Translate the content in workflow

4 posts, 0 answered
  1. Gary
    Gary avatar
    6 posts
    Registered:
    04 Jul 2012
    28 Aug 2014
    Link to this post

    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.

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    01 Sep 2014
    Link to this post
    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
     
  3. Gary
    Gary avatar
    6 posts
    Registered:
    04 Jul 2012
    03 Sep 2014 in reply to Svetoslav Manchev
    Link to this post

    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

  4. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    05 Sep 2014
    Link to this post
    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
     
4 posts, 0 answered