[wp-hackers] Question about translation extensions during WP 2.8

Peter Westwood peter.westwood at ftwr.co.uk
Sun Jun 21 18:57:54 GMT 2009

On 21 Jun 2009, at 18:45, Heiko Rabe wrote:
> i would be happy if somebody can explain the advantage of the new  
> one similar translation capabilities:
>   _x('Published', 'page')
> in opposite to
>   _c('Published|page')
> Normally a GNU gettext processor would not allow to have the same  
> phrase twice in file.
> So if the new _x method writes the phrase to *.mo file the same way  
> as __ or _e would do, this may lead on some systems to bad behavoir  
> because of double occurance and damaged hash map table inside *.mo  
> file.

It allows for the context to be properly specified in the po file,  
makes the string easier to translate (and also makes it safer to use  
"|" in a string again)

Previously in the pof file:
#: wp-admin/edit-pages.php:78
msgid "Published|page"
msgstr ""

Now in the pot file:
#: wp-admin/edit-pages.php:78
msgctxt "page"
msgid "Published"
msgstr ""

So it is explicitly marked as context (http://www.gnu.org/software/gettext/manual/gettext.html#Contexts 

Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5

More information about the wp-hackers mailing list