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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Translate a tab?

Go to End

4 Posts   2274 Views


Community Member, 6 Posts

28 March 2008 at 8:10pm

How do I translate a tab like this?


default tabs (like Main / Meta) translated in sapphire/lang/*.php
$lang['ru_RU']['SiteTree']['TABMAIN'] = 'translation';

Seach didn't help.


Community Member, 473 Posts

28 March 2008 at 8:21pm

Edited: 28/03/2008 8:28pm

$fields->addToTab('Root.' . _t('SiteTree.TABCONTENT', 'Content') . '.' . _t('MyFile.MYNEWTAB', 'MyNewTab'));

Should do it, in your getCMSFields() method.


Community Member, 6 Posts

28 March 2008 at 9:26pm

Nope, doesn't work

It uses a translated string for both tab ID and tab text

<a id="tab-Root_Content_set_" href="/admin/&amp;flush=1#Root_Content_set_">МойТаб</a>

ID is stripped after set_ so any translated tab will have this same ID.

Compare to this perfectly translated and functional:

<a id="tab-Root_Content_set_Metadata" href="/admin/&amp;flush=1#Root_Content_set_Metadata">Мета-данные</a>

It's created in SuteTree.php:
$tabMain =new Tab('Main', .......
$tabMain->setTitle(_t('SiteTree.TABMAIN', "Main"));

First line sets both ID & Title, second line overrides the Title with translated text.

I guss I should do the same somehow... but dunno how...


Community Member, 6 Posts

29 March 2008 at 7:58pm

This could work

$tab = $fields->findOrMakeTab('Root.Content.Program');
$tab->setTitle(_t('SiteTree.MYTABNAME', "MyTab"));
$fields->addFieldToTab( 'Root.Content.Program', $tablefield );

but findOrMakeTab method of FieldSet is protected and I don't want ho hack the core