Making WordPress.org

Opened 9 years ago

Closed 7 years ago

#1269 closed defect (bug) (fixed)

Theme Directory - localize update date

Reported by: ramiy's profile ramiy Owned by: coffee2code's profile coffee2code
Milestone: Priority: normal
Component: Theme Directory Keywords: has-patch
Cc:

Description

The "Last updated" string in theme pages needs to be localized.

See here: https://he.wordpress.org/themes/twentyfifteen/

And in the attached screenshot.

Attachments (3)

theme-update-date.png (182.9 KB) - added by ramiy 9 years ago.
meta-1269.patch (1.1 KB) - added by SergeyBiryukov 9 years ago.
meta-1269.2.patch (1.1 KB) - added by ramiy 9 years ago.
Add wporg-themes textdomain to the _x() function

Download all attachments as: .zip

Change History (21)

#1 @ramiy
9 years ago

Related: #1270

#2 @SergeyBiryukov
9 years ago

  • Keywords has-patch added

#3 @dd32
9 years ago

FWIW the patch here only applies to the Server-generated text.

On load, and when viewing a new theme, it's replaced with the localised date according to your browser through JS.

@ramiy
9 years ago

Add wporg-themes textdomain to the _x() function

#4 @ocean90
9 years ago

@ramiy Do you have JavaScript disabled? Which browser are you using?

#5 follow-up: @ramiy
9 years ago

@ocean90,
Crome + JS enabled

#6 @ramiy
9 years ago

You are right, on firefox it's in hebrew.

#7 in reply to: ↑ 5 ; follow-up: @ocean90
9 years ago

#8 @ramiy
9 years ago

Ok, so on chrome it loads in hebrew and after a second or two the date changes to english.

#9 in reply to: ↑ 7 @ramiy
9 years ago

Replying to ocean90:

Replying to ramiy:

@ocean90,
Crome + JS enabled

https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js#L478 should take care of the dates. meta-1269.2.patch wouldn't help you…

Dominic, The patch will help me to control the date format, I need to add a coma to the date.

#10 follow-up: @ocean90
9 years ago

Again, this is a JavaScript template. That's why we let JavaScript handle the date format. Not sure why it doesn't work in your Chrome.

#11 in reply to: ↑ 10 ; follow-up: @SergeyBiryukov
9 years ago

Replying to ocean90:

Again, this is a JavaScript template. That's why we let JavaScript handle the date format. Not sure why it doesn't work in your Chrome.

It doesn't work for me either. It loads in Russian, but then changes to English, probably because my browser UI is set to English.

It does work if I switch the browser UI to Russian. I guess it's OK, but seems inconsistent with the plugin directory.

Also, when JavaScript is disabled, it's hardcoded to use the F j, Y format, which is not suitable for languages with declensions (#WP11226). "Декабрь 6, 2015" is not correct Russian, "6 декабря 2015" is. That's why we generally use d.m.Y instead of F j, Y.

Ideally, I'd like to switch to human_time_diff(), like we did for plugin directory in #1270. But I guess that would be tricky, because it involves either adding a field in that format to the API or performing an additional request. Recreating the function in JavaScript doesn't seem feasible either, because we need _n() to work.

Could we at least commit meta-1269.2.patch to benefit from [WP35517] when JS is disabled? :)

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

#12 in reply to: ↑ 11 @ramiy
9 years ago

Replying to SergeyBiryukov:

Ideally, I'd like to switch to human_time_diff(), as we did for plugin directory in #1270.

I agree, we should use human time diff everywhere!

#13 @Otto42
9 years ago

I think it's more likely that we'll eliminate human time diffs in the plugin directory, since it will eventually be an API driven page just like the theme directory is.

Unless you have a localizable JS version of human time diff handy.

#14 @ramiy
9 years ago

@Otto42, the human_time_diff() function doesn't seems like a very complicate functions.

https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/formatting.php#L2825

If needed, we can create a JS version to return the same output.

#15 @coffee2code
7 years ago

  • Owner set to coffee2code
  • Resolution set to fixed
  • Status changed from new to closed

In 5704:

Theme Directory: Allow the last updated date to be localized.

Props SergeyBiryukov, ramiy.
Fixes #1269.

#16 @ramiy
7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

It didn't helped... :-(

Reopening the ticket.

#17 @coffee2code
7 years ago

@ramiy: What do you recommend at this point? It sounds like, as Sergey noted, that your browser UI is set to English or some other language different than the site being loaded. With JS enabled, JS will reformat the date according to the browser settings, which looks to be what is intended.

#18 @obenland
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 6359:

Themes: Improve localized date display.

This will not solve it for all languages, but at least the more popular ones should see a benefit.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Using_locales
Fixes #1269.

Note: See TracTickets for help on using tickets.