Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > css files localization View modes: 
User avatar
Member
Member
eagleag - 2/3/2011 1:36:52 AM
   
css files localization
Hi,
im building a multi culture (ltr & ltr) site and would like to separate out each culture css file.
Is there any css localization extension, like with transformations?
example:
myCss
myCss_en-us
myCss_he-il

Or do I need to tap in to master page load and change the css link?
I don't want to use the RTL class added in body :(

THANKS :)


User avatar
Member
Member
dima - 2/3/2011 1:59:01 AM
   
RE:css files localization
I would probably created a separate css file naming it following the required naming convention, but still would use .rtl class name

User avatar
Member
Member
eagleag - 2/3/2011 2:48:58 AM
   
RE:css files localization
doesn't that mean it would load all css files for every culture?
I want it to load the correct css file for each culture

User avatar
Member
Member
dima - 2/3/2011 4:20:12 AM
   
RE:css files localization
that's a good question.
but you're still probably going to have one main css file with general styles. and a css file with amends related to a culture.
lets see what kentico guys say but if they suggested modifying some of the system .cs files I would go with loading all css files instead.

User avatar
Member
Member
eagleag - 2/3/2011 4:43:59 AM
   
RE:css files localization
a long time ago (don't remember how long) I used this code to solve the issue.
Added html head webart to master page with this code:

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);

if (this.StopProcessing)
{
// Do nothing
}
else
{
string css1 = "<link type=\"text/css\" rel=\"stylesheet\" href=\"/CMSPages/GetCSS.aspx?stylesheetname=mysiteHeb\"/>";
string css2 = "<link type=\"text/css\" rel=\"stylesheet\" href=\"/CMSPages/GetCSS.aspx?stylesheetname=mysite\"/>";
if (CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentCulture.ToString() == "he-IL")
{
this.Page.Header.Controls.Add(new LiteralControl(css1));
}

else if (CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentCulture.ToString() == "en-US")
{
this.Page.Header.Controls.Add(new LiteralControl(css2));
}

else
{
this.Page.Header.Controls.Add(new LiteralControl("ERROR"));
}

}
}


Is there any better way to do this?
my 5.5 has it built-in?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 2/8/2011 2:41:51 AM
   
RE:css files localization
Hi,

The easiest solution may be to insert the link to the css file directly in the Master page tab. This document is unique for each culture version, therefore inserting only one line for each version is needed.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
eagleag - 2/8/2011 3:07:57 AM
   
RE:css files localization
Hi,
So from what I understand I should also (in addition to adding link in master page),
goto site manager -> sites-> edit -> Site CSS stylesheet: -> none

wold that complete what your suggesting?

Thanks

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 2/8/2011 4:03:25 AM
   
RE:css files localization
Hi,

in the settings you should not set none. It may cause the app_themes images to not be displayed correctly. Instead you could set for example some empty css file here (or containing styles common for each culture).

Another solution (probably better) is to set alternative stylesheet in Properties of the master page document (General tab). Choose the alternative css style instead of the default one. Only the link code line with this css file will be generated in the head part.

Best regards,
Ivana Tomanickova