คำตอบ Projected field display name localization

  • martedì 13 marzo 2012 17:16
     
      Contiene codice

    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?

Tutte le risposte

  • martedì 13 marzo 2012 20:54
     
     

    Hi,

    Where is the location DMResources.resx?


    Regards, Bilal | SharePoint Specialist

  • mercoledì 14 marzo 2012 08:14
     
     

    Hi,

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

  • mercoledì 14 marzo 2012 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

  • giovedì 15 marzo 2012 15:25
     
     Con risposta Contiene codice

    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.

    • Contrassegnato come risposta Shimin Huang lunedì 26 marzo 2012 07:37
    •