Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When defining a custom action via the CAML schema definition, the UrlAction parameter specifies the "site or site collection relative URL of the page, for example, ~site/_layouts/sampleurl.aspx or ~sitecollection/_layouts/sampleurl.aspx." (taken from MSDN).

The UrlAction also supports javascript and localizable resources usage. For example:

<UrlAction Url="$Resources:osrvcore,List_Pages_UrlName;/SomePage.aspx" />

The above references the "SomePage.aspx" in the Pages library (this example was taken from the linked MSDN page, based on a reader suggestion). The library url is localized and changes based on the language the web site was created. This would work in most situations... but seems to fall appart when the MUI support comes into play.

Let me explain: suppose that we have only two language LangA (original server language) and LangB (language pack installed later).

  • We first create a new site collection with language A and a subsite with language A
  • We activate the MUI support on the web site/site collection
  • We define a custom action for the subsite (created with language A) that uses the aforementioned UrlAction.
  • We switch to LangB in the MUI settings.

Now the url action will point to the path of the Pages folder localized in the LangB language. No need to say that this will break the link, I suppose...

Does anyone know if there is a supported way to handle this behaviour in a caml only defined custom action? I suppose we can resort to a javascript workaround (or even better, define the custom action programmatically in a feature), but I was wondering if I am missing something obvious here.


EDIT - To further elaborate: SharePoint provides "two" conceptual ways to localize a resource (please forgive the semplification here):

  • Based on the website language: each SPWeb instance provides indication of the language the site was created with.
  • Based on the Thread CurrentUi culture: based on the MUI inner working, you can use the ui culture of the current thread -Thread.CurrentThread.CurrentUICulture- to support localization (this is again a semplification, but should serve to illustrate the problem).

When we write "Url="$Resources:osrvcore,List_Pages_UrlName;/SomePage.aspx"" the resource gets localized in the second way (MUI-aware). I'm wondering if there is a way to force localization based on the original web site locale.

share|improve this question

2 Answers 2

If I understand your example correctly I think it's impossible to create a library with MUI-enabled name. The url fragment you're trying to localize is a folder in the file system in SP content database. It can be viewed in Windows Explorer via Web-DAV, for example. How do you think this localization can be handled on the file system level?

share|improve this answer
    
You are right Alex - the list url represents a virtual "path" and I'm not aware of any way to "localize" it. I was wondering if we can do the opposite in some smart&simple way - please see my question edit for more detail. –  SPArchaeologist Feb 7 '12 at 7:51
up vote 0 down vote accepted

It would seem that (at last until SP2010) this behaviour isn't supported, so resources used in defining custom actions by CAML will always be resolved in MUI aware mode.

As said in the question, this will break the action under certain conditions - for example if the action points to the Pages library. As now it seems that there isn't any CAML only solution to this bug, so I have resorted to defining the action in codebehind.

(I am leaving this answer as a reference for anyone searching the same topic. If anyone finds out something different, feel free to leave his answer and I will update the post as needed)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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