[MPlayer-dev-eng] Re: localize with gettext (libintl)

Rich Felker dalias at aerifal.cx
Thu Nov 30 06:15:02 CET 2006


On Thu, Nov 30, 2006 at 04:14:50AM +0200, Andriy N. Gritsenko wrote:
>     Hi, Rich Felker!
> 
> Sometime (on Thursday, November 30 at  1:55) I've received something...
> 
> >IMO it would be best to come up with a way to use nice tools with the
> >catgets framework. Unlike gettext, catgets does not require LC_CTYPE
> >for anything and has essentially zero overhead in time and memory. And
> >it's already adapted to MPlayer's system of using preprocessor symbols
> >for the message strings. With some nice scripts to simplify
> >translation I think it could be just about idea. And we could provide
> >a ~100-line fallback implementation for systems lacking catgets (which
> >should be none anyway since catgets is part of SUSv3).
> 
>     It seems you know catgets framework very well. I want to hear if
> there is a way to use catgets in manner of gettext (i.e. with human
> readable text on the place of real messages).

No, there's not, and this is the fundamental reason it's so much
better than gettext. Unless of course you consider preprocessor
symbols to be "human-readable text", and in that case it's no problem.

> I don't like the idea to
> use some numbers as index - in large project (as MPlayer, of course)

MPlayer already uses such a method with the preprocessor. Each message
has a descriptive (sometimes more descriptive that the actual string,
since it can describe the context/purpose too!) name, defined in the
help headers. Right now, those names expand directly to strings.
However we could quite easily change it so they expand to a call to
catgets with a unique number, where the numbers are all managed in the
help header and invisible to coders and translators.

> there is a big chance to get bloated with duplicate numbers. So I don't

This will not happen unless you just haphazardly start writing numbers
into source files, which no one is proposing... In terms of
translation efforts or coder efforts, the system I propose has no
disadvantages over the current system used in MPlayer. It has the
advantage of runtime selection of the translation.

> like such idea, up to even I hate it. If some program will set up the
> numbers automatically (by some hashes or something else from original
> text) and these numbers are fixed with code changes and there is a
> simple way to edit translations (as it is with .po files) then I'd like
> to use catgets. Answer that question, please. I didn't find anything at
> google and wikipedia.org has no articles about catgets, there is only
> gettext there.

catgets is a standard api specified in susv3/posix, not a set of tools
or a particular implementation. You can find the api documented in
susv3:

http://www.opengroup.org/onlinepubs/009695399/functions/catgets.html]

With that said, the way you make message catalogs is basically the
same as with gettext except that the translations are indexed by
numbers (which may be symbolic names with preprocessor) rather than by
the English string itself.

Rich




More information about the MPlayer-dev-eng mailing list