How to add an additional stylesheet for specific cultures

Kayla Johnson asked on October 22, 2014 17:23

In my main site CSS I have an @import statement to import an external css file for a font. Is there a way I can add another @import if the language is Chinese? Or is it possible to add the stylesheet (chinesefont.css) in the master template?

I tried adding chiensefont.css to the header of the master template. But the font does not load. I don't see any 404 errors in the console. But I'm not sure if the font url is grabbing the correct path.

@font-face { font-family: 'fangzheng'; src: url('GetAzureFile.aspx?path=~\octave\media\css\fangzheng-gbk.ttf&hash=e58f7fa2c47391ec1813d0b71ad137ba1f4c9b201d2ea9d2902d2917ed7d6eb3'); font-weight: normal; font-style: normal; }

The GetAzureFile works in my main site css perfectly. But I don't think it's working here. What's the best way to add this font if the culture is Chinese?

Recent Answers

Yehuda Lando answered on October 22, 2014 19:52

I'm not familiar with Azure, but first, your path seems wrong (using \ instead of /), this might cause problems. I don't think there is a way by default to add a css according to your culture, but making a web part that achieves this is pretty straight forward.

1 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on October 23, 2014 23:18 (last edited on December 10, 2019 02:30)

The path that Kentico provide uses \ and I can get my other English fonts perfectly this way. Of course I have to escape it with \. So I don't think that's the problem. I don't really understand your comment about the web part. I tried creating a head HTML webpart that is enabled with this macro {% if ( CMS.DocumentEngine.DocumentContext.CurrentDocument.DocumentCulture == "zh-CN" ) { return true; } else { return false; } |(identity)GlobalAdministrator%}

But it's never true. How do I make a web part show for a certain language?

0 votesVote for this answer Mark as a Correct answer

Sandro Jankovic answered on November 21, 2014 17:16 (last edited on December 10, 2019 02:30)

Hi Kayla,

Please try writing the macro as follows and let us know if you have any trouble getting it to return true:

{% if ( CurrentDocument.DocumentCulture = "zh-CN" ) { "true" } else { "false" } |(identity)GlobalAdministrator%}

Best Regards,


1 votesVote for this answer Mark as a Correct answer

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