Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#28560 closed enhancement (wontfix)

l10n: Look in the default text domain if a translation isn't found in the specified text domain

Reported by: yoavf's profile yoavf Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords:
Focuses: Cc:


Occasionally, themes or plugins have strings that already exist in core, but the l10n call uses the plugin text domain.


_e( 'edit', 'my-plugin' );

If that string doesn't exist in the plugin translation files, core's translation (if it exists) won't be used.
Why not have the l10n functions look in the default text domain too if no translation is found?

You can already do that with filters (in a plugin). For example:

function gettext_domain_override( $translation, $original, $domain = 'default' ) {
	if ( $domain != 'default' && $translation == $original ) {
		$translation = translate( $original, 'default' );
	return $translation;
add_filter( 'gettext', 'gettext_domain_override', 10, 3 );

Change History (3)

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.

9 years ago

This ticket was mentioned in Slack in #core by celloexpressions. View the logs.

9 years ago

#3 @chriscct7
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

While theoretically a plugin should use the context based translation function, it's possible that WordPress's translation and the plugins might be for non-compatible actions/items, even if they are the same string. Therefore, closing as wontfix.

Note: See TracTickets for help on using tickets.