Ugyen Posted May 12, 2016 Share Posted May 12, 2016 Hi WHMCS Community, I have applied your template 6 customization logic from http://docs.whmcs.com/Editing_Client_Area_Menus for Add a social media panel to the end of the sidebar includes/hooks/socialMediaPanel.php and Add support hours and a custom message to the sidebar on the submit ticket page in my WHMCS installation. Problem here is I can't translate to other language I have used both ways. 'label' => Lang::trans('yourstringhere'), under arrary for includes/hooks/addSupportHours.php. Can't able to translate the last line 51 and 52 . I have applied as you mentioned using array but not. I have shared screenshot for which It need to be translated. Looking forward hearing from you. With Best Regards, Ugyen 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 12, 2016 Share Posted May 12, 2016 Hi Ugyen, there would be a few ways to do this, depending on the complexity of your output message... for this, you can use sprintf and Language Overrides... in the hook... $supportHours->setBodyHtml( $supportIsOpen ? sprintf(Lang::trans('supportdeptopen'),$greeting) : sprintf(Lang::trans('supportdeptclosed'),$greeting) ); }); } and then for the Language Overrides, just add entries to your language override file(s)... $_LANG['supportdeptopen'] = "Hi%s! We're open and will respond to your ticket soon!"; $_LANG['supportdeptclosed'] = "Don't worry%s! We will respond on the next business day. Sit tight!"; if you don't need to pass any variables in your translated message, then it's simpler and you won't need to use sprintf. $supportHours->setBodyHtml( $supportIsOpen ? Lang::trans('supportdeptopen') : Lang::trans('supportdeptclosed') ); }); } and... $_LANG['supportdeptopen'] = "We're open and will respond to your ticket soon!"; $_LANG['supportdeptclosed'] = "We will respond on the next business day. Sit tight!"; 0 Quote Link to comment Share on other sites More sharing options...
nedel Posted December 30, 2019 Share Posted December 30, 2019 Hi! Can you tell us how set head title on this hook? Everything is translated, just not this part from top $supportHours = $primarySidebar->addChild('Support Time'); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 31, 2019 Share Posted December 31, 2019 16 hours ago, nedel said: Can you tell us how set head title on this hook? Everything is translated, just not this part from top do you mean at the top of the sidebar ? if so, then it should just need setLabel and using a language string (via Lang::trans). 0 Quote Link to comment Share on other sites More sharing options...
nedel Posted January 1, 2020 Share Posted January 1, 2020 I tried but not success. Can you add how need look that code? This is from tutorial $supportHours = $primarySidebar->addChild('Support Time'); I try include this Lang::trans('titlenamesupporttime') but without results. How we can properly implement lang trans? If use lang trans like for child or body, not work. I think i need diferent use lang trans code for title? Can you show me how? Thank you! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 2, 2020 Share Posted January 2, 2020 15 hours ago, nedel said: How we can properly implement lang trans? the support hours lie changes to.... $supportHours = $primarySidebar->addChild('Support Hours')->setLabel(Lang::trans('supporthours')); and then define your support hours heading language string in every language that your site uses (using Language Overrides).... $_LANG['supporthours'] = "Brian's Support Hours"; 0 Quote Link to comment Share on other sites More sharing options...
nedel Posted January 3, 2020 Share Posted January 3, 2020 HI Brian! Happy new year, i wish all best for you! And thank you very much for code. That i need, now title translated. ->setLabel(Lang::trans('supporthours')) Now all words translated from that hook. Thank you!! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 6, 2020 Share Posted January 6, 2020 On 03/01/2020 at 19:17, nedel said: Happy new year, i wish all best for you! and to you too. 🙂 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.