WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#16441 closed enhancement (fixed)

TwentyTen localization improvement

Reported by: settle Owned by: ryan
Milestone: 3.3 Priority: normal
Severity: trivial Version: 3.1
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

archive.php

<?php if ( is_day() ) : ?>
				<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?>
				<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date( 'F Y' ) ); ?>
<?php elseif ( is_year() ) : ?>
				<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date( 'Y' ) ); ?>
<?php else : ?>
				<?php _e( 'Blog Archives', 'twentyten' ); ?>
<?php endif; ?>

Please, make the string ( 'F Y' ) translatable. For example, in lithuanian we use ( 'Y F' ). So we currently have to manually edit archive.php.

And I think that day archive format and year archive format should also be translatable, just in case. Maybe it should look different in some languages.

Attachments (4)

16441.diff (783 bytes) - added by solarissmoke 4 years ago.
archive.diff (878 bytes) - added by settle 4 years ago.
My suggestion. Works fine in my localhost.
16441.patch (2.0 KB) - added by SergeyBiryukov 4 years ago.
16441.2.patch (2.2 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 @solarissmoke4 years ago

  • Keywords close added; TwentyTen removed

It is translatable - get_the_date() uses date_i18n() which handles translation of date formats. You should be able to hook into the 'date_i18n' filter to modify this.

comment:2 @settle4 years ago

Yes, get_the_date() is translatable, but get_the_date( 'F Y' ) is static and not included in TwentyTen.pot
I am not able to choose between F Y and Y F.

In other themes I can find something like this:

printf( __('Archive for %1$s', 'inove'), get_the_time(__('F jS, Y', 'inove')) );

Now, date expression is included in theme translation file.

p.s. I am only translating, I have no knowledge in coding, so hooking and other words say nothing to me, sorry. I am only asking to use

get_the_time(__('F Y', 'twentyten'))

instead of

get_the_date( 'F Y' )
Last edited 4 years ago by settle (previous) (diff)

comment:3 @solarissmoke4 years ago

  • Keywords dev-feedback added; close removed

The problem is that 'F Y' is not an English language string, but a PHP date format specifier. I'm fairly certain that hooking into date_i18n is the proper way to handle this, but lets see what the senior devs say.

comment:4 follow-up: @settle4 years ago

Yes, it is not an English string, but everywhere in WP it is translatable string.

For example: /wp-includes/theme-compat/sidebar.php:35

			<p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for the day %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time(__('l, F jS, Y'))); ?></p>

Why should TwentyTen be different than whole WP?

comment:5 in reply to: ↑ 4 @solarissmoke4 years ago

Why should TwentyTen be different than whole WP?

It shouldn't, looks like I'm wrong..

comment:6 @nacin4 years ago

  • Keywords dev-feedback removed

We're occasionally inconsistent in core, but having $date_format translated is proper.

comment:7 @solarissmoke4 years ago

  • Keywords has-patch added

@solarissmoke4 years ago

@settle4 years ago

My suggestion. Works fine in my localhost.

comment:8 @dd324 years ago

  • Component changed from Themes to Bundled Theme

@SergeyBiryukov4 years ago

comment:9 @SergeyBiryukov4 years ago

  • Milestone changed from Awaiting Review to 3.3

16441.patch makes the requested strings translatable in Twenty Eleven as well.

In Kubrick, they were translatable too.

comment:10 @nacin4 years ago

These should probably have a translator comment or context.

@SergeyBiryukov4 years ago

comment:12 @ryan4 years ago

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

In [19241]:

Make date formats for transation. Props SergeyBiryukov, settle. fixes #16441

Note: See TracTickets for help on using tickets.