Reputation: 1914
I'm trying to translate a custom ModelAdmin menu title as such:
private static $menu_title = _t('CMS.MyModelAdmin', 'My Model Admin');
This results in a 500 error, whereas a static string works without issues. I'm not sure why since I assumed this variable isn't a database entry.
How can you translate the menu title, preferably using _t?
Upvotes: 2
Views: 228
Reputation: 3318
I've not translated V3, however looking at...
http://api.silverstripe.org/3.1/source-class-LeftAndMain.html#665
$title = _t("{$menuItem->controller}.MENUTITLE", $defaultTitle);
This would indicate to me that if you have a string defined along with the other lang strings in the YML format like this (but for all required languages)...
mysite\lang\en_GB.yml
en_GB:
MyAdmin:
MENUTITLE: 'MyTitle'
(where "MyAdmin" is the name of the "class MyAdmin extends ModelAdmin...")
Upvotes: 4