in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Niklas Östh's Sharepoint Blog

SharePoint tips and tricks from Sweden.

SPUrl and ~Language

If you are using the SPUrl expression prefix you can use the ~language to get the language-code for the site.

Example:
    <link id="LanguageCss" rel="stylesheet" type="text/css" href="<% $SPUrl:~SiteCollection/Style Library/TheCompany/~language/LanguageSpecificStyle.css%>" runat="server" />
Will give you something like this when evaluated:
    <link id="ctl00_LanguageCss" rel="stylesheet" type="text/css" href="/sites/theSite/Style Library/TheCompany/en-US/Styles/LanguageSpecificStyle-main.css" />

Published Jan 07 2008, 10:27 AM by niklaso
Filed under:

Comments

 

Emile Bosch said:

Note that this is not the the name variation label :-)  Juist the UICulture set on the current thread.

January 7, 2008 7:53 AM
 

SharePoint Link Love: 01-07-2008 at Virtual Generations said:

Pingback from  SharePoint Link Love: 01-07-2008 at  Virtual Generations

January 7, 2008 9:53 AM
 

Johan Dewe said:

No, it is the current web's language setting that's used for ~language. The UICulture has no impact in this case.

If you want to check for yourself, take .Net Reflector and have a look at Microsoft.SharePoint.Publishing.WebControls.SPUrlExpressionBuilder(...).

/Johan

February 12, 2008 3:37 AM
 

CH2006 said:

I checked Microsoft.SharePoint.Publishing.WebControls.SPUrlExpressionBuilder with reflector:

the ~language expression builder retrieves SPContext.Current.Web.Language, which seems to be the Sharepoint instance (or language pack) culture (1033 for US for instance), not the variation label (which has to be retrieved with SPContext.Current.Web.Locale)

so this ~language shortcut is rather useless for variations paths

August 28, 2008 5:20 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

About niklaso

Developer at Qurius Sweden

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts