WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#33579 closed defect (bug) (invalid)

want to change the $monthtext in touch_time(/wp-admin/includes/template.php)

Reported by: tmatsuur Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Date/Time Keywords:
Focuses: Cc:
PR Number:

Description

There is a problem with the editing of existing posts ( and comments ) date.

Japanese post here:
https://ja.forums.wordpress.org/topic/153017?replies=3

function touch_time(template.php line787-788)

$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';

post.js(post.min.js)

postL10n.dateFormat
	.replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) )

for example the Japanese of today:

$monthtext = '8月';
postL10n.dateFormat = '%3$s年%1$s月%2$s日 @ %4$s:%5$s';

// replaced text
'2015年8月月28日 @ 10:50'

In this way '月' has ended up overlapping.
The same thing might have occurred in other languages.

get_month_abbrev method has also been used in such calendar display.
I feel the need for a new method.

Change History (4)

#1 @SergeyBiryukov
4 years ago

This sounds like a translation issue, the date format string probably should not have '月' there if the month name already contains it.

#2 @tmatsuur
4 years ago

The date format string has been used in various places. It will not be able to solve if simply changing the date format string.

Problem is I think not the point.

It has been modified to use the data-text attribute in version 4.3.
And, the content of this data-text attribute is the abbreviation of the month.

In versions prior to 4.3, post.js(post.min.js) was using the contents of the option element.

sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) )

In the case of Japanese environment, '%1$s-%2$s' will be translated '%1$s'. As a result, it becomes '08' in the case of August.
It is important that it has been changed to the abbreviation of the month from a number.

It came up now:
function touch_time(template.php line788)

$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . sprintf( _x( '%2$s', 'data-text' ), $monthnum, $monthtext ) . '" ' . selected( $monthnum, $mm, false ) . '>';

And using the translation in the case of Japanese select the '%1$s'.

How about this.

Last edited 4 years ago by tmatsuur (previous) (diff)

#3 @tenpura
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

We have solved this by changing the date format string.

#4 @netweb
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.