[wp-hackers] Improving Plugin (and Theme) metadata

Sören Weber mail at soeren-weber.net
Fri Jan 25 09:08:48 GMT 2008

It's only an optimistic assumption: the .po compiler hopefully does not
care about whether a string is inside of PHP comments or not as long a as
the string matches the .po's search condition (which usually is '__' and
'_e' at the moment). I haven't verfied this yet.

Therefore the description string can be encapsulated into a pseudo PHP
function call and so will be recognized by the .po compiler. An example
would look like:

Plugin Name: Blah
Version: 2.0.2
Plugin URI: http://example.com
Author: Me
Author URI: http://example.com
Description: __("My super duper plugin")
Text Domain: myplugin

The encapsulating __(" ") needs to be stripped away by the WP core before
it accesses the gettext functions with the description string. One
downside of this solution is, that even the strings of inactive plugins
will be loaded this way.

I agree with Peter Westwood that this solution also requires a third
translation function for the WP core to avoid that for these strings the
variable names will end up in the WordPress catalogue file.

> On Jan 25, 2008 6:25 AM, Stephen Rider <wp-hackers at striderweb.com> wrote:
>> Text Domain: myplugin
> Sounds neat & simple, but how does the plugin author add the required
> strings (plugin name, desc etc....) to its .mo/.po(t) ?
> --
> http://FrenchFragFactory.net ~ Daily Quake News
> http://planetOzh.com ~ Blog and WordPress Stuff
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list