WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34134 closed defect (bug) (invalid)

Do not import strings without domains if string exists in Core

Reported by: niallkennedy Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: I18N Keywords:
Focuses: template Cc:

Description

I include strings translated by Core in my plugin to match WordPress behavior. I expect WordPress to skip importing my domainless string if it matches a Core msgid.

I truncate text and include the domainless __( '…' ) in my PHP code.
https://plugins.trac.wordpress.org/browser/twitter/tags/1.1.0/src/Twitter/WordPress/Cards/Sanitize.php#L120

The same domainless string exists in WordPress Core.
https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-includes/formatting.php#L2853

I expect the string will not be imported into translate.wordpress.org and therefore scoped to my plugin.

Change History (2)

#1 @SergeyBiryukov
4 years ago

AFAIK, using strings without a text domain in plugins is not encouraged, they should still have the plugin domain even if core uses the same string.

It's up to translation editors to make sure the translations are consistent.

#2 @dd32
4 years ago

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

Plugins really shouldn't use strings without a textdomain. If core changes the string, suddenly the plugins string is no longer translated - it's just not a good user experience.

translate.wordpress.org currently has Translation Matching enabled, if you use 'My String' in a plugin and it's already translated in another project, it'll get imported to your plugin too (so translate in one project, and it's available for all others). In the past I've used what you're proposing too, but thankfully with everything in the one GlotPress instance, it's no longer really needed.

Core Trac is for Core Development only, it's not a support location for either WordPress or WordPress.org tools, if you'd like to discuss anything further to the request, feel free to drop in the #meta-i18n channel in Slack or file a ticket on the Make Trac under the translate.wordpress.org component.

Note: See TracTickets for help on using tickets.