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

Heiko Rabe heiko.rabe at code-styling.de
Sun Jun 21 22:34:39 GMT 2009


Thanks to Nikolay and Peter,

final question(s): This leads (or have to lead) to multiple occurances 
at translation systems with the same phrase ?
The only difference is the context so the same term occuring in 50 
different contexts but maybe translated the same way now consumes 50 
times more space in mo file and PHP memory as would be required, right ?

regards

Heiko Rabe
(www.code-styling.de)

>
> On 21 Jun 2009, at 20:07, Heiko Rabe wrote:
>
>> thanks for the answer. If understand it right, than the result of 
>> *.mo file creation process will transform
>>
>> _x('Published', 'page')
>>
>> internally into
>>
>> "Published|page"
>>
>> at the binary machine object file. If i now try to reverse a *.mo 
>> file, i can't figure out, if
>>
>> "Car|House|Boat|Context"
>>
>> is a contextual separation string or just a menu item collection used 
>> at __(), because such information about context are not stored inside 
>> the binary format.
>> So how would the mo/po classes figure out this, because | becomes 
>> unreliable during load of *.mo file ?
>
> That doesn't sound right to me.
>
> Looking at the code in pomo which parses the file in [1], and the code 
> for the C gettext library, I believe the following is true
>
> In the binary mo file the context is stored at the start of the 
> translation followed by ascii character EOT (character code 4) this is 
> then followed by the translated string.
>
> In the plain text pot or po file it is stored in the context field, 
> for example from [2]
>
> #: wp-admin/menu.php:62
> msgctxt "page"
> msgid "Add New"
> msgstr "Нова"
>
> [1] - http://svn.automattic.com/wordpress/trunk/wp-includes/pomo/mo.php
> [2] - 
> http://svn.automattic.com/wordpress-i18n/bg_BG/tags/2.8/messages/bg_BG.po
>
> westi



More information about the wp-hackers mailing list