Archive for October, 2014

October 30, 2014

Alternate languages are not supported on sites with customized CSS files

I had a site with variation for English and Arabic. I had no problem changing the language from Arabic to English and vice versa in our staging environment. For En and Ar subsite even was able to change the language without any issue.

But in production environment the case was so strange. I can be able to change the language in subsites (ex: for en and ar subsites) but not for the root site. When i try to do so was getting the error “Alternate languages are not supported on sites with customized CSS files.” Tried on searching in log files and couldn’t find any clue to sort out this issue.

One of the solution that i come across when searching was to delete the “_style” folder under root. I removed the folder and the situatoin was the same. I thought it was the problem with the Arabic Language pack. I tried repairing the Arabic Lanuage pack. Though it didnt work.

Finally the solution is to remove the entry from the table “AllWebs” for the “CustomizedCSS” field for the root site.

  1. Connect to SQL Server using SQL Server Management Studio
  2. Open the “AllWebs” Table
  3. You will find 3 entries in this particular table for Root, English and Arabic Sites.
    When you check the CustomizedCSS for all these 3 records you will find some value for the root site record (in my case it was showing the ;#corei5; value) and for the other two you will find NULL value.
  4. Set the value for NULL for that.
  5. Once its done you can be able to change the language to Arabic without any issue.
October 30, 2014

Adding dynamic CSS link to Sharepoint MasterPage

In a situation where you have to load CSS files based on the current culture, in this situation you have to use the ~language variable in SharePoint. This will retrieve the proper language ID(example for English-US: en-US, Arabic-SA: ar-SA).

<link rel="stylesheet" href="<%$SPUrl:~sitecollection/_catalogs/masterpage/en-us/css/mystyle.css %>" />

In your master page HTML layout you can add the snippet as below:

<!--SPM:<asp:Literal runat="server" Text="<link rel='stylesheet' href='"/>-->
        <!--SPM:<asp:Literal runat="server" Text="<% $SPUrl:~sitecollection/_catalogs/masterpage/~language/css/mystyle.css %>"/>-->
        <!--SPM:<asp:Literal runat="server" Text="' type='stylesheet' />"/>-->

When using CSSRegistration can use the following snippet:

expected link URL :

<SharePoint:CssRegistration name=”<% $SPUrl:/_layouts/projectname/styles/~language/master.css %>” runat=”server”/>

Master page html page :

<!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~site/_catalogs/masterpage/test/style.css %&gt;" runat="server" after="SharepointCssFile" />-->
<!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~site/_catalogs/masterpage/test/style.css %&gt;" runat="server" after="SharepointCssFile" />-->