Re: gettext implementation for glib



Havoc Pennington <hp redhat com> writes:

> Sven Neumann <sven gimp org> writes:
> > Hi,
> > 
> > Alex Larsson <alexl redhat com> writes:
> > 
> > > +static const char *
> > > +get_locale (void)
> > > +{
> > > +  const char *locale;
> > > +  
> > > +  locale = g_getenv ("LANG");
> > > +  if (locale)
> > > +    return locale;
> > > +
> > > +  return "en_US";
> >              ^^^^^ 
> > I'm not sure, but shouldn't that return "C" ?!
> 
> I think it should just call setlocale() to get the locale, instead of
> trying to guess. ;-)

gtkrc.c has:

#ifdef G_OS_WIN32      
  locale = g_win32_getlocale ();
#else      
  locale = setlocale (LC_CTYPE, NULL);
#endif      

and gtkimmulticontext.c has:

#ifdef HAVE_LC_MESSAGES
	  locale = setlocale (LC_MESSAGES, NULL);
#else
	  locale = setlocale (LC_CTYPE, NULL);
#endif

So we seem to have some missed opportunity for portability functions,
but you should be able to do something along these lines.

Regards,
                                        Owen





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