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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Nov 30 01:46:26 CET 2006


Hello,
On Thu, Nov 30, 2006 at 12:52:35AM +0100, ?tv?s Attila wrote:
> 2006. november 29. 23.50 dátummal Reimar Döffinger ezt írta:
> > You cannot - I emphasize - you _can not_ use setlocale, it breaks the
> > behaviour of all kinds of C library functions, most notably strcasecmp,
> > in a way that e.g. causes crashes if the locale is tr_TR. In addition it is
> > not thread-safe, so that setting it every time you need it and restoring
> > it again is at least risk and quite likely to cause problems, too (yes,
> > indirectly through libavcodec even MPlayer uses threads!).
> 
> My question: 
> 
> This is good idea:
> 
> mp_msg_init()
> ...
> setlocale(LC_MESSAGES,"");	// set lc_messages
> setlocale(LC_TYPE,"");		// locale character ...
> bindtextdomain("mplayer","/usr/share/locale");
> bind_textdomain_codeset("mplayer",nl_langinfo(CODESET));
> textdomain("mplayer");
> setlocale(LC_TYPE,"C");		// locale default

I think nl_langinfo(CODESET) is wrong, it should be MSG_CHARSET instead
(normally UTF-8) and MPlayer will then convert it as necessary.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list