Turcu Posted July 24, 2012 Share Posted July 24, 2012 Hi all, i have a question and i wanted to see if someone have some hint about it. I have a multi-language site, and i am trying to change the WHMCS (integrated inside) language, through source code. I was able to do it before, idk really how (there is not much documentation) but the problem is that stopped working. After much try, what i did before, was when someone changed the language of the website, force all in WHMCS for use these language, for example: if($idiomaActual=="es") $_SESSION["language"]="Spanish"; where $idiomaActual is my site language. What i did, was call in my "header.tpl" this functions, that check the language, setted the session variable (that is setted all the time, outside WHMCS too) and all was working fine. Then stopped working (WHMCS update was in the middle too). After much tries, i can't get it working again. I have tried setting: $_SESSION["language"] $_SESSION["Language"] (in case is case-sensitive problem) $language (defined as global) But the WHMCS doesn't change the language. Both (site and WHMCS) are in the same domain, so is not session scope problem. I was debbuging the site, and i figured that all the vars (session and local) are correctly setted after all the page loads, so is not some reset problem or similar. If someone has some hint about how to fix it, or if there is some correct way to implement this, i will be very happy . Thank you, regards! 0 Quote Link to comment Share on other sites More sharing options...
mtshahzad Posted November 6, 2012 Share Posted November 6, 2012 Hello! I am somewhat in the same situation, trying to set a language from php code outside the whmcs, but no luck yet. When i update the "language" session variable .. it only affects the languages dropdown but contents are not translated. You got solution for your problem or not. If yes, please share. Regards MT Shahzad http://www.mtshahzad.com 0 Quote Link to comment Share on other sites More sharing options...
Turcu Posted November 6, 2012 Author Share Posted November 6, 2012 Hello, I didn't find some correct solution at all. I made if can be helpful for you, a homemade solution that works at least a little. In every language file (in the lang directory), before set the array of language, i ask if these file is the same than the language i have setted. If is not, I don't let continue the script in these file, and i include the right one. Was the most advanced that came to my mind. Regards! 0 Quote Link to comment Share on other sites More sharing options...
bitmng Posted December 12, 2012 Share Posted December 12, 2012 Hi guys, what i realized until now is that if you have in /lang the files named English.php and english.php, than is changing properly the language .... If you have just English.php, whmcs get error ... and if you leave just english.php the languages are not changing at all ... Personally idk, still, how to fix this issue ... but any hint on how to fix it temporarly will be welcome ... Turcu i don't understand how you setted it up your fixing ... 0 Quote Link to comment Share on other sites More sharing options...
Turcu Posted December 12, 2012 Author Share Posted December 12, 2012 Turcu i don't understand how you setted it up your fixing ... Hi bitmng, basically what i did, was add in each language file (php file) at the end of the file, the following: if($_SESSION['Language']!="english"){ include(dirname(__FILE__).'/'.$_SESSION['Language'].'.php'); } Where: $_SESSION['Language'] is the language i have seted with the language i want, but whmcs is not using and "english" is the language of the current language file (ex. english.php) where i added the code... "spanish" for spanish.php, and all like this. In this way, this overwrites the $_LANG var with the right language. Regards. 0 Quote Link to comment Share on other sites More sharing options...
keneso Posted December 12, 2012 Share Posted December 12, 2012 Thank you Turcu, it seems to have solved my problem as well http://forum.whmcs.com/showthread.php?65370-language-reverts-back-when-changing-page 0 Quote Link to comment Share on other sites More sharing options...
bitmng Posted December 12, 2012 Share Posted December 12, 2012 great Turcu thanks a lot 0 Quote Link to comment Share on other sites More sharing options...
cloferba Posted December 13, 2012 Share Posted December 13, 2012 Hi bitmng, basically what i did, was add in each language file (php file) at the end of the file, the following: if($_SESSION['Language']!="english"){ include(dirname(__FILE__).'/'.$_SESSION['Language'].'.php'); } Where: $_SESSION['Language'] is the language i have seted with the language i want, but whmcs is not using and "english" is the language of the current language file (ex. english.php) where i added the code... "spanish" for spanish.php, and all like this. In this way, this overwrites the $_LANG var with the right language. Regards. sorry I don´t understand. Could you please provide an example? 0 Quote Link to comment Share on other sites More sharing options...
keneso Posted December 13, 2012 Share Posted December 13, 2012 sorry I don´t understand. Could you please provide an example? In the folder lang open the file english.php and go to the end of it - line 1366 of original file now add a new line and paste the code given by Turcu Next open the other language files, i.e. italian.php do the same, but this time change english to italian this is for the english.php file if($_SESSION['Language']!="english"){ include(dirname(__FILE__).'/'.$_SESSION['Language'].'.php'); } this is for italian.php file if($_SESSION['Language']!="italian"){ include(dirname(__FILE__).'/'.$_SESSION['Language'].'.php'); } this is for french.php file if($_SESSION['Language']!="french"){ include(dirname(__FILE__).'/'.$_SESSION['Language'].'.php'); } And so on. 0 Quote Link to comment Share on other sites More sharing options...
bitmng Posted December 13, 2012 Share Posted December 13, 2012 http://forum.whmcs.com/newreply.php?p=284802&noquote=1 Hi guys, i spoke with the WHMCS support ... it does work again to me, with this file (overwriting the existing one..) : http://www.bitmng.com/dbconnect.zip My dbconnect file was dated 3/12, so means that during the last patch has been modified with some code that letted go in error the language function ... Now that i overwrote the file, is working fine again Let me know if is going to solve the issue 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.