yrochon Posted June 28, 2011 Share Posted June 28, 2011 We have WHMCS set up to be multilingual; french and english. However, even if the client area display in french, the date shows in english, which is does not look professional. Is there any way to resolve this? For example : Bienvenue, user4029247. Aujourd'hui, le Tuesday, 28th June 2011 should be (something like) Bienvenue, user4029247. Aujourd'hui, mardi le 28 juin 2011 0 Quote Link to comment Share on other sites More sharing options...
yrochon Posted June 28, 2011 Author Share Posted June 28, 2011 Here is a dirty solution. something more elegant would be preferable, but it will do for now. 1. Change translations like so : # French.txt $_LANG["todayis"] = "Aujourd'hui, %s le %s"; # English.txt $_LANG["todayis"] = "Today is %s, %s"; 2. in the template file (ie. clientareahome.tpl) where today's date needs to be output {php} $lang = $this->get_template_vars('LANG'); if ($this->get_template_vars('language') == 'French') { setlocale(LC_ALL, 'fr_FR'); $this->assign('todayis', sprintf($lang['todayis'], strftime("%A"), strftime("%e %B %Y"))); } else { setlocale(LC_ALL, 'en_GB'); $this->assign('todayis', sprintf($lang['todayis'], strftime("%A"), date("jS F Y"))); } {/php} 3. use the variable {$todayis} 0 Quote Link to comment Share on other sites More sharing options...
yrochon Posted July 15, 2011 Author Share Posted July 15, 2011 Actually, step 2 should have been {php} $lang = $this->get_template_vars('LANG'); if ($this->get_template_vars('language') == 'French') { setlocale(LC_ALL, 'fr_FR'); $this->assign('todayis', sprintf($lang['todayis'], strftime("%A"), strftime("%e %B %Y"))); } else { setlocale(LC_ALL, 'en_GB'); $this->assign('todayis', sprintf($lang['todayis'], strftime("%A"), date("F j Y"))); } {/php} 0 Quote Link to comment Share on other sites More sharing options...
Anders Posted July 16, 2011 Share Posted July 16, 2011 fantastic thx, but i am using swedish lang and is not showing the special characters the "setlocale" any ideas why becuse the rest of my site shows swedsih characters? warm regards Anders 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.