Jump to:

23374 Posts in 18175 Topics by 2866 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: 628 Views
  • martimiz
    Avatar
    Forum Moderator
    1067 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?

    Thanks,
    Martine

  • martimiz
    Avatar
    Forum Moderator
    1067 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 )

    628 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.