#1540 closed defect (bug) (fixed)
Date format returned by wp_get_archives is not localizable
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.0.6 | Priority: | lowest |
Severity: | normal | Version: | 1.5.1.2 |
Component: | Template | Keywords: | bg|needs-patch bg|2nd-opinion has-patch |
Focuses: | Cc: |
Description
When using wp_get_archives('type=monthly'), the date string format in the links is hard coded as "month year" not localizable.
Attachments (2)
Change History (13)
#1
@
20 years ago
- Keywords bg|needs-patch bg|2nd-opinion added
- Milestone set to 1.6
- Owner changed from anonymous to skippy
- Status changed from new to assigned
#2
@
20 years ago
We could easily fetch also the unix timestamp of a post in that month from the database and then form the string using the date_i18n function with an internationalized date format:
$text = date_i18n(_('F Y'), $arcresult->post_date);
However, in this situation we could run into some problems. The string marked for internaliozation is 'F Y' (which means: monthname year). For example I want to translate it as '\a\r\c\h\i\v\e \f\o\r\: Y F', but somewhere in Wordpress the same combination 'F Y' is used and it is again internationalized. If the second occurence of 'F Y' is in other context (far apart from archives) then our translation will be totally inadequate.
Actually, using the same string in many contexts is far more general gettext issue and maybe is its greatest flaw...
#4
@
20 years ago
May I suggest that an additional month date format option to be added in the admin? This will avoid the ambiguity and allow user full control over the format.
Also, I would argue this is a high priority bug since it's the default format of the archive listing and every blog in a language with different date/time format will show it WRONG.
#5
@
19 years ago
Is there any solution of this?
This ticket must fixed quickly for non latin1 user(for example China & Japan & Korean)
I Think below solution is very good solution.
$text = date_i18n(_('F Y'), $arcresult->post_date);
#6
@
19 years ago
second option
$text = sprintf(_('%1$s %2$d'), $month[zeroise($arcresult->month,2)], $arcresult->year);
I think that best solution using smallest edit.
patch attached.
lines 306 and 309 of wp-includes/template-functions-general.php:
I don't see a clean way to use the blog's preferred date format; maybe someone else will.