nathanro Posted July 19, 2010 Share Posted July 19, 2010 Can anyone help me a bit please? I am trying to make the names of the products work, and I am also trying to add a login or register on the header.tpl Can someone please help me with more explanation on how this is achieved? I am having some trouble with that and I would like to finish it. My site is http://jkweb.tv/clientes 0 Quote Link to comment Share on other sites More sharing options...
jacksoggetto Posted July 20, 2010 Share Posted July 20, 2010 I'm on 4.2.1, and only interested for product (name and description) and KB categories. So I copied the first script of this thread (only interested in 2 languages, I'm going to delete all the other from the folder) <?php /* * Smarty plugin * ————————————————————- * File: function.getlang.php * Type: function * Name: XML Language Data * Purpose: Returns only the language data surrounded by language tags * ————————————————————- */ function smarty_function_getlang($params, &$smarty){ $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.$params['data'].'</root>'; $lang = $params['lang']; if(simplexml_load_string($xmldata)===FALSE) { return $params['data']; } else { $langxmlobj = new SimpleXMLElement($xmldata); if ($langxmlobj->$lang){ return $langxmlobj->$lang; } else { return $params['data']; } } } ?> and put in: /whmcs/includes/smarty/plugins/function.getlang.php then I edited the product name of one product in this way: <Italian>Piano base</Italian><English>Basic plan</English> and then edited the first piece of the template: from: {$product.name} to: {getlang data=$product.name lang=$language} but i get: <Italian>Piano base</Italian><English>Basic plan</English> So nothing happens. I've tried to delete the function file, and I get white page. Do you have some advice? 0 Quote Link to comment Share on other sites More sharing options...
Sylvie Posted August 8, 2010 Share Posted August 8, 2010 I noticed that WHMCS is lacking in the ability to add product titles and descriptions in multiple languages and although there is a mod solution already published http://forum.whmcs.com/showthread.php?t=15045&highlight=products+multiple+languages it is not the most elegant or flexible solution so I decided to create something better. This solution uses Smarties own plug-in functionality to allows you to easily add multilingual content to any field in the admin. It works by surrounding the content in simple xml tags e.g. <English>English content</English> <French>French content</French> First thing you need to do is create a plug-in file in the following folder /whmcs/includes/smarty/plugins/function.getlang.php and add the following code to the file <?php /* * Smarty plugin * ————————————————————- * File: function.getlang.php * Type: function * Name: XML Language Data * Purpose: Returns only the language data surrounded by language tags * ————————————————————- */ function smarty_function_getlang($params, &$smarty){ $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.$params['data'].'</root>'; $lang = $params['lang']; if(simplexml_load_string($xmldata)===FALSE) { return $params['data']; } else { $langxmlobj = new SimpleXMLElement($xmldata); if ($langxmlobj->$lang){ return $langxmlobj->$lang; } else { return $params['data']; } } } ?> Next for any smarty variable that outputs data entered into the admin E.g. the $product.name or $product.description tag in your orderforms you can replace it with the tag below (Note the script will output the full value if no tags are found) {getlang data=$product.name lang=$language} OR {getlang data=$product.description lang=$language} It is then just a simple job or adding the content in the admin with the correct names based on your sites language. <English>English content</English><French>French content</French If anyone finds any bugs then please post them here Hi I'm not sure where I need put this code : {getlang data=$product.name lang=$language} and <English>English content</English><French>French content</French 0 Quote Link to comment Share on other sites More sharing options...
Sylvie Posted August 8, 2010 Share Posted August 8, 2010 Hi I'm not sure where I need put this code : {getlang data=$product.name lang=$language} and <English>English content</English><French>French content</French Need help please 0 Quote Link to comment Share on other sites More sharing options...
ljesh Posted August 24, 2010 Share Posted August 24, 2010 Anyone has an advice on where can we find the template used for the ajax form? I mean the domain.com/order/index.php part 0 Quote Link to comment Share on other sites More sharing options...
SistemasyServicios Posted August 28, 2010 Share Posted August 28, 2010 @ServWise.com Have you been able to pass the correct lang values to the pdf invoice? This is the part where I got stuck!! I think already have all files edited and working on Version 4.3.1, Admin area looks like a war zone, though... hehe 0 Quote Link to comment Share on other sites More sharing options...
Webdomain.com Posted September 22, 2010 Share Posted September 22, 2010 @ServWise.com Have you been able to pass the correct lang values to the pdf invoice? This is the part where I got stuck!! I think already have all files edited and working on Version 4.3.1, Admin area looks like a war zone, though... hehe I second this request. How to get translations into pdf invoice and into the admin area? 0 Quote Link to comment Share on other sites More sharing options...
nathanro Posted September 23, 2010 Share Posted September 23, 2010 This was working for me, I moved servers, transfered my entire account with an account backup, and now it is not working any advice? 0 Quote Link to comment Share on other sites More sharing options...
tohms Posted December 1, 2010 Share Posted December 1, 2010 I second this request.How to get translations into pdf invoice and into the admin area? I also like to know how to get this into invoices as there's no use of Smarty?! This snippet is great, but with having something like <English>MyProduct</English><OtherLanguage>MyProduct</OtherLanguage> in invoice it is more or less useless 0 Quote Link to comment Share on other sites More sharing options...
pasko Posted January 6, 2011 Share Posted January 6, 2011 Hi Sam, Could you fix all that for me? No free of course! Regards. 0 Quote Link to comment Share on other sites More sharing options...
pasko Posted January 6, 2011 Share Posted January 6, 2011 I noticed that WHMCS is lacking in the ability to add product titles and descriptions in multiple languages and although there is a mod solution already published http://forum.whmcs.com/showthread.php?t=15045&highlight=products+multiple+languages it is not the most elegant or flexible solution so I decided to create something better. This solution uses Smarties own plug-in functionality to allows you to easily add multilingual content to any field in the admin. It works by surrounding the content in simple xml tags e.g. <English>English content</English> <French>French content</French> First thing you need to do is create a plug-in file in the following folder /whmcs/includes/smarty/plugins/function.getlang.php and add the following code to the file <?php /* * Smarty plugin * ————————————————————- * File: function.getlang.php * Type: function * Name: XML Language Data * Purpose: Returns only the language data surrounded by language tags * ————————————————————- */ function smarty_function_getlang($params, &$smarty){ $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.$params['data'].'</root>'; $lang = $params['lang']; if(simplexml_load_string($xmldata)===FALSE) { return $params['data']; } else { $langxmlobj = new SimpleXMLElement($xmldata); if ($langxmlobj->$lang){ return $langxmlobj->$lang; } else { return $params['data']; } } } ?> Next for any smarty variable that outputs data entered into the admin E.g. the $product.name or $product.description tag in your orderforms you can replace it with the tag below (Note the script will output the full value if no tags are found) {getlang data=$product.name lang=$language} OR {getlang data=$product.description lang=$language} It is then just a simple job or adding the content in the admin with the correct names based on your sites language. <English>English content</English><French>French content</French If anyone finds any bugs then please post them here Hi, I did create and uploaded the function.getlang.php Now I am a bit lost... 0 Quote Link to comment Share on other sites More sharing options...
Sylvie Posted February 20, 2011 Share Posted February 20, 2011 It works.ServWise, if you have a moneybookers account, PLEASE send me a PM with your e-mail address and allow me to send you a small donation for spending your time making this wonderful mod as a small appreciation for making my life easier. WHMCS is probably the MOST used billing system in the webhosting industry. I never understood why they don't allow EVERYTHING to be translatable in other languages. Thank you, I mean alot. One question... Does this works for knowledge base categories and articles? If yes, please someone write instructions as detailed as possible, please. ------------ I see you are setup this for you products .... I can't figure how setup this on my whmcs !! I'm realy appreciate if you help me to make my product french and english language !! I pay you for sure could you please help me ??? Thank You Sylvie 0 Quote Link to comment Share on other sites More sharing options...
onager Posted February 20, 2011 Share Posted February 20, 2011 Hi Sylvie, if you want to take some advice from me: this MOD has some disadvantages. To me the main one was, that in the invoices the product is named <lang1>Product<\lang2><lang2>Produit<\lang2> etc. ServWise has published another MOD, using the language files: http://forum.whmcs.com/showthread.php?t=22048. I managed to get this working this weekend for products and productgroups and I still have to figure out how to pull in the translated strings into the invoices. Shouldn't be to difficult as soon as I know what I'm doing . 0 Quote Link to comment Share on other sites More sharing options...
linuxman Posted March 18, 2011 Share Posted March 18, 2011 You need to wrap html in <![CDATA ]> tags e.g. <English><![CDATA[html content ]]></English> Hi with this adds is work nice <![CDATA[code here ]]> but none html tags , I have the <tr> <td> <table> <img> and others Can you tell what I need to do ? 0 Quote Link to comment Share on other sites More sharing options...
ljesh Posted May 20, 2011 Share Posted May 20, 2011 I think this doesn't work on the latest (4.5.1) version of WHMCS. "Great". 0 Quote Link to comment Share on other sites More sharing options...
nicholas Posted June 14, 2011 Share Posted June 14, 2011 Hello, I tried this solution but I have problem on this step: --------------------------------------------------------------------------------------------------------- Next for any smarty variable that outputs data entered into the admin E.g. the $product.name or $product.description tag in your orderforms you can replace it with the tag below (Note the script will output the full value if no tags are found) {getlang data=$product.name lang=$language} OR {getlang data=$product.description lang=$language} --------------------------------------------------------------------------------------------------------------- I get a smarty error that {getlang data=$product.description lang=$language} is not valid. I've followed all the steps. 0 Quote Link to comment Share on other sites More sharing options...
imaticon Posted August 9, 2011 Share Posted August 9, 2011 Hi, To get this worked for the latest version of WHMCS, replace this: $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.$params['data'].'</root>'; with this: $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.html_entity_decode($params['data']).'</root>'; This should work. Try out and have fun 0 Quote Link to comment Share on other sites More sharing options...
dbitser Posted December 3, 2011 Share Posted December 3, 2011 The only thing i get with your code is } - }. Can you help please. I noticed that WHMCS is lacking in the ability to add product titles and descriptions in multiple languages and although there is a mod solution already published http://forum.whmcs.com/showthread.php?t=15045&highlight=products+multiple+languages it is not the most elegant or flexible solution so I decided to create something better. This solution uses Smarties own plug-in functionality to allows you to easily add multilingual content to any field in the admin. It works by surrounding the content in simple xml tags e.g. <English>English content</English> <French>French content</French> First thing you need to do is create a plug-in file in the following folder /whmcs/includes/smarty/plugins/function.getlang.php and add the following code to the file <?php /* * Smarty plugin * ————————————————————- * File: function.getlang.php * Type: function * Name: XML Language Data * Purpose: Returns only the language data surrounded by language tags * ————————————————————- */ function smarty_function_getlang($params, &$smarty){ $xmldata ='<?xml version="1.0" encoding="ISO-8859-1" ?><root>'.$params['data'].'</root>'; $lang = $params['lang']; if(simplexml_load_string($xmldata)===FALSE) { return $params['data']; } else { $langxmlobj = new SimpleXMLElement($xmldata); if ($langxmlobj->$lang){ return $langxmlobj->$lang; } else { return $params['data']; } } } ?> Next for any smarty variable that outputs data entered into the admin E.g. the $product.name or $product.description tag in your orderforms you can replace it with the tag below (Note the script will output the full value if no tags are found) {getlang data=$product.name lang=$language} OR {getlang data=$product.description lang=$language} It is then just a simple job or adding the content in the admin with the correct names based on your sites language. <English>English content</English><French>French content</French If anyone finds any bugs then please post them here 0 Quote Link to comment Share on other sites More sharing options...
eug Posted December 28, 2011 Share Posted December 28, 2011 Hi! What about the new version of WHMCS 5.0.3? If your hack working with it? 0 Quote Link to comment Share on other sites More sharing options...
Kasimir61 Posted January 2, 2012 Share Posted January 2, 2012 Hi! What about the new version of WHMCS 5.0.3? If your hack working with it? Why does the Team from WHMCS do ignore this Point ?? A System what will sell as a multi lnaguage System shouldt be a multi language system. I read this Thread and see, there is no statement in all from WHMCS. So i cant tell my Clients in Bulgary, they have to learn German or English, because the Software dont want work here correct.. It was nice to have a timeline ! - In old System i add this Code 4.5.1. and it works. But each Update i begin all Changes again. So i want to work with it, not to play.. We cant change it self - it is encoded ! A good Idea was, that the Team from WHMCS decode some Parts of this, that Users here have the chance to make a correct Translation parts for all... I love WHMCS, but if it not go ahead with multi Language - then i cant use it for all my Servers in all. Kasi 0 Quote Link to comment Share on other sites More sharing options...
Gestinfo Posted January 5, 2012 Share Posted January 5, 2012 Hello Sam of Serwise ,, you it possible for you to create the files and print image of the product configuration, because I try and it works at all thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
eug Posted January 27, 2012 Share Posted January 27, 2012 Why does the Team from WHMCS do ignore this Point ??A System what will sell as a multi lnaguage System shouldt be a multi language system. I read this Thread and see, there is no statement in all from WHMCS. So i cant tell my Clients in Bulgary, they have to learn German or English, because the Software dont want work here correct.. It was nice to have a timeline ! - In old System i add this Code 4.5.1. and it works. But each Update i begin all Changes again. So i want to work with it, not to play.. We cant change it self - it is encoded ! A good Idea was, that the Team from WHMCS decode some Parts of this, that Users here have the chance to make a correct Translation parts for all... I love WHMCS, but if it not go ahead with multi Language - then i cant use it for all my Servers in all. Kasi You are absolutely right! WHMCS Team should pay attention to that problem... And this hack doesnt working with WHMCS 5.0.3. 0 Quote Link to comment Share on other sites More sharing options...
migmig Posted April 4, 2012 Share Posted April 4, 2012 It's incredible WHMCS (claiming to be multi-language) doesn't let translate the more important: the product names and descriptions!... I was going to give a try to this solution, but finally isn't it working for 5.0.3 version ? 0 Quote Link to comment Share on other sites More sharing options...
janpepu Posted June 7, 2012 Share Posted June 7, 2012 some news ? how translate product name, description ? 0 Quote Link to comment Share on other sites More sharing options...
EksoKen Posted August 26, 2012 Share Posted August 26, 2012 Is this working with version 5.1 ?? 0 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.