]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
* modules/gui/skins/src/themeloader.*: dropped the dependancy on libtar
[vlc] / src / libvlc.c
index 9e2df0c0e5f26e2fedee51bd83b1dcc6d0d7fcc1..f56cc04812aaed872200d7b87a35bc3fb6eff2d0 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.71 2003/03/26 00:56:22 gbazin Exp $
+ * $Id: libvlc.c,v 1.80 2003/04/22 16:36:16 titer Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -155,7 +155,7 @@ int VLC_Create( void )
         psz_env = getenv( "VLC_VERBOSE" );
         libvlc.i_verbose = psz_env ? atoi( psz_env ) : -1;
 
-#ifdef HAVE_ISATTY
+#if defined( HAVE_ISATTY ) && !defined( WIN32 )
         libvlc.b_color = isatty( 2 ); /* 2 is for stderr */
 #else
         libvlc.b_color = VLC_FALSE;
@@ -322,16 +322,27 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     }
 
     /* Check for translation config option */
+#if defined( ENABLE_NLS ) \
+     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
+
+    /* This ain't really nice to have to reload the config here but it seems
+     * the only way to do it. */
+    p_vlc->psz_homedir = config_GetHomeDir();
+    config_LoadConfigFile( p_vlc, "main" );
+    config_LoadCmdLine( p_vlc, &i_argc, ppsz_argv, VLC_TRUE );
+
     if( !config_GetInt( p_vlc, "translation" ) )
     {
         /* Reset the default domain */
         SetLanguage( "C" );
 
-#if defined( ENABLE_NLS ) \
-     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
         textdomain( "dummy" );
-#endif
+
+        module_EndBank( p_vlc );
+        module_InitBank( &libvlc );
+        module_LoadMain( &libvlc );
     }
+#endif
 
     /*
      * Load the builtins and plugins into the module_bank.
@@ -424,7 +435,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
             libvlc.i_verbose = __MIN( i_tmp, 2 );
         }
     }
-    libvlc.b_color = libvlc.b_color || config_GetInt( p_vlc, "color" );
+    libvlc.b_color = libvlc.b_color && config_GetInt( p_vlc, "color" );
 
     /*
      * Output messages that may still be in the queue
@@ -519,7 +530,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     psz_parser = psz_modules;
     while ( psz_parser && *psz_parser )
     {
-        char *psz_module;
+        char *psz_module, *psz_temp;
         psz_module = psz_parser;
         psz_parser = strchr( psz_module, ',' );
         if ( psz_parser )
@@ -527,7 +538,13 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
             *psz_parser = '\0';
             psz_parser++;
         }
-        VLC_AddIntf( 0, psz_module, VLC_FALSE );
+        psz_temp = (char *)malloc( strlen(psz_module) + sizeof(",none") );
+        if( psz_temp )
+        {
+            sprintf( psz_temp, "%s,none", psz_module );
+            VLC_AddIntf( 0, psz_temp, VLC_FALSE );
+            free( psz_temp );
+        }
     }
     if ( psz_modules )
     {
@@ -574,7 +591,7 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block )
 
     if( p_intf == NULL )
     {
-        msg_Err( p_vlc, "interface initialization failed" );
+        msg_Err( p_vlc, "interface \"%s\" initialization failed", psz_module );
         if( i_object ) vlc_object_release( p_vlc );
         return VLC_EGENERIC;
     }
@@ -990,7 +1007,7 @@ static void SetLanguage ( char const *psz_lang )
      && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
 
     char *          psz_path;
-#if defined( SYS_DARWIN ) || defined ( WIN32 )
+#if defined( SYS_DARWIN ) || defined ( WIN32 ) || defined( SYS_BEOS )
     char            psz_tmp[1024];
 #endif
 
@@ -1018,10 +1035,15 @@ static void SetLanguage ( char const *psz_lang )
     else
     {
         setlocale( LC_ALL, psz_lang );
+#ifdef SYS_DARWIN
+        /* I need that under Darwin, please check it doesn't disturb
+         * other platforms. --Meuuh */
+        setenv( "LANG", psz_lang, 1 );
+#endif
     }
 
     /* Specify where to find the locales for current domain */
-#if !defined( SYS_DARWIN ) && !defined( WIN32 )
+#if !defined( SYS_DARWIN ) && !defined( WIN32 ) && !defined( SYS_BEOS )
     psz_path = LOCALEDIR;
 #else
     snprintf( psz_tmp, sizeof(psz_tmp), "%s/%s", libvlc.psz_vlcpath,
@@ -1036,6 +1058,12 @@ static void SetLanguage ( char const *psz_lang )
 
     /* Set the default domain */
     textdomain( PACKAGE );
+
+#ifdef SYS_BEOS
+    /* BeOS only support UTF8 strings */
+    bind_textdomain_codeset( PACKAGE, "UTF-8" );
+#endif
+
 #endif
 }