WordPress.org

Making WordPress.org

Opened 7 weeks ago

Last modified 3 weeks ago

#5358 new enhancement

Warn on plugin upload if text domain and plugin slug don't match

Reported by: SergeyBiryukov Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

Per the Plugin Handbook:

The text domain must match the slug of the plugin. If your plugin is a single file called my-plugin.php or it is contained in a folder called my-plugin the domain name must be my-plugin. If your plugin is hosted on wordpress.org it must be the slug portion of your plugin URL (wordpress.org/plugins/<slug>).

Unfortunately, this goes unnoticed or ignored by many authors until translators and GTEs/PTEs complete the translation, only to find out that it doesn't work as expected, leading to frustration.

By adding a check on plugin upload if text domain and plugin slug don't match, with a link to the handbook article above, we can hopefully reduce the confusion a bit.

Props to @fierevere for the idea.

Change History (7)

#1 @Ipstenu
7 weeks ago

The 'easy' part of that is checking if the text domain is properly declared in the header.

The hard part is that a number of people ... don't. At least not on submission.

I don't disagree we should do this, just want to be aware it won't catch everything.

#2 @ocean90
7 weeks ago

The 'easy' part of that is checking if the text domain is properly declared in the header.
The hard part is that a number of people ... don't. At least not on submission.

Probably because it's no longer required as of WordPress 4.6: https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#text-domains

#3 @fierevere
7 weeks ago

Probably because it's no longer required as of WordPress 4.6

load_textdomain() is not required, but mismatch between textdomain and plugin slug is still considered as error, which prevents translations from being used by plugin.

Example:
https://wp-info.org/tools/checkplugini18n.php?slug=cookie-notice-and-consent-banner
(Author is made aware of this problem, and may fix their textdomain soon, but for now)

- Plugin Name: Cookie Notice and Consent Banner
- Version: 1.6.1
- Text Domain: cncb
ERROR: Your plugin slug is cookie-notice-and-consent-banner, but your Text Domain is set as cncb. As the "Requires at least" is at least 4.6, you could remove the Text Domain tag, but you still need to modify the text domain in all your source files. Make sure it is equal to your plugin slug.

#4 @dd32
7 weeks ago

It's worth noting that Plugin authors do not know their plugin slug prior to being approved in the plugin directory, and the plugin slug can be changed/updated/etc by the plugins team prior to approval.

Perhaps this is something that needs to be spelt out in the approval email? "Here's what you need to do, to play nicely with WordPress.org & Translations"

#5 follow-up: @Ipstenu
7 weeks ago

It's worth noting that Plugin authors do not know their plugin slug prior to being approved in the plugin directory, and the plugin slug can be changed/updated/etc by the plugins team prior to approval.

They kind of do, but yeah. It's on the FAQ on that page (I know, no one reads)

Perhaps this is something that needs to be spelt out in the approval email? "Here's what you need to do, to play nicely with WordPress.org & Translations"

If there's a doc about that, we could easily add it into the list of links in the email (which includes how to use assets etc)

#6 in reply to: ↑ 5 @dd32
7 weeks ago

Replying to Ipstenu:

They kind of do, but yeah. It's on the FAQ on that page (I know, no one reads)

While that's true, and for most of us it's easy to figure it out, but not everyone writes the plugin with the intention of having us host it, and I still think a lot of the confusion comes from the fact that most authors have no clue that the slug and text-domain actually have to match.

By adding a check on plugin upload if text domain and plugin slug don't match, with a link to the handbook article above, we can hopefully reduce the confusion a bit.

I'm still in favour of this though.

This ticket was mentioned in Slack in #polyglots by yui. View the logs.


3 weeks ago

Note: See TracTickets for help on using tickets.