Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Two Languages Website


Go to End


3 Posts   1507 Views

Avatar
bunheng

Community Member, 78 Posts

5 February 2011 at 6:35am

Edited: 05/02/2011 6:43am

Hi,

I am trying to write condition to check $ContentLocale in order to execute some JavaScript required by page, my website has two languages which is en_US and km_KH. I start with the following code in my template.ss but it was error.

<% control Translations %>
<% if ContentLocale == 'en-US' %>
<script type="text/javascript" src="themes/cambo/scripts/conden.font.js"></script>
<% end_if %>
<% end_control %>

I really need help otherwise I can't sleep.

Bunheng

Avatar
Devlin

Community Member, 344 Posts

5 February 2011 at 8:50am

Edited: 05/02/2011 8:52am

<% if ContentLocale = en-US %>
<script type="text/javascript" src="themes/cambo/scripts/conden.font.js"></script>
<% else %>
<script type="text/javascript" src="themes/cambo/scripts/conden.font.js"></script>
<% end_if %>

Delete the control unless you do some magical stuff with it.

Avatar
bunheng

Community Member, 78 Posts

5 February 2011 at 3:15pm

Hi,

Thanks for your reply. Now it working fine.

Thanks.
Bunheng