Commit 267da9a6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

textdomain: relocate localedir on other OSes

Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent a2212b72
......@@ -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()
......
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