[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettexting of libraries
From: |
Bruno Haible |
Subject: |
Re: gettexting of libraries |
Date: |
Fri, 9 Jan 2004 21:14:08 +0100 |
User-agent: |
KMail/1.5 |
Thomas Vander Stichele wrote:
> I have a test app printing two translated messages, linking against an
> included library with two translated messages. I have noticed that for
> all strings to be translated, I need to put the three gettext calls
> (bindtextdomain and friends) both in the main call (so the app gets
> translations) AND in the library's initialization (so the lib strings
> get translated).
>
> Is this correct ?
Are the translation domains for the main program and in the library the same
or different?
If they are the same (i.e. there is only one PO file for each language),
then it's sufficient to make the initializations once, in main().
If they are different (i.e. the library has its own set of PO files),
then the library
- shouldn't need to call setlocale(LC_ALL, ""); - that is the
responsibility of main(),
- should not call textdomain() - since it would interfere with the
main program,
- should call bindtextdomain() - to tell where its own .mo files are
located,
- should call dgettext ("lib-domain", string) instead of
gettext (string). I.e. you may need to define the _ macro differently
for the library.
Bruno