Translate the content in workflow
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.
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
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
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
>());