Opened 2 years ago

Closed 19 months ago

#16441 closed enhancement (fixed)

TwentyTen localization improvement

Reported by: settle Owned by: ryan
Priority: normal Milestone: 3.3
Component: Bundled Theme Version: 3.1
Severity: trivial Keywords: has-patch
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 2 years ago.
archive.diff (878 bytes) - added by settle 2 years ago.
My suggestion. Works fine in my localhost.
16441.patch (2.0 KB) - added by SergeyBiryukov 20 months ago.
16441.2.patch (2.2 KB) - added by SergeyBiryukov 20 months ago.

Download all attachments as: .zip

Change History (16)

  • 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.

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 2 years ago by settle (previous) (diff)
  • 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: ↓ 5   settle2 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   solarissmoke2 years ago

Why should TwentyTen be different than whole WP?

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

  • Keywords dev-feedback removed

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

  • Keywords has-patch added

settle2 years ago

My suggestion. Works fine in my localhost.

  • Component changed from Themes to Bundled Theme
  • 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.

These should probably have a translator comment or context.

  • 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.