Community Forums

email date format

Enter all OpenCart 0.x bugs here

email date format

Postby Pix » Mon Dec 15, 2008 11:45 am

so my first question is about date formats. I'm using opencart with the italian language installed and i've noticed that admin homepage  and confermation emails show order date like this:

15 December 2008

even if my language is setted to "italian".

So my first question is: is that correct? i mean opencart is supposed to show the month's name always in english or is supposed to show it in the selected language?

My guess is yes, it's correct in english, but would be nice a confirmation...

So assuming i'm right so far i was trying to play around with the email date format beacause recieving the email confirmation with some part in english and other in italian was kinda annoying.

in catalog/controller/checkout_confirm.php on line 214 i found this
Code: Select all
$email->set('email_date', $language->get('email_date', date($language->get('date_format_short'))));

and just two line below
Code: Select all
$email->set('email_date', $language->get('email_date', date($language->get('date_format_long'))));


is that correct? why email_date is setted first as short format and then as long format? it doesnt make sense to me...  ???

i'm using 0.7.9 RC5 
Pix
 
Posts: 10
Joined: Mon Oct 27, 2008 11:29 am

Re: email date format

Postby Qphoria » Mon Dec 15, 2008 11:55 am

A language is only as good as the one who ported it from english.

In the main catalog/language/english/english.php file:

The top section shows:
Code: Select all
// Locale
$_['code']                  = 'en';
$_['charset']               = 'utf-8';
$_['direction']             = 'ltr';
$_['locale']                = 'en_US.UTF-8,en_US,english';
[color=red]$_['date_format_short']     = 'j F Y';
$_['date_format_long']      = 'l dS F Y';[/color]
$_['time_format']           = 'h:i:s A';
$_['decimal_point']         = '.';
$_['thousand_point']        = ',';

// Text
$_['text_time']             = 'Page created in %s seconds';
$_['text_yes']              = 'Yes';
$_['text_no']               = 'No';
$_['text_none']             = ' --- None --- ';
$_['text_all_zones']        = 'All Zones';
$_['text_results']          = 'Results %s - %s of %s';
$_['text_pages']            = '%s of %s';
$_['text_separator']        = ' » ';
$_['text_january']          = 'January';
$_['text_february']         = 'February';
$_['text_march']            = 'March';
$_['text_april']            = 'April';
$_['text_may']              = 'May';
$_['text_june']             = 'June';
$_['text_july']             = 'July';
$_['text_august']           = 'August';
$_['text_september']        = 'September';
$_['text_october']          = 'October';
$_['text_november']         = 'November';
$_['text_december']         = [color=red]'December';[/color]


So if your catalog/language/italian/italian.php file has those same settings then the language file needs an update.

However, if the language file is correct, but you are still seeing the english version. Then it is a bug.
User avatar
Qphoria
Administrator
 
Posts: 19201
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: email date format

Postby Pix » Mon Dec 15, 2008 12:11 pm

$_data_format_long and $_date_format_short are the same
Code: Select all
// Locale
$_['code']                  = 'it';
$_['charset']               = 'utf-8';
$_['direction']             = 'ltr';
$_['locale']                = 'it_IT.UTF-8,it_IT,italian';
[color=red]$_['date_format_short']     = 'j F Y';
$_['date_format_long']      = 'l dS F Y';[/color]
$_['time_format']           = 'h:i:s A';
$_['decimal_point']         = '.';
$_['thousand_point']        = ',';


and each month is correctly translated
Code: Select all
$_['text_december']         = 'Dicembre';


i see correctly translated month only when i create a new object, but not inside the last order box in admin hompage, neither inside my account order history.
Pix
 
Posts: 10
Joined: Mon Oct 27, 2008 11:29 am

Re: email date format

Postby Qphoria » Mon Dec 15, 2008 12:22 pm

Admin has a separate language file
Does the admin/language/italian/italian.php file have December or Dicembre?
User avatar
Qphoria
Administrator
 
Posts: 19201
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: email date format

Postby Pix » Mon Dec 15, 2008 12:26 pm

translation correct in admin/language/italian/italian.php too


i'm still thinking the two things are not related. I mean the months translation and the format date. in fact there is nothing like a "day name" translation, for the long format date, that shows also the name of the day...
Last edited by Pix on Mon Dec 15, 2008 12:32 pm, edited 1 time in total.
Pix
 
Posts: 10
Joined: Mon Oct 27, 2008 11:29 am

Re: email date format

Postby Qphoria » Mon Dec 15, 2008 1:24 pm

well I'm not sure which issue you are referring to.

If you are in Italian mode and you are seeing "12 December 2008" then that is a language bug that isn't pulling from the correct file.

I'm not quite sure I understand your question about long date vs short date
User avatar
Qphoria
Administrator
 
Posts: 19201
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: email date format

Postby hm2k » Mon Dec 15, 2008 1:45 pm

I had this issue in another multi language supported project.

Fortunately I have a solution!

I created a function called format_time() which handles both strftime() formats and regular date() formats...

With strftime() month and weekday names and other language dependent strings respect the current locale set with setlocale().

For retrospect the format_time() function handles both date() and strftime() formatting.

Code: Select all
function format_time ($format,$time=false) {
   
   if (preg_match('/%/',$format)) {
      if ($time) { return strftime($format,$time); }
      else { return strftime($format); }
   }
   if ($time) { return date($format,$time); }
   else { return date($format); }
}


I just need to impliment it into the system.
UK Web Hosting
And Gadgets - LIVE and OpenCart powered!

Have we helped you? please donate
User avatar
hm2k
Global Moderator
 
Posts: 583
Joined: Mon Mar 10, 2008 8:06 pm
Location: UK

Re: email date format

Postby Pix » Mon Dec 15, 2008 1:56 pm

ok i'll try to explain better

First issue:
i'm using the italian language. When i place an order, i recieve an email showing the order date in english. but only the date. The email is like this
Code: Select all
[color=blue]ID Ordine[/color]: #49456-E6D82-04213
[color=blue]Data ordine[/color]: [color=red]Monday 15th December 2008[/color]
[color=blue]Fattura[/color]: http://192.168....whatever


as you can see the blue part is correctly translated, the red part no.

and i find the same issue when i check the "order history" and inside the admin hompage order box. the date is always in english.

what i was trying to say before is that i think there is no connection between the date and the language file. Beacuse if they were connected, the language file should have a "section" dedicate to the Day's name translations too i guess, that would be used when a long format date is shown.
Instead the language file only have traslation about months, and that translation are used only when you create a new product and you set the "date avaiable" part.

so i'm saying that showing the date always in english is wrong,expecially if you are using another language, and it's not related to the tranlation file...

i hope is better this time
Pix
 
Posts: 10
Joined: Mon Oct 27, 2008 11:29 am

Re: email date format

Postby hm2k » Mon Dec 15, 2008 2:00 pm

It's definitely a bug, i've seen it before as I said, I'll move this to the bugs section and follow it up shortly.
UK Web Hosting
And Gadgets - LIVE and OpenCart powered!

Have we helped you? please donate
User avatar
hm2k
Global Moderator
 
Posts: 583
Joined: Mon Mar 10, 2008 8:06 pm
Location: UK

Re: email date format

Postby hm2k » Tue Dec 16, 2008 7:33 am

I followed up this bug across two revisions:

http://code.google.com/p/open-cart/source/detail?r=257
http://code.google.com/p/open-cart/source/detail?r=258

At this moment in time it's untested, so there may be new issues when you come to use it.

To make use of the new formatDate() function you will need to update the dates (date_format_short and date_format_long) in your language files to support the strftime format.

Further bugs should be reported according to this post:
http://forum.opencart.com/index.php/topic,1466.0.html

Thank you!
UK Web Hosting
And Gadgets - LIVE and OpenCart powered!

Have we helped you? please donate
User avatar
hm2k
Global Moderator
 
Posts: 583
Joined: Mon Mar 10, 2008 8:06 pm
Location: UK

Re: email date format

Postby hm2k » Tue Dec 16, 2008 7:37 am

Oh, I also fixed the duplicate "email_date" entry in "catalog/controller/checkout_confirm.php" via r259.
UK Web Hosting
And Gadgets - LIVE and OpenCart powered!

Have we helped you? please donate
User avatar
hm2k
Global Moderator
 
Posts: 583
Joined: Mon Mar 10, 2008 8:06 pm
Location: UK


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

Hosted by Arvixe Web Hosting