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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   1561 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