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

setting frontend language


Reply

4 Posts   1330 Views

Avatar
hwi

1 February 2010 at 12:14pm Community Member, 5 Posts

Hi
I guess it should be a simple task - but I jut not get it ...
How to set your frontend language to another than english - I can see the files are there.

I red forth and back on the
// Enable Translations
i18n::enable();
i18n::set_locale('da_DK');
i18n::set_default_lang('da_DK');
added that in the mysite/_config.php
and flushed site
and dev/build

But I do not get it - is the above really the way to go about making:
lets say the "search button" or the hover tooltip "go to ...... page"
change to your language?

Please some one show me step by step what to do...

Thanks in advance

PS to the dev:
Why is the demo site of Silverstripe show a dropdown language list in admin - when a fresh install do not seem to have it?
Is there something wrong in my server environment?

I red a few hours on translations , multi language and so on - I find the documentation to be very difficult to oversee and several comments beneath stating that there is code errors in the tutorials...

Setting the language of the frontend should be a straight forward thing to do - preferable from admin - with not a single touch to files, same goes for the way of assigning templates

Anyway:
Your CMS looks great! - Thanks for sharing

Avatar
Juanitou

1 February 2010 at 11:00pm Community Member, 323 Posts

Hi hwi!

I’ve never used i18n without enabling Translatable, so my advice is maybe wrong, but I think i18n::set_default_lang() won’t work because it’s the same thing as Translatable::set_default_lang(). Normally you could remove it. Have you tried echoing i18n::get_locale() for testing if da_DK is being used?

As for the dropdown language list in admin, it’s Translatable which enables it.

Avatar
hwi

2 February 2010 at 1:03am Community Member, 5 Posts

Hi Juanitou

Thanks for the input - I will try to get the Translatable going. I might have misunderstood that this have to be done first.

Thanks for you reply
Cheers

Avatar
carlos

5 February 2010 at 3:45pm Community Member, 41 Posts

Hi,

you are right, you can set language in mysite > _config.php i18n::set_locale('es_ES');

Now, the search form values are not translatable, so you will have to do it manually, SearchForm() in Page.php