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 apart 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 sub-site with language A
- We activate the MUI support on the web site/site collection
- We define a custom action for the sub-site (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 behavior 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 simplification 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 simplification, 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.