[vlc-devel] commit: Provide vlc_gettext on all platforms ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu May 22 21:44:41 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu May 22 22:46:11 2008 +0300| [5f2dd73ec8e68b0191d251ec80dc220b70624719]
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", ...).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f2dd73ec8e68b0191d251ec80dc220b70624719
---
include/vlc_common.h | 3 ++-
include/vlc_fixups.h | 8 ++------
src/extras/libc.c | 22 +++++++++++++---------
src/libvlccore.sym | 1 +
4 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 7f53265..37c46a2 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -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
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index f49a426..0bb3566 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -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)
diff --git a/src/extras/libc.c b/src/extras/libc.c
index 9d554ca..38c930c 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -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.
*****************************************************************************/
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 222f008..3499307 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -404,6 +404,7 @@ vlc_gai_strerror
vlc_getaddrinfo
vlc_getenv
vlc_getnameinfo
+vlc_gettext
vlc_iconv
vlc_iconv_close
vlc_iconv_open
More information about the vlc-devel
mailing list