Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#24681 closed enhancement (duplicate)

Translating custom image size names

Reported by: sami.keijonen Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:


Should there be parameter in add_image_size for a translated name? Now we need to use image_size_names_choose hook.

Something like add_image_size( $name, $translated_name, $width, $height, $crop );

Example add_image_size( 'my-thumbnail-portfolio', __( 'My Portfolio thumbnail', 'text-domain' ), 450, 309, true );

I wrote article about it the get the idea why and how to translate custom image sizes now.

Change History (4)

comment:1 @krogsgard2 years ago

  • Cc krogsgard added

I think you'd want to add $translated_name as the last parameter for backward compatibility. And you'd need to set a default as well.

In core, I think it'd be more like

function add_image_size( $name, $width = 0, $height = 0, $crop = false, $translated_name = __(  $name ) ) {
// stuff

comment:2 @sami.keijonen2 years ago

Thanks Brian. I wasn't thinking. I was too afraid that my first ticket would blow up WP to a black hole.

comment:3 @daveshine2 years ago

  • Cc daveshine added

Definitely an awesome idea/ enhancement which would have benefits for the end user (think media uploader: real names for added image sizes!) and theme/ plugin devs, as the process of adding the i18n stuff would become much easier and faster, and so hopefully gets implemented in the end!

These are "small details" that matter in user experience!

comment:4 @SergeyBiryukov2 years ago

  • Component changed from General to Media
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from trunk to 3.5
Note: See TracTickets for help on using tickets.