1

I am making a site in English and Arabic. I am using XSLT to display date but now I have realized that date is not being displayed properly in Arabic website. For that I need to change function in XSLT but problem is same function is being used in English site.

So I guess I will have to create a copy of that XSLT file in Arabic and then make changes in function. My question is, is this good practice? Do you guys create separate XSLT file for both English or Arabic or single? If single file then how do you handle function/code that needs to be displayed differently in both sites?

1 Answer 1

1

There is a global parameter in XSLT available in SharePoint called LCID that returns locale identifier (LCID) value for System.Threading.Thread.CurrentThread.CurrentUICulture (corresponds to the default language of the website)

For example:

<xsl:value-of select="ddwrt:FormatDate(atom:published, $LCID, 3)"/> 

For details about usage of date Formats in SharePoint XSL see, for example article Custom Date Formats in SharePoint XSL

For a full list of Global Parameters see XSLT Global Parameters


So, there is no need to create localized version of XSL files as it is common with Resource files in .NET

4
  • I tried to the code you posted in my homepage_style.xsl file and got error that "Unable to display this Web Part. To troubleshoot the problem....." Jul 31, 2013 at 17:06
  • Vadim: I tried to output the value of $LCID but it's empty (yes, I imported main.xsl first). Do you know why it could be?
    – MdMazzotti
    Jan 23, 2014 at 11:33
  • @MdMazzotti, hmm.. could you please provide some additional details, for which web part? Jan 25, 2014 at 8:56
  • @VadimGremyachev see my other question regarding this matter here: sharepoint.stackexchange.com/questions/88581/…
    – MdMazzotti
    Jan 25, 2014 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.