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

Re: gettext



: Hi!
: I want to know something about getetxt() usage
: How can I deal with array?
: for example:
: 
: char *title[]={"hello", "world"};
: 
: what should I do to export "hello" and "world " to *.pot by xgettext?

Hello, please try this: If you have a program like the following:

============================================================================
/* This is program test.c */

#include <stdio.h>
#include <libintl.h>

#define _(msg)  gettext(msg)
#define N_(msg) (msg)

main()
{
    char *title[] = {N_("hello"), N_("world")};
    int idx;

    idx = 0;
    printf(_("string 1: %s %s\n"), _(title[idx]), _(title[idx+1]));
}
============================================================================

Then invoke xgettext as:

	xgettext --keyword=N_ --keyword=_ -o test.pot test.c

See info gettext, * Sources::, * Special cases::   for details.


T.H.Hsieh



Reply to: