]> git.ipfire.org Git - thirdparty/git.git/commit - gettext.h
i18n: add stub Q_() wrapper for ngettext
authorJonathan Nieder <jrnieder@gmail.com>
Thu, 10 Mar 2011 03:17:58 +0000 (21:17 -0600)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Mar 2011 07:50:57 +0000 (23:50 -0800)
commit0c9ea33b90f6ed73b9c9151c2cad9ce341d6778b
tree1c87ad15b622e506403830cdf609f19be643eb25
parent309552295af4b0f2ddd1af15d919441b1744523a
i18n: add stub Q_() wrapper for ngettext

The Q_ function translates a string representing some pharse with an
alternative plural form and uses the 'count' argument to choose which
form to return.  Use of Q_ solves the "%d noun(s)" problem in a way
that is portable to languages outside the Germanic and Romance
families.

In English, the semantics of Q_(sing, plur, count) are roughly
equivalent to

count == 1 ? _(sing) : _(plur)

while in other languages there can be more variants (count == 0; more
random-looking rules based on the historical pronunciation of the
number).  Behind the scenes, the singular form is used to look up a
family of translations and the plural form is ignored unless no
translation is available.

Define such a Q_ in gettext.h with the English semantics so C code can
start using it to mark phrases with a count for translation.

The name "Q_" is taken from subversion and stands for "quantity".
Many projects just use ngettext directly without a wrapper analogous
to _; we should not do so because git's gettext.h is meant not to
conflict with system headers that might include libintl.h.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gettext.h