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

Change default language without showing admin translation tab


Go to End


5 Posts   3084 Views

Avatar
Martijn

Community Member, 271 Posts

16 July 2009 at 5:14am

First of all: Hi and thanks for this - at first glance - excellent framework and cms.

I read the posts about the translations pro's and con's and managed to change the default language to nl_NL with:

Translatable::enable();
Translatable::set_default_locale('nl_NL');

Is it posible to change the default language, but disable the translation tab in the admin section?

Avatar
Martijn

Community Member, 271 Posts

17 July 2009 at 6:50am

Edited: 17/07/2009 7:10am

Ok, I managed to hide the translation tab by adding a rule in the function getCMSFields on mysite\code\Page.php

$fields->removeFieldFromTab("Root", "Translations");

Will hide the translationtab on all admin editpages.

I did this because I wanted to change the default language to Dutch, without showeing translation options.

Remove more tabs:
$fields->removeFieldsFromTab("Root", array('Content','Behaviour','To-do','Access','Reports','Translations'));

Maybe it is of use for someone.

EDIT:

This works for all tabs as expected except the Todo tab had to be called To-do instead of Todo like the tab is called.

Is this correct behaviour?

Avatar
martimiz

Forum Moderator, 1391 Posts

18 July 2009 at 2:37am

Hi Martijn,
Translatable is meant to be used on multi-lingual sites. If you're not planning on building one and you just want to have your site properly set to Dutch, you don't have to enable Translatable, it should be enough to just set in your sapphire/_config.php:

i18n::set_locale('nl_NL');

This is supposing you're using 2.3.2. Or are you for some reason aiming on doing a multi-lingual site without translations?

Avatar
Martijn

Community Member, 271 Posts

18 July 2009 at 5:23am

Edited: 18/07/2009 5:24am

No I don't... yet.

But because I could not get the dutch language files of ecommerce to work I added the rule i think...

But your right. It works without the Translatable enable...

should't this be don in mysite/_config.php?

Avatar
martimiz

Forum Moderator, 1391 Posts

20 July 2009 at 3:59am

>> should't this be don in mysite/_config.php?

It's just that Silverstripe places its example in the sapphire/_config.php so I just thought to point you to it :-) But sure, you're right, I guess all things particular to your site should be in mysite/, so they won't get lost on upgrades...