Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#25665 closed enhancement (fixed)

Better plugin main-file support for makepot.php tool

Reported by: otto42's profile Otto42 Owned by: nacin's profile nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8
Component: I18N Keywords: has-patch
Focuses: Cc:


The makepot.php tool, when used for plugins, contains the assumption that the "main file" of a plugin will be named plugin-slug.php, when searching for plugin headers to include in the POT file for translation. This is not necessarily the case all the time, and WordPress itself does a directory search in get_plugins to find the "main file" of the plugin.

The makepot.php file should do a similar search instead of making this assumption. This allows it to find plugin headers in files that are named differently than their slugs.

Patch attached. Most of the directory searching code is ripped from the core's own code, but I removed the subdirectory searching since I think that might be a step too far. That could be added back though, if that is desirable.

Attachments (1)

25665.diff (1.4 KB) - added by Otto42 11 years ago.
modify makepot.php to look for plugin main-file instead of guessing

Download all attachments as: .zip

Change History (5)

11 years ago

modify makepot.php to look for plugin main-file instead of guessing

#1 @markoheijnen
11 years ago

Looks good. When I had this issue I solved it by allowing to send a 4th parameter:

#2 @jdgrimes
10 years ago

I was also looking at this a while back, thinking of an approach like @markoheijnen used.

Just applied the patch to use on a plugin, and it looks like it worked perfectly.

#3 @markoheijnen
10 years ago

  • Milestone changed from Awaiting Review to 3.9

Let's get this in for 3.9

#4 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 27399:

i18n tools: Have makepot search for the main file of the plugin.

props Otto42.
fixes #25665.

Note: See TracTickets for help on using tickets.