Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Translate SiteTree context menu??

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 642 Views
  • martimiz
    Forum Moderator
    1086 Posts

    Translate SiteTree context menu?? Link to this post

    Hi all,

    Has anyone found a proper way to translate the SiteTree context menu - the popup you get when right-clicking the CMS Sitetree?

    It's the TreeContextMenu = {... } bit in the /cms/javascript/CMSMain_left.js. Using the ss.i18n._t( ... ) method is not an option, I hope someone has thought of some workaround besides hacking the code directly?


  • martimiz
    Forum Moderator
    1086 Posts

    Re: Translate SiteTree context menu?? Link to this post

    For anyone who's still interested: it can't be done properly . The menutext is hardcoded into the CMSMain_left.js file (around line 665) - in the indexvalues of the TreeContextMenu array. These indexvalues are then used in the LeftAndMain.js createContextMenu() function to create the contextmenu's innerHTML...

    So my suggestion would be:

    - replace the readable text indexvalues by something more 'symbolic' in cms/javascript/CMSMain_left.js around line 665

    - translate them in cms/javascript/LeftAndMain.js around line 825 using something like translatedMenuItemName = ss.i18n._t('CONTEXTMENU.' + menuItemName, menuItemName);

    - provide proper translations in cms/javascript/lang/en_US.js ao

    Cheers, Martine

    (Now if only I remembered how to properly do a patchfile )

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.