[Sugar-devel] [PATCH sugar-toolkit] sugar.activity.i18n: add pgettext()

Simon Schampijer simon at schampijer.de
Tue Feb 15 13:00:34 EST 2011


On 02/11/2011 02:22 PM, Sascha Silbe wrote:
> Python 2 will never have pgettext() [1], so we need to ship our own version.
> sugar.activity.i18n is the best place for that.
>
> [1] http://bugs.python.org/issue2504#msg122482

Hi Sascha,

I think it makes sense to add a docstring that indicates what the method 
is doing and what the magic number is about, in the python3 patch I found:

# The encoding of a msgctxt and a msgid in a .mo file is
# msgctxt + "\x04" + msgid (gettext version >= 0.15)

If I understand correctly in the support landed in Python3, so please 
add a FIXME that links to this ticket to indicate that.

---

I did apply your sugar and sugar-toolkit patches. And I recreated the 
.po files locally (make update-po). The content of those files seem to 
be correct but the gettext call in the pgettext function of i18n does 
not return the translation.

#: ../src/jarabe/frame/clipboardmenu.py:55
#, fuzzy
msgctxt "Clipboard"
msgid "Remove"
msgstr "Entfernen"

#: ../src/jarabe/view/palettes.py:221
#, fuzzy
msgctxt "Volume"
msgid "Remove"
msgstr "Entfernen"

So from my understanding we pass the correct keyword 
"--keyword=pgettext:1c,2" in the Makevars file. Was it working fo you? 
Maybe I just forgot a step...

Regards,
    Simon



More information about the Sugar-devel mailing list