[wp-trac] [WordPress Trac] #28560: l10n: Look in the default text domain if a translation isn't found in the specified text domain
WordPress Trac
noreply at wordpress.org
Tue Jun 17 09:29:09 UTC 2014
#28560: l10n: Look in the default text domain if a translation isn't found in the
specified text domain
-------------------------+-----------------------------
Reporter: yoavf | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Occasionally, themes or plugins have strings that already exist in core,
but the l10n call uses the plugin text domain.
Example
{{{
_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 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28560>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list