[wp-hackers] wordpress.org *.pot file feature for pluginsgetsbroken by PoEdit
Heiko Rabe
heiko.rabe at code-styling.de
Wed Jul 22 00:47:59 UTC 2009
>> I know this. But the point is, that a lot of translation frameworks only based on normal gettext capabilities and also assume, that a rescan process can run every time on demand if required.
>> Out of this scope this breaks all arround based on normal gettext behavoir.
>> Any msgid not having a line number/file reference and can't be found by the gettext function definitions will be declared as obsolete.
>>
>>
>
> We can add line numbers if this causes a problem with the tools.
>
The Problem are not only the line number themselves, it the way gettext
processors scanning sources.
Even if there would be a line number attached, the scanner is unable to
keep this at *.po file instead of trash it as absolete.
Example:
<?php
/*
Plugin Name: Custom Field Images
Description: Easily associate any image to a post and display it in post
excerpts, feeds etc.
Version: 2.0.0.1
Author: scribu
Author URI: http://scribu.net/
Plugin URI: http://scribu.net/wordpress/custom-field-images
Text Domain: custom-field-images
Domain Path: /lang
*/
This is a PHP comment section and because of this a normal gettext
processor will immediatly skip any processing inside even if there would
be a gettext functions included.
Also a full blown and correct WP 2.8.x based function definition like:
"X-Poedit-KeywordsList:
__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
and a modified header like:
<?php
/*
Plugin Name: __('Custom Field Images', 'custom-field-images')
.....
*/
won't work (even if this could be parsed by WordPress and handled
correctly), because scanner just skip this section.
And there is no way to tell ordinary gettext processor to detect those
lines.
But one thing for sure will be keeped by gettext processors, the header
fields in msgid "" !
If you think about the PoEdit X- (extended) fields like this:
"X-Poedit-Language: German\n"
"X-Poedit-Country: GERMANY\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-KeywordsList:
__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
"X-Poedit-Basepath: \n"
"X-Poedit-Bookmarks: \n"
"X-Poedit-SearchPath-0: .\n"
you also could do the same as PoEdit did just for WordPress itself like:
"X-WordPress-Plugin-Name: Custom Field Images\n"
"X-WordPress-Plugin-Description: Easily associate any image to a post
and display it in post excerpts, feeds etc.\n"
...
and as new golden goal it would also work for gettextable themes, where
you have currently no solution for:
"X-WordPress-Theme-Name: My Super Theme\n"
"X-WordPress-Theme-Description: This is the worlds best theme ever seen
on earth.\n"
...
I have written the proposed X-WordPress fields only english because of
illustration but normally at a german file (de_DE.po) you would have
german text there :-)
This would be my proposal for keeping it inside the file and also can be
keeped even if the files gets re-written by a new scan process.
And because the header of a *.mo file get's processed dedicated (at
least to get the pluralization formula and number) this fields could be
extracted as easy as the plurals.
What you think about going this way to avoid translations get lost ?
regards
Heiko Rabe
(www.code-styling.de)
More information about the wp-hackers
mailing list