return to first page linux journal archive
keywordscontents

Listing 4

#define gettext_noop(x) (x)
char *item_names[] = {
        gettext_noop("files"),
        gettext_noop("messages"),
        gettext_noop("tapes"),
        gettext_noop("penguins"),
        gettext_noop("floppies")
};
...
if((index >= 0) && (index <= 4))
        items = gettext(item_names[index]);
else
        items = gettext("unknown items");
printf(gettext("You have %d %s\n"), quantity, items);