Jump to content

Translate date format


criat

Recommended Posts

My date format is 1st/Oct/2013

 

I would like to translate this date to the language of the visitor, like in portuguese: 01/Out/2013

 

-- OR --

 

Use normal date for everyone (d/m/Y) = 01/11/2013, but if user select English Language, it changes to

1st/Oct/2013

 

I've came up with half the code, but I don't know how to complete it

 

if($_SESSION['Language']=="english"){
   //Insert Magic Here    
} 

 

Wich is better in your oppion, and any ideas on how to do it?

Thanks

Link to comment
Share on other sites

I would probably forget the second option - coding wise it could be a real pain to do, nor does it take into account our American cousins who like to have the month before the date!

 

the first option is more doable - but if you want it to work for all languages, then you are going to have to make a change to every template where a date is specified.. that could be a *lot* of changes as every edit would possibly have to include upto twelve translations for *each* language !! :twisted:

 

then you'd probably have to follow it through so that it was consistent on the emails and pdf invoices.

 

if you really want to do it, I can tell you one possible solution as i'm currently working on a user contribution for making the product descriptions multilingual and so i'm familiar with translations... but as currently designed, WHMCS is not really multilingual and there is a limit to how much it can be modified to be so.

 

you might be better off just sticking with one date format for everyone... but let me know if you *really* want to do this!

Link to comment
Share on other sites

I feel like i've opened Pandora's box with this multilingual project! :lol:

 

I see. What about the ticket departments, can I translate them according to language?

Yes... this is edited in the template theme rather than the order form, but the principle is the same... so you can translate ticket departments, knowledge base headings, their descriptions etc... I just found that WHMCS can have multilingual knowledge base articles, but it doesn't make the headings multilingual as an option! :roll:

 

to return to the date issue, I was wrong when I said you'd need twelve translations for each language - the solution is simpler than that, but you'd still need to modify each date call in the code... i'll add it to the project.

 

we use long dates (January, February etc) on our installation, and it only occurred to me when trying to look at the client area as non-English eyes, that there are important parts that are not translated - months being one.

the translation method is easy, the time-consuming bit would be changing the template files for every mention of a date.

Link to comment
Share on other sites

when you say your site format is "1st/Oct/2013", how is it currently being displayed in the client area ?

 

01/10/2013 or 1st Oct 2013

 

or to put it another way, what are your "Date Format" and "Client Date Format" settings in Setup -> General Settings -> Localisation ??

 

i've got this working so that it will translate month names, days of the week - next to do are the ordinal numbers (1st, 2nd, 3rd etc).

 

what you want is easy enough to do, but I need to know your date format settings so that I can try it here.

Link to comment
Share on other sites

  • 3 months later...
3 months later, I still don't know the answer to this question

Can I change WHMCS to use d/m/Y? (03/03/2014 instead of 3rd/Mar/2014)

There's no such option in Localisation tab

the answer to whether this can be done is yes... I thought I replied about this in another thread last year :?:

 

there are a number of ways to do it - a long-winded method that will always work, a quicker solution that should and another that lets the client define their own date format! :)

 

unfortunately, I'm not going into detail about any of the solutions here at this stage - it's possibly the second best solution I've written for WHMCS and I'm reluctant to give it away for free... I give too much away for nothing as it is and the line has to be drawn somewhere - I do need to earn an income you know!

 

these are solutions that I would wish to commercialise and describing it here, even in vague terms, might prevent that - so I either need to sell this as a module (not imminent) or charge for converting existing sites to use the new code.

 

feel free to PM if you want to discuss it further.

Link to comment
Share on other sites

  • 8 months later...
I would like to to mod a whmcs 5.3.10 to multilingual setup french/english, I do not bother paying.

as you are already aware, Kian is writing a module that will provide multilingual options for the current version of whmcs.

 

http://forum.whmcs.com/showthread.php?94915-multilingual-product-description

 

if that addon doesn't meet your needs, or your issue is more about date formats than multilingual, then feel free to PM me.

Link to comment
Share on other sites

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