问题描述
你好
我有一个问题,基本上我有一个多语言站点,有几个自定义列表,现在我想更改这些列表的标题,以根据语言显示正确的名称.
I have a following question, basically I have multilingual site, with several custom lists, now I would like to change the Title of those lists to show the correct name according to the language.
我已经对字段执行了此操作,并且它起作用了,现在我正尝试对列表执行相同操作,但是它不起作用.我对Powershell所做的更改.
I've done this already for the fields, and it worked, now I'm trying to do the same for the lists and it does NOT work. The changes I do with the Powershell.
这就是我所拥有的:
1)我有一个带有MyList_ResourceTitle的资源文件MyResources.resx
1) I have a resource file MyResources.resx with MyList_ResourceTitle
2)PowerShell脚本:
2) A PowerShell script:
function ChangeTitle($curList)
{
$curList.Title="`$Resources:MyResources,MyList_ResourceTitle;";
$curList.Update();
}
执行脚本后,我得到列表的名称,如下所示:$ Resources:MyResources,MyList_ResourceTitle;
After executing the script I get the name of the List like this: $Resources:MyResources,MyList_ResourceTitle;
我对列表中的字段也做过
I have done the same with the fields in the list
$field.Title = ....
而且有效,我不明白为什么它不适用于列表...
And it worked, I don't understand why it does not work with the list ...
任何人都有经验,可以提供帮助吗?谢谢
Anyone has any experience and would be able to assist? Thanks
推荐答案
使用SPUtility.GetLocalizedString方法从资源.resx文件中获取特定值,如下所示:
Use SPUtility.GetLocalizedString method to get a specific value from resource .resx file like below:
这篇关于更改列表标题以使用资源(resx)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!