Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How translate core message

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

Page: 1
Go to End
Author Topic: 905 Views
  • lku
    Avatar
    Community Member
    8 Posts

    How translate core message Link to this post

    Hello,

    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.

    Thanks.

  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Re: How translate core message Link to this post

    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

  • lku
    Avatar
    Community Member
    8 Posts

    Re: How translate core message Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: How translate core message Link to this post

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

    905 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.