[英]How to localize SharePoint publishing page title
How does one localize the page title of a SharePoint publishing page? 如何本地化SharePoint发布页面的页面标题? I am provisioning it like:
我将其设置为:
PublishingPage newPage = publishingWeb.GetPublishingPages().Add("mypage.aspx", "mylayout.aspx");
newPage.Title = "$Resources:MYRESX,MyPage_PageTitle";
newPage.Update();
When I provision this page, the title shows up literally, $Resources:MYRESX,MyPage_PageTitle
, instead of SharePoint looking up the string. 当我设置此页面时,标题
$Resources:MYRESX,MyPage_PageTitle
显示$Resources:MYRESX,MyPage_PageTitle
,而不是SharePoint查找字符串。 So, I guess my assumption is wrong that SharePoint would look the string up. 因此,我想我的假设是SharePoint将查找字符串是错误的。 Or I have the syntax wrong.
或者我的语法错误。
I am already referencing MYRESX
in other places; 我已经在其他地方引用过
MYRESX
; I am sure the resource file / string is accessible. 我确定资源文件/字符串可以访问。
I have the exact same issue for webpart titles as well, so hopefully a unified solution exists for both scenarios. 我也对Webpart标题有完全相同的问题,因此希望针对这两种情况都存在一个统一的解决方案。
Try SPUtility.GetLocalizedString : 尝试SPUtility.GetLocalizedString :
newPage.Title =
SPUtility.GetLocalizedString(
"$Resources:MyPage_PageTitle",
"MYRESX",
web.Language);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.