Jump to content

Tip: Multilingual Quotes


Recommended Posts

Hey Guys;

 

I was recently asked if it was possible to make the quotes in WHMCS generate a pdf file using the clients language preference.

 

The simple answer is yes.

 

Add the following to the top of quotepdf.tpl just after <?php

if ($clientsdetails["language"]) {
   unset($_LANG);
   copy ( ROOTDIR."/lang/".$clientsdetails["language"].".txt", ROOTDIR."/lang/".$clientsdetails["language"].".php");

   $current = file_get_contents(ROOTDIR."/lang/".$clientsdetails["language"].".php");
   $current = "<?php 
".$current;
   file_put_contents(ROOTDIR."/lang/".$clientsdetails["language"].".php", $current);

   include ROOTDIR."/lang/".$clientsdetails["language"].".php";
   unlink(ROOTDIR."/lang/".$clientsdetails["language"].".php");
}

 

What this does is unsets the current language and reloads the clients language.

 

Now all you have to do is change the static text into language variables :)

 

Hope this helps!

Edited by jeremyhaber
Link to comment
Share on other sites

Thank you Jeremy!!

This is extremely helpful,and it works really well.

 

Has anyone noticed that the email being sent out with the quotes does ignore the set language?

It is not working with me. No matter what language I have set, it is just sending out the default language wihich is of course really annoying.

 

I tried using:

{if $language == "French"}

french version

{elseif $language == "English"}

english version

{else}

default language version

{/if}

 

But it deletes the first entry and then shows {else} and {/if} as plain text.

 

Not sure why Matt has not fixed this yet. But if anyone has a solution I would really apreciate it.

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