Jump to content

Translate extra page from server module


Eduardo G.

Recommended Posts

Hi all.

I've built a custom server module.

In this provisioning module I'm using a custom function calling a custom template, as described at "WHMCS Provisioning Module Docs" documentation:

 

function template_extrapage($params) {
   $pagearray = array(
    'templatefile' => 'extrapage',
    'breadcrumb' => ' > <a href="#">Example Page</a>',
    'vars' => array(
       'var1' => 'demo1',
       'var2' => 'demo2',
    ),
   );
return $pagearray;
}

 

So I have my extrapage template (extrapage.tpl) showing the information and it's working right.

 

Well, now I want that extrapage.tpl in the same language customer is viewing the client's area.

 

Question is: how do I implement multi language from a provisioning module?

Link to comment
Share on other sites

you need to pass the language as one of the vars when returning the page array, ie:

 

function template_extrapage($params) {

//get lang name with some php and load the approriate lang file
include_once(dirname(__FILE__).'/langfile.php');
$lang = $_ADDONLANG;


   $pagearray = array(
    'templatefile' => 'extrapage',
    'breadcrumb' => ' > <a href="#">Example Page</a>',
    'vars' => array(
       'var1' => 'demo1',
       'var2' => 'demo2',
       'module_lang' => $lang,
    ),
   );
   return $pagearray;
}

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