Jump to content

Connect a third-party module for the language


swish

Recommended Posts

Hello, Installed module DNSmanager 2.5.3

I'm trying to make the hook:

 

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   if (!is_null($primaryNavbar->getChild('Support'))) {
       $primaryNavbar->getChild('Support')
           ->addChild('Manager DNS', array(
               'label' => Lang::trans('manage_dns'),
               'uri' => 'index.php?m=DNSManager2',
               'order' => '100',
           ));
   }
});

 

But I did not get to see a different language.

Directory containing the module /modules/addons/DNSManager2

modules/addons/DNSManager2/langs/english.php

modules/addons/DNSManager2/langs/russian.php

 

$_LANG['manage_dns'] = 'Управление DNS';

 

How to connect the hook, thanks

Link to comment
Share on other sites

you need to place this

$_LANG['manage_dns'] = 'Управление DNS';

inside /WHMCS-main-dir/lang/overrides/english.php

and /WHMCS-main-dir/lang/overrides/russian.php

 

as the method Lang::trans() only read from the following directories /WHMCS-main-dir/lang/ and /WHMCS-main-dir/lang/overrides/ (at least)

 

for more information about Language Overrides

Link to comment
Share on other sites

Thank you very much, it came out.

And tell me how to add in different languages?

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $primaryNavbar->addChild('Управление DNS')
       ->setUri('index.php?m=DNSManager2')
      ->setOrder(50);
});

Link to comment
Share on other sites

it's easy, check how I'v added the label below:

 

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) 
{ 
   $primaryNavbar->addChild('Управление DNS')
       ->setLabel( Lang::trans("manage_dns") )
       ->setURI('index.php?m=DNSManager2') 
       ->setOrder(50); 
});  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated