WordPress.org

Make WordPress Core

#25665 closed enhancement (fixed)

Better plugin main-file support for makepot.php tool

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

Description

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 16 months ago.
modify makepot.php to look for plugin main-file instead of guessing

Download all attachments as: .zip

Change History (5)

@Otto4216 months ago

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

comment:1 @markoheijnen16 months ago

Looks good. When I had this issue I solved it by allowing to send a 4th parameter: https://github.com/markoheijnen/wp-i18n-tools/commit/c90bb2676c11308f0006ff2fe3e7661c666357e7.

comment:2 @jdgrimes15 months 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.

comment:3 @markoheijnen15 months ago

  • Milestone changed from Awaiting Review to 3.9

Let's get this in for 3.9

comment:4 @nacin12 months 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.