Commit 83ffc9c0 authored by Sam Hocevar's avatar Sam Hocevar

* ./src/libvlc.c: atomic initialization of the main module in VLC_Init()

    instead of VLC_Create(), so that its strings are translated (was #92).
parent cb912b61
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.61 2003/02/01 18:53:03 sam Exp $ * $Id: libvlc.c,v 1.62 2003/02/01 23:39:02 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -167,17 +167,8 @@ int VLC_Create( void ) ...@@ -167,17 +167,8 @@ int VLC_Create( void )
msg_Dbg( &libvlc, COPYRIGHT_MESSAGE ); msg_Dbg( &libvlc, COPYRIGHT_MESSAGE );
msg_Dbg( &libvlc, "libvlc was configured with %s", CONFIGURE_LINE ); msg_Dbg( &libvlc, "libvlc was configured with %s", CONFIGURE_LINE );
/* Set language now, otherwise the main module's strings will not /* The module bank will be initialized later */
* be translated. FIXME: this is a hack, the correct way is to have libvlc.p_module_bank = NULL;
* SetLanguage dynamically retranslate all module strings. */
SetLanguage( "" );
/* Initialize the module bank and load the configuration of the
* main module. We need to do this at this stage to be able to display
* a short help if required by the user. (short help == main module
* options) */
module_InitBank( &libvlc );
module_LoadMain( &libvlc );
libvlc.b_ready = VLC_TRUE; libvlc.b_ready = VLC_TRUE;
} }
...@@ -220,10 +211,11 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -220,10 +211,11 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
char * p_tmp; char * p_tmp;
char * psz_modules; char * psz_modules;
char * psz_parser; char * psz_parser;
vlc_bool_t b_exit; vlc_bool_t b_exit = VLC_FALSE;
vlc_t * p_vlc; vlc_t * p_vlc;
module_t *p_help_module; module_t *p_help_module;
playlist_t *p_playlist; playlist_t *p_playlist;
vlc_value_t lockval;
p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc;
...@@ -260,6 +252,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -260,6 +252,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
/* Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */ /* Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */
msg_Dbg( p_vlc, "translation test: code is \"%s\"", _("C") ); msg_Dbg( p_vlc, "translation test: code is \"%s\"", _("C") );
/* Initialize the module bank and load the configuration of the
* main module. We need to do this at this stage to be able to display
* a short help if required by the user. (short help == main module
* options) */
var_Create( &libvlc, "libvlc", VLC_VAR_MUTEX );
var_Get( &libvlc, "libvlc", &lockval );
vlc_mutex_lock( lockval.p_address );
if( libvlc.p_module_bank == NULL )
{
module_InitBank( &libvlc );
module_LoadMain( &libvlc );
}
vlc_mutex_unlock( lockval.p_address );
var_Destroy( &libvlc, "libvlc" );
/* Hack: insert the help module here */ /* Hack: insert the help module here */
p_help_module = vlc_object_create( p_vlc, VLC_OBJECT_MODULE ); p_help_module = vlc_object_create( p_vlc, VLC_OBJECT_MODULE );
if( p_help_module == NULL ) if( p_help_module == NULL )
...@@ -283,8 +290,6 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -283,8 +290,6 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
b_exit = VLC_FALSE;
/* Check for short help option */ /* Check for short help option */
if( config_GetInt( p_vlc, "help" ) ) if( config_GetInt( p_vlc, "help" ) )
{ {
......
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