代码之家  ›  专栏  ›  技术社区  ›  Vijay

从资源文件设置Web部件标题

  •  2
  • Vijay  · 技术社区  · 17 年前

    我试图通过资源文件设置Web部件的标题和描述。 我的 .webpart 文件包含以下内容:

    <?xml version="1.0"?>
    <webParts>
      <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
        <metaData>
          <type name="MyWebParts.MyWebPart" />
          <importErrorMessage>Cannot import this web part.</importErrorMessage>
        </metaData>
        <data>
          <properties>
            <property name="Title" type="string">$Resources:MyWebPartResources,WebPartTitle</property>
            <property name="Description" type="string">$Resources:MyWebPartResources,WebPartDescr</property>
          </properties>
        </data>
      </webPart>
    </webParts>
    

    我已将资源文件放入 12\Resources 文件夹。

    但是, 添加Web部件 对话似乎没有从资源文件中选择标题和描述。

    有人修过这个吗?

    更新-1: 论 添加Web部件 对话,我看到以下内容而不是资源文件中的文本:

    $Resources:MyWebPartResources,WebPartTitle
    $Resources:MyWebPartResources,WebPartDescr
    
    2 回复  |  直到 17 年前
        1
  •  0
  •   Lee Dale    17 年前

    我想资源文件应该在websiteroot/app_globalresources中。

    只有在首次创建Web应用程序时,12/resources文件夹的内容才会复制到app_globalresources。

        2
  •  0
  •   Community Mohan Dere    9 年前

    链接, SharePoint Internals: Resources (由 anchorpoint 在评论中)帮助了很多。 Lee Dale 也是正确的。尽管如此,它还是第一次在我的机器上不工作,即使我是正确的。可能是因为某些缓存问题。

    后来,我尝试清除临时互联网文件,停用和激活功能,它工作了!