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.

General Questions

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

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

Multilingual Content - alternative to 'translatable'


44 Posts   11089 Views


23 June 2009 at 12:15pm Community Member, 73 Posts

THANK you very much!

i'll give this a try and let you know...!

anyway, thank you very much :)



23 June 2009 at 2:44pm Community Member, 127 Posts


just to be sure that you know this:

i18n (which was not broken, only translatable was) would do the same more elegantly, as long as you just need to display translated text.


23 June 2009 at 2:52pm Community Member, 73 Posts


Confirmed. Your fix works! thank you very much! :)


I don't know if you are refering to the new version of SS. I've asked for a more friendly tutorial to implement the new version of multi language support, but i did not find any "no programmer friendly" tutorial.

If you have some post that explains this, i will be very happy!






23 June 2009 at 3:17pm (Last edited: 23 June 2009 3:19pm), Community Member, 127 Posts


to go with Howard's example, instead of

<% if LangIsMaori %>
<h2>Ngā mahi whai muri mai</h2>
<% else %>
<h2>Upcoming Events</h2>
<% end_if %>

when using i18n you simply need

<h2><% _t('Events.Upcoming_Events',"Upcoming Events") %></h2>

and the translations are in files in /mysite/lang/ such as for English in en_US.php

$lang['en_US']['Events']['Upcoming_Events'] = 'Upcoming Events';

or for Maori in mr_MR.php (I assume, check the correct code)

$lang['mr_MR']['Events']['Upcoming_Events'] = 'Ngā mahi whai muri mai';

You can see that the code in the templates is much more simple and universal than starting to check languages there with if-elseif-else constructions, and scalable, you can add as many translations as you want without changing the template.

If you need to add language specific stuff other than text the if-else might be the way you need to go though.

As said, while translatable needs i18n the fact that translatable was broken does not mean that i18n was broken. I mix the Multilingual Content - alternative to 'translatable' in SS 2.3.1 with i18n, works fine. See also my posts on the previous page about [url=]i18n[/url] and a [url=]bug in i18n in SS 2.3.1[/url]


23 June 2009 at 3:23pm Community Member, 127 Posts


i18n is of course also available and heavily used in 2.3.2. many of the more recent templates now already use it, instead of hardcoding the English text, so often you only need to add your translations in /mysite/lang.


8 July 2009 at 10:23pm Community Member, 1 Post

I have exactly the same problem than Cem. Wilhe I followed exactly the two first steps of the "recipes:multilingual_content", I have the following error message when I try to visit

Fatal error: Class 'MultiLingual' not found in [...]/sapphire/core/control/Director.php on line 274

Since I added the Multilingual class in mysite/code/Page.php, works fine
Version: 2.3.2

Does anyone has an idea to help me? I suppose we should show the system that the Multilingual class is present in mysite/Multilingual.php but I have no idea how to do it...

Thanks in advance !


10 July 2009 at 11:37pm (Last edited: 11 July 2009 12:56pm), Community Member, 127 Posts

@sebaf, the "Alternative Multilingual" recipe is for SS 2.3.1 only.

In SS 2.3.1 the "translatable" module was broken, so we needed it this alternative. However in 2.3.2 the translatable module is back and better than ever before, so if you use SS 2.3.2 you neither need the alternative nor was it ever meant to be used with it.

In short: With SS 2.3.2 use the translatable module!


11 July 2009 at 5:47am Community Member, 73 Posts


Thanks for your answer, actually i'm having a problem with a form wich i need to translate.
I don't want to appear like an asshole here, but i think the documentation for the multi language sites it's far to be clear.

Anyway, thank you very much for your help! :)