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.

Archive /

Our old forums are still available as a read-only archive.

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

Multilingual site with a default language


Go to End


5 Posts   5917 Views

Avatar
artemb

Community Member, 11 Posts

27 July 2008 at 10:49pm

Hi all!

I have got a website in 2 languages: English and Russian. When a user first visits the website, he sees the English translation. How can I make Russian the default language? I have tried i18n::set_default_language('ru') but instead of making the site look russian by default, it made the language switch in the CMS go away. Please, help.

With best regards,
Artem B.

Avatar
artemb

Community Member, 11 Posts

31 July 2008 at 12:19am

I'm really confused. In the _config.php file I set

i18n::enable();
Translatable::set_default_lang('ru');

Then I set a breakpoint on Translatable::current_lang() and see that it always returns "ru", Why then the site is loaded in English first?

Please, help!

With best regards,
Artem B.

Avatar
artemb

Community Member, 11 Posts

1 August 2008 at 8:37pm

Guys, I really need help with this problem.

I have a website with nothing but a homepage translated into 2 languages - English and Russian. My goal is to show russian version by default and let the user switch to english if he likes.

Now, whenever a user visits the site it displays english version of the home page by default. If I visit /?lang=ru it displays russian.

I have tried to set i18n::set_default_lang('ru') which completely disables any multi-lingual content and makes the site show the english page even if I add ?lang=ru to the url.

If anyone has any idea about how to do that, please tell. I would really like some expertease on this.

Avatar
alfa

Community Member, 20 Posts

1 August 2008 at 8:50pm

Edited: 01/08/2008 8:58pm

That's weird,

I have a site with default language set on Bulgarian and English to switch by ?lang=en.

So it should work with:

i18n::enable();
i18n::set_default_lang('ru');

And when you enter the CMS the default language set to add things will be Russian, when you change it in the CMS to English (for example) and you leave the CMS set on English the website will be in English.. so before you leave let it on Russian again.

Dispite that, with those strings added in your _config.php everything should work (i have it that way and it works) ^^ maybe it's a good idea when you do it to flush the cache ?flush=1

hope you make it!

EDIT:

Well if everything still goes on a mess, you can save your work and start making a new page with the translation mode enabled..this way it should by everything ok ^^

Cheers,

Avatar
artemb

Community Member, 11 Posts

1 August 2008 at 9:08pm

It seems like you have to start with your default language from the very beginning and THEN translate pages to the secondary (english in my case). I have started the site from scratch and that fixed the problem.

Thank you, alfa, DesignCity and simon_w!