add different css stylesheets for different cultures?

Farah El Agha asked on November 20, 2017 14:16

how to add different stylesheet for each culture?

Correct Answer

Brenden Kehren answered on November 20, 2017 16:13

If you have totally different stylesheets you can load them by the current selected language by setting the visibility on the HTML Head webpart. Something like:

LocalizationContext.CurrentCulture.CultureCode == "en-GB"

Or you could name your language specific stylesheets with a similar fashion like Site1Stylesheet-en-GB then in your HTML Head webpart just have the URL with the dynamic macro at the end.

<link href="/CMSPages/GetResource.ashx?stylesheet=Site1Stylesheet-{%LocalizationContext.CurrentCulture.CultureCode%}" type="text/css" rel="stylesheet" />

0 votesVote for this answer Unmark Correct answer

Recent Answers


Deepak Vimalanath answered on November 20, 2017 14:38

You could take advantage of the lang attribute in the body tag and render different styles for different cultures.

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 20, 2017 14:45

can you please explain a bit more, or at least include links or example code ?

0 votesVote for this answer Mark as a Correct answer

Deepak Vimalanath answered on November 20, 2017 15:20

If you could inspect the source in the body tag you will find the culture eg. en-GB or fr-FR. Then in your css you could do something like body.en-GB {font-weigh: normal; } and change this for other. Hope this helps.

0 votesVote for this answer Mark as a Correct answer

okoye toto answered on December 10, 2017 16:32

i understand this topic very nicely and it is very helpful for me. mobdro

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.