Commit 5f2dd73e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Provide vlc_gettext on all platforms

This avoids having to link a few plugins with libintl on platforms where
it's not built-in libc. This also factors the internal use of
dgettext("vlc", ...).
parent a6ab35ee
......@@ -889,8 +889,9 @@ VLC_EXPORT( void *, vlc_memset, ( void *, int, size_t ) );
* I18n stuff
*****************************************************************************/
#ifdef WIN32
VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#endif
VLC_EXPORT( char *, vlc_gettext, ( const char *msgid ) );
/*****************************************************************************
* libvlc features
......
......@@ -163,16 +163,12 @@ typedef void *locale_t;
#endif
/* libintl support */
#define _(str) dgettext (PACKAGE_NAME, str)
#define _(str) vlc_gettext (str)
#if defined (ENABLE_NLS)
# include <libintl.h>
# ifdef WIN32
# undef _
# define _(str) vlc_dgettext (PACKAGE_NAME, str)
# endif
#else
# define dgettext(dom, str) (str)
# define dgettext(dom, str) ((char *)(str))
#endif
#define N_(str) gettext_noop (str)
......
......@@ -607,21 +607,25 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
}
#endif
#ifdef WIN32
/*****************************************************************************
* dgettext: gettext for plugins.
*****************************************************************************/
#if defined (WIN32)
/**
* gettext callbacks for plugins.
* LibVLC links libintl statically on Windows.
*/
char *vlc_dgettext( const char *package, const char *msgid )
{
#if defined( ENABLE_NLS ) \
&& ( defined(HAVE_GETTEXT) || defined(HAVE_INCLUDED_GETTEXT) )
return dgettext( package, msgid );
#else
return (char *)msgid;
#endif
}
#endif
/**
* In-tree plugins share their gettext domain with LibVLC.
*/
char *vlc_gettext( const char *msgid )
{
return dgettext( PACKAGE_NAME, msgid );
}
/*****************************************************************************
* count_utf8_string: returns the number of characters in the string.
*****************************************************************************/
......
......@@ -404,6 +404,7 @@ vlc_gai_strerror
vlc_getaddrinfo
vlc_getenv
vlc_getnameinfo
vlc_gettext
vlc_iconv
vlc_iconv_close
vlc_iconv_open
......
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