Jump to content

Custom Fields Translation


Recommended Posts

Hello to all!

i have a problem and i could really need you help. The problem started when i needed to translate my custom fields. I know, whmcs is not ready for that. But then i thought why couldn't i do this my self.


So i opened my clientareadetails.tpl and looked at the code. So here is my thought.


In the bottom of the template there is a foreach statement that shows the $customfield.name variable

and then prints the input boxes:


 {if $customfields} <br />
 <table width="100%" cellspacing="0" cellpadding="0" class="frame">
     <td><table width="100%" border="0" cellpadding="10" cellspacing="0">
         {foreach key=num item=customfield from=$customfields}
           <td width="150" class="fieldarea">{$customfield.name}</td>
           <td>{$customfield.input} {$customfield.required}</td>


What if i could instead of this


 <td width="150" class="fieldarea">{$customfield.name}</td>


something like this:


 <td width="150" class="fieldarea">{{$LANG}.{$customfield.name}}</td>


in order for the whmcs to look in the lang file for the appropriate translation. Of course the above example does not work.


So is it possible to combine and create a dynamic search of the translation?


maybe we could construct a variable that is going to be a compination of $LANG and the {$customfield.name} so we could use it like {$customvariable}

Link to comment
Share on other sites

  • 8 months later...
  • 2 weeks later...

In my setup I have in English.txt:


$_LANG['customclientfield']['DOY'] = 'IRS Office';
$_LANG['customclientfield']['VAT'] = 'VAT number';


Then at line 89 of clientareadetails.tpl, I replaced the code with:


<td width="150" class="fieldarea">{$LANG.customclientfield[$customfield.name]}</td>


And worked fine! :D

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.

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