Commit 403b22d1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Only define SetLanguages on platform that actually use it (Win+Mac)

parent 9709cd06
...@@ -271,7 +271,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] ) ...@@ -271,7 +271,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
/* /*
* Support for gettext * Support for gettext
*/ */
SetLanguage( "" ); #ifdef HAVE_LC_MESSAGES
setlocale( LC_MESSAGES, "" );
#endif
setlocale( LC_CTYPE, "" );
LoadMessages (); LoadMessages ();
/* /*
...@@ -1128,6 +1131,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, ...@@ -1128,6 +1131,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
return VLC_SUCCESS; return VLC_SUCCESS;
}; };
#if defined (__APPLE__) || defined (WIN32)
/***************************************************************************** /*****************************************************************************
* SetLanguage: set the interface language. * SetLanguage: set the interface language.
***************************************************************************** *****************************************************************************
...@@ -1135,43 +1139,27 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, ...@@ -1135,43 +1139,27 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
* as well as the LC_CTYPE category for string sorting and possible wide * as well as the LC_CTYPE category for string sorting and possible wide
* character support. * character support.
*****************************************************************************/ *****************************************************************************/
static void SetLanguage ( char const *psz_lang ) static void SetLanguage ( const char *psz_lang )
{ {
if (psz_lang == NULL)
return;
#if defined( ENABLE_NLS ) \
&& ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
if( !*psz_lang )
{
# if defined( HAVE_LC_MESSAGES )
setlocale( LC_MESSAGES, "" );
# endif
setlocale( LC_CTYPE, "" );
}
else
{
#ifdef __APPLE__ #ifdef __APPLE__
/* I need that under Darwin, please check it doesn't disturb /* I need that under Darwin, please check it doesn't disturb
* other platforms. --Meuuh */ * other platforms. --Meuuh */
setenv( "LANG", psz_lang, 1 ); setenv( "LANG", psz_lang, 1 );
#elif defined( SYS_BEOS ) || defined( WIN32 )
/* We set LC_ALL manually because it is the only way to set
* the language at runtime under eg. Windows. Beware that this
* makes the environment unconsistent when libvlc is unloaded and
* should probably be moved to a safer place like vlc.c. */
static char psz_lcall[20];
snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
psz_lcall[19] = '\0';
putenv( psz_lcall );
#endif
setlocale( LC_ALL, psz_lang ); #else
} /* We set LC_ALL manually because it is the only way to set
* the language at runtime under eg. Windows. Beware that this
* makes the environment unconsistent when libvlc is unloaded and
* should probably be moved to a safer place like vlc.c. */
static char psz_lcall[20];
snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
psz_lcall[19] = '\0';
putenv( psz_lcall );
#endif #endif
setlocale( LC_ALL, psz_lang );
} }
#endif
static inline int LoadMessages (void) static inline int LoadMessages (void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment