Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Answered Projected field display name localization

  • 2012年3月13日 17:16
     
      コードあり

    I have view definition with projected fields. I need to get display names for these projected fields from a resource file, because the solution must work for different languages.

    I've tried this:

    <ProjectedFields>
    	<Field Name="DocType"
                 DisplayName="$Resources:DMResources,DocTypeFieldName"
                 Type="Lookup"
                 List="docs"
                 ShowField="CalculatedDocType" />
    </ProjectedFields>

    No luck there. In the view this field display name is "DocType".

    I've also tried this:

    <ViewFields>
    	<FieldRef Name="DocType" DisplayName="$Resources:DMResources,DocTypeFieldName"></FieldRef>
    </ViewFields>
    

    Again in the view this field display name is "DocType".

    Am I doing something wrong? Is there any other way to get the display name for projected field from resource string?

すべての返信

  • 2012年3月13日 20:54
     
     

    Hi,

    Where is the location DMResources.resx?


    Regards, Bilal | SharePoint Specialist

  • 2012年3月14日 8:14
     
     

    Hi,

    Resource files are located in {SharePointRoot}\Resources folder.

  • 2012年3月14日 17:38
     
     
    I guess you are deploying thru features, create a folder inside the feature folder called: "Resources" the move your resource file there and name it: "Resources.resx" then you use it inside the xml like: $Resources:DocTypeFieldName

    Regards, Bilal | SharePoint Specialist

  • 2012年3月15日 15:25
     
     回答済み コードあり

    Well, I've tried resources located in  {SharePointRoot}\Resources, the application global resources and the feature specific resources with no success.

    So I used another solution. I added the "DocType" field as additional field to a lookup field, defined in the list definition:

    <Fields>
          <Field ID="{02A15F14-FA4F-43B2-9990-09B5EED66779}"
              Name="Document"
              StaticName="Document"
              DisplayName="$Resources:DMResources,DocumentFieldName"
              Type="Lookup"
              List="Lists/Documents"
              ShowField="Title">
          </Field>
          <Field ID="{1ED073D2-9C98-4902-BD17-EA0D6850038C}"
              Name="DocumentType"
              DisplayName="$Resources:DMResources,DocTypeFieldName"
              Type="Lookup"
              List="Lists/Documents"
              FieldRef="{02a15f14-fa4f-43b2-9990-09b5eed66779}"
              ShowField="CalculatedDocType"
              ReadOnly="TRUE"/>
        </Fields>

    Then I added it to the ViewFields, And now everything is working as expected.

    I hoped that I wouldn't have to use that way, I need to use this field only in one view for this list, that is hidden from the UI.

    I still would like to know if there is any way to get the display name for a projected field from resource.

    • 回答としてマーク Shimin Huang 2012年3月26日 7:37
    •