Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] i18n for all eternity
Home

Re: [Freeciv-Dev] i18n for all eternity

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ba'rdosi Zolta'n" <hck@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] i18n for all eternity
From: Alex Zepeda <jazepeda@xxxxxxxxxxx>
Date: Wed, 25 Aug 1999 13:16:49 -0700 (PDT)

On Mon, 23 Aug 1999, Ba'rdosi Zolta'n wrote:

> 2. how? any special rules, ideas? or just putting some _( ) around text
> constants?
>  once this is complete, i think i can post hungarian translation

Essentially you create a function such as

char *i18n(const char *msg)
{
  return gettext(msg);
}

Now, I'd say use a function because functions are cheap, and it makes it
easier to do more complex things or switch to another i18n system.  You
can use gettext (which xgettext will pick up automatically unless told not
to) or some other things (see the info page).

Then you put all the string constsants you want to be i18n'd in a call to
the i18n function.  So let's say you have:

sprintf(buf, "Unit: %s %d/%d/%d");

to i18n this you would simply do:

sprintf(buf, i18n("Unit: %s %d/%d/%d"));

Then (this makes a good thing to put in Makefile.am) you run xgettext w/
-k i18n as an argument so that it will pick up all calls to i18n.  The
command line would look something like:

xgettext --c++ -s -k i18n -D client/ *.c

- alex


[Prev in Thread] Current Thread [Next in Thread]