[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

pgettext() availability in Debian?



Dear Debian i18n experts,

I am currently trying to i14e[0] a bit of software that I'm writing on 
Debian GNU/Linux, and have been reading up on gettext and its 
associated applications and libraries.

I have figured out that I need use contexts to distinguish between some 
short strings in my application.

To this end, I've created a sample .pot file and translated .po files 
with the requisite msgid, msgstr and msgctxt lines. However, in order 
to use the strings at runtime, I need to be able to call 
[d[c]]pgettext(), as described in the gettext manual[1].

Despite having all the gettext-related packages that I can find 
installed on my system, these functions do not appear to be declared 
anywhere.[2] Is there a package I should have installed? I already have 
libc6-dev 2.7-9 (owner of libintl.h) and gettext 0.17-2 installed.


To investigate further, I downloaded the GNU sources for gettext 0.17 
and had a look at them. According to their header file, pgettext() just 
calls gettext(), passing its msgctxt argument as gettext()'s msgid. As 
a test, I tried calling gettext() directly with a context id as a 
message id on the Debian library. This did not work. And neither can I 
get a translation for a message that has a context even if it is the 
only message with a particular msgid. 

So, I need to use gettext contexts, but I can't figure out how to do 
this on my Debian system. If a message has a context, it simply appears 
to be unavailable. (Messages without contexts load fine, so I know that 
I'm putting the .mo files in the right place, setting the locale 
properly and binding to the correct domain, etc...)


Am I missing something? Or is this a bug in libc6/gettext?

I tried googling[3] for more info but nothing particularly useful turned 
up.


Thanks,

Adam Spragg.


[0] Internationalise
[1] http://www.gnu.org/software/gettext/manual/gettext.html#Contexts
[2] find /usr/include/ -name \*.h | xargs grep pgettext
[3] http://www.google.co.uk/search?q=pgettext+site%3Alists.debian.org


-- 
Adam Spragg                      mailto:adam.spragg@octaltelecom.co.uk
Developer
Octal Telecom                           http://www.octaltelecom.co.uk/


It reverses the logical flow of conversation!
> Why?
> > No.
> > > Should I top post?

http://www.google.com/search?q=%22top+posting%22


Reply to: