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.

Customising the CMS /

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

How translate core message

Go to End

4 Posts   1186 Views


Community Member, 8 Posts

30 May 2011 at 10:38pm


how can I translate core messages?
For example in CMSMain class (in file cms/code/CMSMain.php, Silverstripe version 2.4.5 - github) is this code snippet:

FormResponse::status_message('Saved site configuration', "good");

Is there a "right" way, how this message can be translated? Without editing core files.



Forum Moderator, 1391 Posts

31 May 2011 at 2:03am

I think the best way to handle these messages that should have the _t() method applied to them, is to create a patch and a ticket for them. This ticket would probably also include an entry in cms/lang/en_US and your chosen language file...

The translation would look something like this

FormResponse::status_message(_t('CMSMain.SAVEDSITECONFIGURATION','Saved site configuration'), "good");

In the meantime, there's not much else to do but manually enter the replacement code in your core, I guess :-(


Community Member, 8 Posts

31 May 2011 at 7:13pm

Thanks martimiz, I'll do it, as you say.
One more thing...It's better attach patch files into ticket or send a pull request on github?


Forum Moderator, 5523 Posts

1 June 2011 at 6:08pm

Pull requests are now the recommended method for posting code fixes as we can merge changes quickly.