[vlc-commits] Initialize language from vlcrc before any language-dependent stuff

Rémi Denis-Courmont git at videolan.org
Sun Aug 21 13:39:01 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 21 14:19:24 2011 +0300| [545ad0659afde79e00ab2fa2ae50409b4ea1aa52] | committer: Rémi Denis-Courmont

Initialize language from vlcrc before any language-dependent stuff

 - command line help text
 - text domain binding

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=545ad0659afde79e00ab2fa2ae50409b4ea1aa52
---

 src/libvlc.c |   43 ++++++++++++++-----------------------------
 1 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index 5fd92cf..c4b4987 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -238,21 +238,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     int          i_ret = VLC_EEXIT;
     playlist_t  *p_playlist = NULL;
     char        *psz_val;
-#if defined( ENABLE_NLS ) \
-     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
-# if defined (WIN32) || defined (__APPLE__)
-    char *       psz_language;
-#endif
-#endif
 
     /* System specific initialization code */
     system_Init();
 
-    /*
-     * Support for gettext
-     */
-    vlc_bindtextdomain (PACKAGE_NAME);
-
     /* 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
@@ -308,6 +297,20 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     }
     priv->i_verbose = var_InheritInteger( p_libvlc, "verbose" );
 
+    /*
+     * Support for gettext
+     */
+#if defined( ENABLE_NLS ) \
+     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
+# if defined (WIN32) || defined (__APPLE__)
+    /* Check if the user specified a custom language */
+    char *lang = var_InheritString (p_libvlc, "language");
+    if (lang != NULL && strcmp (lang, "auto"))
+        SetLanguage (lang);
+    free (lang);
+# endif
+    vlc_bindtextdomain (PACKAGE_NAME);
+#endif
     /*xgettext: Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */
     msg_Dbg( p_libvlc, "translation test: code is \"%s\"", _("C") );
 
@@ -397,24 +400,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         return i_ret;
     }
 
-    /* Check for translation config option */
-#if defined( ENABLE_NLS ) \
-     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
-# if defined (WIN32) || defined (__APPLE__)
-    /* Check if the user specified a custom language */
-    psz_language = var_CreateGetNonEmptyString( p_libvlc, "language" );
-    if( psz_language && strcmp( psz_language, "auto" ) )
-    {
-        /* Reset the default domain */
-        SetLanguage( psz_language );
-
-        /* Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */
-        msg_Dbg( p_libvlc, "translation test: code is \"%s\"", _("C") );
-    }
-    free( psz_language );
-# endif
-#endif
-
     /* Check for help on modules */
     if( (p_tmp = var_InheritString( p_libvlc, "module" )) )
     {



More information about the vlc-commits mailing list