Sanora Dev Posted September 24, 2019 Share Posted September 24, 2019 Hello everyone, I've been translating some text from english to dutch and everything i've translated works, accept the translation of the date in the client area. As an example, i changed "monday" to "maandag" or the month "march" to "maart", and the client sees everything in dutch accept the date. I've used the same file and method to translate the date and every other translation works. Are there any other setting(s) i need to modify or change before the date get translated? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 24, 2019 Share Posted September 24, 2019 (edited) 3 hours ago, Devias said: Are there any other setting(s) i need to modify or change before the date get translated? isn't this a long-standing issue that has always been like this ? that's no excuse for WHMCS not fixing it though. for example, dates on the announcement pages are translated to other languages (including the sidebar - but I showed them how to do that one!)... yet in the homepage panel that shows announcements (Recent News), those dates are in English... same goes for the support tickets panel and of course all the dates in the dataTables output (e.g Products/Domains/Invoices etc) are in English. there's something in the back of my mind about WHMCS not obeying SetLocale setting in PHP, but that doesn't help you. so two solutions - everywhere you see a date like this, you could either use a hook to fix it (either pulling date from db and outputting it in current language, or a simple string & replace).... or you could do a string & replace in the template... hooking would be the better solution, and once one has been written for one table, it should be pretty much copy & paste for the other tables... a quick fix using Smarty in the template would be, and i'm using clientareaproducts.tpl as an example.. <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate}</td> changes to... <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate|replace:'Monday':{lang key='dateTime.monday'}|replace:'Tuesday':{lang key='dateTime.tuesday'}|replace:'Wednesday':{lang key='dateTime.wednesday'}|replace:'Thursday':{lang key='dateTime.thursday'}|replace:'Friday':{lang key='dateTime.friday'}|replace:'Saturday':{lang key='dateTime.saturday'}|replace:'Sunday':{lang key='dateTime.sunday'}|replace:'January':{lang key='dateTime.january'}|replace:'February':{lang key='dateTime.february'}|replace:'March':{lang key='dateTime.march'}|replace:'April':{lang key='dateTime.april'}|replace:'May':{lang key='dateTime.may'}|replace:'June':{lang key='dateTime.june'}|replace:'July':{lang key='dateTime.july'}|replace:'August':{lang key='dateTime.august'}|replace:'September':{lang key='dateTime.september'}|replace:'October':{lang key='dateTime.october'}|replace:'November':{lang key='dateTime.november'}|replace:'December':{lang key='dateTime.december'}}</td> in your case, you might not need Monday->Sunday translations in that replace if you aren't using them with your date format.... but it should translate the dates to all languages (assuming the translations in the files are non-English!).. i'm not sure how ordinal dates (1st, 2nd, 10th etc) are handled in Dutch, but they can be removed in the overrides if necessary. one day, i'll take a look at fixing the dates with a hook - but it shouldn't really be for users to fix this sort of long-standing issue with WHMCS. 🙄 Edited September 24, 2019 by brian! 0 Quote Link to comment Share on other sites More sharing options...
Sanora Dev Posted October 10, 2019 Author Share Posted October 10, 2019 Hello Brian, Sorry for my late response, I've been sick and after i was feeling better it was very busy on work, but i did follow up on your solution and it worked. I've put the code in the clientareadomains.tpl to display domain dates in dutch and it worked. I did the same in the clientareainvoices.tpl to display invoice dates in dutch. So if anyone else is having the same problem, you got to put the code in every .tpl file where date(s) are showing. Put this code after {...... .nextduedate} without the last accolade symbol |replace:'Monday':{lang key='dateTime.monday'}|replace:'Tuesday':{lang key='dateTime.tuesday'}|replace:'Wednesday':{lang key='dateTime.wednesday'}|replace:'Thursday':{lang key='dateTime.thursday'}|replace:'Friday':{lang key='dateTime.friday'}|replace:'Saturday':{lang key='dateTime.saturday'}|replace:'Sunday':{lang key='dateTime.sunday'}|replace:'January':{lang key='dateTime.january'}|replace:'February':{lang key='dateTime.february'}|replace:'March':{lang key='dateTime.march'}|replace:'April':{lang key='dateTime.april'}|replace:'May':{lang key='dateTime.may'}|replace:'June':{lang key='dateTime.june'}|replace:'July':{lang key='dateTime.july'}|replace:'August':{lang key='dateTime.august'}|replace:'September':{lang key='dateTime.september'}|replace:'October':{lang key='dateTime.october'}|replace:'November':{lang key='dateTime.november'}|replace:'December':{lang key='dateTime.december'}}</td> Thanks again Brian for helping out. The only thing I didn't succeed is to not show the th and nd text. I removed the nd - th - rd in the override, but it's still displaying. I only removed the text, but kept the qoutes in both the original file as in the dutch override file. May'be i'm doing something here?? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 10, 2019 Share Posted October 10, 2019 27 minutes ago, Devias said: The only thing I didn't succeed is to not show the th and nd text. I removed the nd - th - rd in the override, but it's still displaying. I only removed the text, but kept the qoutes in both the original file as in the dutch override file. May'be i'm doing something here?? did you alter the Smarty line of code to replace them ? it should work, though you'd have to be vary careful as a replace would change the 'st' in augustus too... so therefore, the workaround for this would be to include the space in the search string... <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate|replace:'Monday':{lang key='dateTime.monday'}|replace:'Tuesday':{lang key='dateTime.tuesday'}|replace:'Wednesday':{lang key='dateTime.wednesday'}|replace:'Thursday':{lang key='dateTime.thursday'}|replace:'Friday':{lang key='dateTime.friday'}|replace:'Saturday':{lang key='dateTime.saturday'}|replace:'Sunday':{lang key='dateTime.sunday'}|replace:'January':{lang key='dateTime.january'}|replace:'February':{lang key='dateTime.february'}|replace:'March':{lang key='dateTime.march'}|replace:'April':{lang key='dateTime.april'}|replace:'May':{lang key='dateTime.may'}|replace:'June':{lang key='dateTime.june'}|replace:'July':{lang key='dateTime.july'}|replace:'August':{lang key='dateTime.august'}|replace:'September':{lang key='dateTime.september'}|replace:'October':{lang key='dateTime.october'}|replace:'November':{lang key='dateTime.november'}|replace:'December':{lang key='dateTime.december'}|replace:'nd ':{lang key='dateTime.nd'}|replace:'rd ':{lang key='dateTime.rd'}|replace:'st ':{lang key='dateTime.st'}|replace:'th ':{lang key='dateTime.th'}}</td> $_LANG['dateTime']['th'] = " "; $_LANG['dateTime']['nd'] = " "; $_LANG['dateTime']['rd'] = " "; $_LANG['dateTime']['st'] = " "; the downside is that then causes an issue in the other languages.. and so you'd have to add an additional space to those four strings in non-Dutch languages... though I suppose in your case, that's only English & Spanish. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 10, 2019 Share Posted October 10, 2019 or maybe just add the space in the code for all languages.. 🙂 <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate|replace:'Monday':{lang key='dateTime.monday'}|replace:'Tuesday':{lang key='dateTime.tuesday'}|replace:'Wednesday':{lang key='dateTime.wednesday'}|replace:'Thursday':{lang key='dateTime.thursday'}|replace:'Friday':{lang key='dateTime.friday'}|replace:'Saturday':{lang key='dateTime.saturday'}|replace:'Sunday':{lang key='dateTime.sunday'}|replace:'January':{lang key='dateTime.january'}|replace:'February':{lang key='dateTime.february'}|replace:'March':{lang key='dateTime.march'}|replace:'April':{lang key='dateTime.april'}|replace:'May':{lang key='dateTime.may'}|replace:'June':{lang key='dateTime.june'}|replace:'July':{lang key='dateTime.july'}|replace:'August':{lang key='dateTime.august'}|replace:'September':{lang key='dateTime.september'}|replace:'October':{lang key='dateTime.october'}|replace:'November':{lang key='dateTime.november'}|replace:'December':{lang key='dateTime.december'}|replace:'nd ':' '|replace:'rd ':' '|replace:'st ':' '|replace:'th ':' '}</td> 1 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 21, 2021 Share Posted January 21, 2021 wow, looks like this problem is still here with WHMCS 8.1 ...dear 0 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 21, 2021 Share Posted January 21, 2021 On 10/10/2019 at 3:56 PM, brian! said: or maybe just add the space in the code for all languages.. 🙂 <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate|replace:'Monday':{lang key='dateTime.monday'}|replace:'Tuesday':{lang key='dateTime.tuesday'}|replace:'Wednesday':{lang key='dateTime.wednesday'}|replace:'Thursday':{lang key='dateTime.thursday'}|replace:'Friday':{lang key='dateTime.friday'}|replace:'Saturday':{lang key='dateTime.saturday'}|replace:'Sunday':{lang key='dateTime.sunday'}|replace:'January':{lang key='dateTime.january'}|replace:'February':{lang key='dateTime.february'}|replace:'March':{lang key='dateTime.march'}|replace:'April':{lang key='dateTime.april'}|replace:'May':{lang key='dateTime.may'}|replace:'June':{lang key='dateTime.june'}|replace:'July':{lang key='dateTime.july'}|replace:'August':{lang key='dateTime.august'}|replace:'September':{lang key='dateTime.september'}|replace:'October':{lang key='dateTime.october'}|replace:'November':{lang key='dateTime.november'}|replace:'December':{lang key='dateTime.december'}|replace:'nd ':' '|replace:'rd ':' '|replace:'st ':' '|replace:'th ':' '}</td> Again! Brian I used your method to resolve this issue! However if you go to hosting plan details , url is like lientarea.php?action=productdetails&id=4082 , it still shows English, do you happen to know where to edit please? many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 22, 2021 Share Posted January 22, 2021 19 hours ago, hoya8 said: However if you go to hosting plan details , url is like lientarea.php?action=productdetails&id=4082 , it still shows English, do you happen to know where to edit please? the clue is in the url - it sounds like clientareaproductdetails.tpl 🙂 it the page uses a module template (e.g cpanel), then you might need to edit (well duplicate and edit) the relevant module template too. 1 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 22, 2021 Share Posted January 22, 2021 yes I was trying to figure out cpanel one just to share here, it is /modules/servers/cpanel/templates/summary.tpl thanks again Brian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 23, 2021 Share Posted January 23, 2021 15 hours ago, hoya8 said: just to share here, it is /modules/servers/cpanel/templates/summary.tpl you mean overview.tpl surely ? https://docs.whmcs.com/Working_with_Module_Templates always remember that if you edit the file directly, changes will get overwritten during an update - copying it to your active template folder, and making changes tot he copy, should prevent that issue. 0 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 23, 2021 Share Posted January 23, 2021 my bad, yes, it should be overview.tpl that path was provided at whmcs ticket by whmcs support but I did then realize it was overview.tpl 0 Quote Link to comment Share on other sites More sharing options...
Equisite Posted June 7, 2021 Share Posted June 7, 2021 does anyone have an idea how I can apply this to the automation emails that are sent such as a generated invoice 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.