Commit 86c47f64 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Implement vlc_ngettext() to deal with plurals

parent 24d5309b
......@@ -918,7 +918,8 @@ VLC_API void * vlc_memcpy( void *, const void *, size_t );
/*****************************************************************************
* I18n stuff
*****************************************************************************/
VLC_API char * vlc_gettext( const char *msgid ) VLC_FORMAT_ARG(1);
VLC_API char *vlc_gettext( const char *msgid ) VLC_FORMAT_ARG(1);
VLC_API char *vlc_ngettext( const char *s, const char *p, unsigned long n ) VLC_FORMAT_ARG(1) VLC_FORMAT_ARG(2);
#define vlc_pgettext( ctx, id ) \
vlc_pgettext_aux( ctx "\004" id, id )
......
......@@ -10,7 +10,7 @@ subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --directory=.. --keyword=_ --keyword=N_ --keyword=_NS --keyword=_ANS --keyword=qtr --keyword=Q_ --language=C++ --keyword=vlc_pgettext:1c,2 --add-comments=xgettext: --from-code=UTF-8
XGETTEXT_OPTIONS = --directory=.. --keyword=_ --keyword=N_ --keyword=_NS --keyword=_ANS --keyword=qtr --keyword=Q_ --language=C++ --keyword=vlc_ngettext:1,2 --keyword=vlc_pgettext:1c,2 --add-comments=xgettext: --from-code=UTF-8
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
......
......@@ -537,6 +537,7 @@ vlc_GetActionId
vlc_getaddrinfo
vlc_getnameinfo
vlc_gettext
vlc_ngettext
vlc_hold
vlc_iconv
vlc_iconv_close
......
......@@ -97,10 +97,17 @@ int vlc_bindtextdomain (const char *domain)
char *vlc_gettext (const char *msgid)
{
#ifdef ENABLE_NLS
if (unlikely(!*msgid))
return (char *)"";
return dgettext (PACKAGE_NAME, msgid);
#else
if (likely(*msgid))
return dgettext (PACKAGE_NAME, msgid);
#endif
return (char *)msgid;
}
char *vlc_ngettext (const char *msgid, const char *plural, unsigned long n)
{
#ifdef ENABLE_NLS
if (likely(*msgid))
return dngettext (PACKAGE_NAME, msgid, plural, n);
#endif
return (char *)((n == 1) ? msgid : plural);
}
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