Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#58138 closed enhancement (fixed)

For echo the translated string, use _e() instead of __()

Reported by: mujuonly's profile mujuonly Owned by: audrasjb's profile audrasjb
Milestone: 6.3 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: coding-standards Cc:

Description

If you want to echo the translated string, then you will be using _e() and when you just want to have the translated string, then you will be using __().

Used echo __( 'Search Media' ) in /wp-admin/includes/media.php

Change History (11)

This ticket was mentioned in PR #4332 on WordPress/wordpress-develop by @mujuonly.


12 months ago
#1

  • Keywords has-patch added; needs-patch removed

To echo the translated string, then you will be using _e()

Trac ticket: https://core.trac.wordpress.org/ticket/58138

#2 @audrasjb
12 months ago

  • Component changed from General to I18N
  • Milestone changed from Awaiting Review to 6.3
  • Version 6.2 deleted

Hello, thanks for the ticket & patch!

Good point.
Also, I think the translation string should include the : character. In some locales, this character has to be translatable. For example we need a non-breaking space before : in fr_FR.

#3 @vladytimy
12 months ago

Good catch

Also, I think the translation string should include the : character.

+1 on this part. Punctuation should always be included in the translation string.

#4 @mujuonly
12 months ago

@vladytimy @audrasjb The current code is like echo __( 'Search Media' ) . ':';, so it should be like _e( 'Search Media:' ); right.?

#5 @audrasjb
12 months ago

Yeah that's the idea :)

This ticket was mentioned in PR #4333 on WordPress/wordpress-develop by @mujuonly.


12 months ago
#6

Punctuation should always be included in the translation string

Trac ticket: https://core.trac.wordpress.org/ticket/58138

#7 @mujuonly
12 months ago

@audrasjb Updated with a PR

#8 @krupalpanchal
12 months ago

PR LGTM

@mujuonly Also check if the same occurrence is not again in the file(s).

#9 @mukesh27
12 months ago

  • Owner changed from mujuonly to audrasjb

Hi there! thanks for ticket and PR!

The PR 4333 ready to go.

Assign to @audrasjb for final review and commit.

#10 @audrasjb
12 months ago

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

In 55684:

I18N: Use correct translation function in wp-admin/includes/media.php.

This changeset replaces echo __() with the appropriate _e() function. It also ensures the punctuation is included in the translation string.

Props mujuonly, audrasjb, vladytimy, krupalpanchal, mukesh27.
Fixes #58138.

Note: See TracTickets for help on using tickets.