[wp-hackers] Internationalizing Plugins and Themes Solutions
Stephen Rider
wp-hackers at striderweb.com
Thu Mar 6 22:31:35 GMT 2008
On Mar 6, 2008, at 10:02 AM, Jacob Santos wrote:
> None of the solutions involve editing just one file, unless you mean
> the .pot file to create the .mo file, then in that case you would be
> correct.
>
> I would rather work within the tools that exist now then having a
> lot of desc-[locale].txt files.
I think the closest we've gotten was the suggestion to leave plugins
exactly as they are and modify the core WP plugin functions to look
inside the header comment in plugins and pass that text to __() as
needed.
The only real objection to this (and a legitimate one) was that those
strings would not automatically be included in .pot/.po files
generated by apps such a Poedit -- which look for specific specified
functions (e.g. "__()").
I think I have a solution to this, however: .po/.mo files are used as
they always have been, but we also create a standard "meta" .pot file
that any plugin can use. Since the meta header _names_ never change,
the .pot for that data needs never change -- no need to auto
generate. Give it a specific standardized name (maybe
meta_xx.po/.mo), and if WordPress see a .mo file of that name in the
plugin/languages directory, it parses the data with __() without
having to be told to.
To clarify: We would standardize a .po/.mo file _for the meta data
only_ -- the plugin header strings. All other translation would be
done exactly as it was before.
This system is _totally_ backwards compatible. Existing plugins work
exactly as they always have. To make a new plugin work with the new
meta-translation system, an author (or any translator, for that
matter) would only have to use the standard meta.pot and make a
translation file, and drop it in the plugin's folder.
Advantages:
It would work.
It is simple from the plugin author's standpoint.
It would be standardized on one template file that works with _any_
plugin.
It doesn't break old plugins.
Any person could make a meta translation file without having to change
the plugin itself _at all_.
What's not to love? :)
Stephen
--
Stephen Rider
<http://striderweb.com/>
More information about the wp-hackers
mailing list