Jump to content

Language override doesn't work


Sanora Dev

Recommended Posts

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?

 

date in englsh not dutch.png

translated text.png

Link to comment
Share on other sites

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>

9SpKvQ3.png

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 by brian!
Link to comment
Share on other sites

  • 3 weeks later...

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??

 

Dutch dates whmcs.png

th - nd symbol overide dutch whmcs.png

Link to comment
Share on other sites

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'] = " ";

GHgRchA.png

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...

bVz5EM1.png

though I suppose in your case, that's only English & Spanish.

Link to comment
Share on other sites

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>
Link to comment
Share on other sites

  • 1 year later...
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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...

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