/*****************************************************************************
* Local prototypes
*****************************************************************************/
-void LocaleInit( vlc_object_t * );
-void LocaleDeinit( void );
static void SetLanguage ( char const * );
static inline int LoadMessages (void);
static int GetFilenames ( libvlc_int_t *, int, char *[] );
/*
* Support for gettext
*/
- SetLanguage( "" );
+#ifdef HAVE_LC_MESSAGES
+ setlocale( LC_MESSAGES, "" );
+#endif
+ setlocale( LC_CTYPE, "" );
LoadMessages ();
- /*
- * Global iconv, must be done after setlocale()
- * so that vlc_current_charset() works.
- */
- LocaleInit( (vlc_object_t *)p_libvlc );
-
/* Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */
msg_Dbg( p_libvlc, "translation test: code is \"%s\"", _("C") );
{
/* System specific cleaning code */
system_End( p_libvlc );
-
- /* Destroy global iconv */
- LocaleDeinit();
}
vlc_mutex_unlock( lockval.p_address );
var_Destroy( p_libvlc_global, "libvlc" );
return VLC_SUCCESS;
};
+#if defined (__APPLE__) || defined (WIN32)
/*****************************************************************************
* SetLanguage: set the interface language.
*****************************************************************************
* as well as the LC_CTYPE category for string sorting and possible wide
* 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__
- /* I need that under Darwin, please check it doesn't disturb
- * other platforms. --Meuuh */
- 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
+ /* I need that under Darwin, please check it doesn't disturb
+ * other platforms. --Meuuh */
+ setenv( "LANG", psz_lang, 1 );
- 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
+
+ setlocale( LC_ALL, psz_lang );
}
+#endif
static inline int LoadMessages (void)
#if !defined( __APPLE__ ) && !defined( WIN32 ) && !defined( SYS_BEOS )
static const char psz_path[] = LOCALEDIR;
#else
- char buf[1024];
- if (snprintf (buf, sizeof (buf), "%s/%s", libvlc_global.psz_vlcpath,
- "locale")) >= sizeof (buf)
+ char psz_path[1024];
+ if (snprintf (psz_path, sizeof (psz_path), "%s/%s",
+ libvlc_global.psz_vlcpath, "locale")
+ >= (int)sizeof (psz_path))
return -1;
- const char *psz_path = psz_tmp;
#endif
if (bindtextdomain (PACKAGE_NAME, psz_path) == NULL)
{
* and their input options */
for( i_opt = i_argc - 1; i_opt >= optind; i_opt-- )
{
- const char *psz_target;
i_options = 0;
/* Count the input options */
/* TODO: write an internal function of this one, to avoid
* unnecessary lookups. */
-#ifdef WIN32
- if( GetVersion() < 0x80000000 )
- {
- VLC_AddTarget( p_vlc->i_object_id, ppsz_argv[i_opt],
- (char const **)( i_options ? &ppsz_argv[i_opt + 1] :
- NULL ), i_options,
- PLAYLIST_INSERT, 0 );
- }
- else
-#endif
- {
- /* FIXME: it's too late to call FromLocale here. We should
- convert ALL arguments to UTF8 before they get parsed */
-
- psz_target = FromLocale( ppsz_argv[ i_opt ] );
- VLC_AddTarget( p_vlc->i_object_id, psz_target,
+ VLC_AddTarget( p_vlc->i_object_id, ppsz_argv[i_opt],
(char const **)( i_options ? &ppsz_argv[i_opt + 1] :
NULL ), i_options,
PLAYLIST_INSERT, 0 );
- LocaleFree( psz_target );
- }
}
return VLC_SUCCESS;
if( psz_module_name && strcmp( psz_module_name,
p_parser->psz_object_name ) )
{
- continue;
+ char **pp_shortcut = p_parser->pp_shortcuts;
+ while( *pp_shortcut )
+ {
+ if( !strcmp( psz_module_name, *pp_shortcut ) )
+ break;
+ pp_shortcut ++;
+ }
+ if( !*pp_shortcut )
+ continue;
}
/* Ignore modules without config options */
p_connection = dbus_bus_get ( DBUS_BUS_SYSTEM, &error );
if( dbus_error_is_set( &error ) )
{
+#ifdef HAVE_HAL_1
+ libhal_ctx_shutdown( ctx, NULL );
+#else
+ hal_shutdown( ctx );
+#endif
dbus_error_free( &error );
return;
}