Custom column in a list view web part for a multilingual site does not take on custom language labels. Stays in default language

StackOverflow https://stackoverflow.com/questions/23504671

سؤال

I have what so far appears to be a fairly unique problem. We are running a multilingual SharePoint 2010 environment with English as the default language and French as the secondary. We have setup the sites in a variance relationship, but the issue I am discussing happens outside of a variant as well.

We have created a library outside the variant (but within the collection) that the two sites must share. A list view web part was created via Designer to add to each site to provide a quick view into the list. If we are in the libary and switch to French, then update the column label it will remember the setting (because of the resource file) and maintain it as the language is flipped back and forth. Where it doesn't work is as a web part in a variant or where the language is different.

If the language is different, the out of the box columns work find, but the custom columns (all site columns not library\list columns) remain as the english label. It doesn't matter if within a variant or outside with the browser language changed. It always reverts back to English. It's like it isn't using the same resource file that was used in the list itself.

I created a custom view and modified it with xslt as per https://sharepoint.stackexchange.com/questions/50004/how-to-change-column-title-for-a-view-but-not-modify-the-list but this only worked within the list and did not occur in the list view either.

I can't be the first that has come across it, either I am not performing my searches properly, no one has ever documented a fix for this or this is something we just can't fix with OOTB tools. That's the other thing, the solution has to be accomplished OOTB or with minor client side changes. I can't fire up Visual Studio because they are piloting Office 365 and have put a "No custom code" mandate on for migration (which is real tough for me. I like my code ;P).

Thank you all in advance.

هل كانت مفيدة؟

المحلول

Ok, I have come up with a solution. I edited the XSLT for the web part on the page. I did the following:

  1. Create the variants in the Site Ccollection
  2. Create the library outside of the variants.
  3. Add all the columns you require for the library. It is very important all the columns are there before you move on.
  4. Create a French and English view.
  5. Create the list view web part via designer.
  6. Add the list view web part to each site selecting the appropriate view to use.
  7. Edit the page in SharePoint Designer 2010.
  8. Place cursor in the column you wish to modify.
  9. Click Design in the List View Tools on the ribbon.
  10. Then click Customize XSLT and select Customize Item. Select this option otherwise you will generate a LOT of unnecessary XSL code.
  11. You are looking for a piece that resembles the following:

    <xsl:with-param name="fieldtitle">
      <xsl:value-of select="@DisplayName"/>
    </xsl:with-param>
    
  12. Modify it by typing in the actual column name you want. You should end up with something like this:

    <xsl:with-param name="fieldtitle">
      New Column Name.
    </xsl:with-param>
    
  13. Now, for this page only, the column will be renamed.

There are some caveats:

  1. Doesn’t appear to work in a publishing portal. I think this has to do with how SP stores the pages in this case. In a publishing portal you can only modify the page layout which won’t work as we need to modify the content.
  2. If you add another column, you will need to repeat the XSLT modification

Anyways, I hope this helps out any others with the same issue or need as I had.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top