[vlc-devel] [3.0 PATCH] textdomain: relocate localedir on other OSes

Konstantin Pavlov thresh at videolan.org
Sun Mar 11 19:54:55 CET 2018


On Wed, Mar 07, 2018 at 09:16:23PM +0200, RĂ©mi Denis-Courmont wrote:
> ---
>  src/modules/textdomain.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/src/modules/textdomain.c b/src/modules/textdomain.c
> index 1fd79f9e32..a164878a37 100644
> --- a/src/modules/textdomain.c
> +++ b/src/modules/textdomain.c
> @@ -27,30 +27,24 @@
>  
>  #ifdef ENABLE_NLS
>  # include <libintl.h>
> -# if defined (__APPLE__) || defined (_WIN32) || defined(__OS2__)
> -#  include <vlc_charset.h>
> -# endif
> +# include <vlc_charset.h>
>  #endif
>  
>  int vlc_bindtextdomain (const char *domain)
>  {
>  #if defined (ENABLE_NLS)
>      /* Specify where to find the locales for current domain */
> -# if !defined (__APPLE__) && !defined (_WIN32) && !defined(__OS2__)
> -    static const char path[] = LOCALEDIR;
> -
> -    if (bindtextdomain (domain, path) == NULL)
> -    {
> -        fprintf (stderr, "%s: text domain not found in %s\n", domain, path);
> -        return -1;
> -    }
> -# else
>      char *datadir = config_GetDataDir();
>      if (unlikely(datadir == NULL))
>          return -1;
>  
> +# if !defined (__APPLE__) && !defined (_WIN32) && !defined(__OS2__)
> +    const char *fmt = "%s/../locale";
> +# else
> +    const char *fmt = "%s"DIR_SEP"locale";
> +# endif
>      char *upath;
> -    int ret = asprintf (&upath, "%s" DIR_SEP "locale", datadir);
> +    int ret = asprintf(&upath, fmt, datadir);
>      free (datadir);
>      if (unlikely(ret == -1))
>          return -1;
> @@ -65,7 +59,6 @@ int vlc_bindtextdomain (const char *domain)
>      }
>      free (lpath);
>      free (upath);
> -# endif
>  
>      /* LibVLC wants all messages in UTF-8.
>       * Unfortunately, we cannot ask UTF-8 for strerror_r(), strsignal_r()
> -- 
> 2.16.2

This patch fixes the locales issues on snap-packaged VLC.

-- 
VideoLAN, Vice President
www.videolan.org
+7 926 165 45 31
@cryothresh


More information about the vlc-devel mailing list