Re: General localization question


and happy new year!

On Fri, Dec 21, 2001 at 12:40:36PM -0800, Samir A. Singh wrote:

> I'm interested in adding localization to my program but I've never used
> any of the locale stuff in gnome or gtk.  I've been perusing the archives
> and I noticed this written a while back...
> > > If somebody wants to write an entry on "How do I make my program
> > > suitable for international use?" for the GTK+ FAQ, that would be
> > > appreciated.
> > > I wrote something like that some time ago; 
> > look at
> Was something like this ever written?  I guess the above link was a
> project hosted by but it's gone now.

You can still read it on

> Anybody know a
> good place to find general info on this stuff.

There are some generic i18n docs, and the KDE docs are useful too; however
not Gtk specific, I don't know if that has changed since then, but that
was the reason I wrote those two pages: to keep track of the Gtk specific
steps needed.

> I may not need to support
> different character sets,

Don't think in those terms, that is the wrong way.
You just have to thing in terms of "itnernationalized" or 
"not internationalized".
With a good toolkit (and Gtk is) and if you follow the proper steps, then
you, as a programmer, don't have to worry about "charsets", it is done
automatically by the i18n layer.

> I may just support languages commonly written
> using english characters, spanish, french, etc.  If that is a much simpler
> thing to do let me know.  Thanks.

For a Gtk program the only difference between a bad program limited
only to iso-8859-1 encoding and leaving out in frustration a lot of people
(including Europeans that wouldn"t be able to use the euro sign) and a good
i18n'ed program allowing to use cyrillic, greek, unicode, japanese, etc.
is only (with Gtk 1.2.*):

* calling gtk_set_locale();
* using *_fontset() instead of *_font() functions (and, if you hardcode some
  font names in the source, add a fallback ",*" to them).

With a Gnome program you don't even need to call gtk_set_locale();, it is
done automatically.

So, the only thing you have to do is not force the use of any particular
font encoding, that's all. and your program will be able to work for all
languages and encodings supported by the toolkit (that currently (Gtk 1.2.*)
excludes some complex or right-to-left scripts, for technical reasons 
of the toolkit; with future Gtk 2 it will be supported, and font selection
and manipulation will be easier and more transparent)

Of course, there are other things to do for an i18n program, but theose
are common to one only limited to English and German and for one supporting
any kind of language. So, there is no reason to purposedly limit your

I put in
the steps to add i18n support to a Gtk and Gnome program.
And in the steps to
use gettext, and to add the needed things to autoconf and co.

There may be some errors maybe, I did it in an empiric way, out of my own
experience. For example I learned only recently that setlocale() should
not be used, but gtk_set_locale() be used instead, otherwise multi-byte
encodings have width problems.
I'll appreciate comments and corrections of course.

And the pages could be copied/adapted to official Gtk/Gnome docs if someone
think they are usefull.

> -Samir Singh 
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org

Ki a vos vye bn,
Pablo Saratxaga		PGP Key available, key ID: 0x8F0E4975

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