Commit graph

3 commits

Author SHA1 Message Date
Jon Seymour 3da5c54340 gettext: add gettextln, eval_gettextln to encode common idiom
Currently, if you want to use gettext or eval_gettext to format a message
you may have to add a separate echo statement and a surrounding subshell
in order to interpolate the required trailing new line.

This patch introduces two new helper functions, gettextln and eval_gettextln
which append a trailing newline to the gettext output.

This allows constructions of the form:

	if test -s "$GIT_DIR/BISECT_START"
	then
		(
			gettext "You need to give me at least one good and one bad revisions.
(You can use \"git bisect bad\" and \"git bisect good\" for that.)" &&
			echo
		) >&2
	else
	...

to be expressed more concisely as:

	if test -s "$GIT_DIR/BISECT_START"
	then
		gettextln "You need to give me at least one good and one bad revisions.
(You can use \"git bisect bad\" and \"git bisect good\" for that.)" >&2
	else
	...

Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-08 12:02:16 -07:00
Ævar Arnfjörð Bjarmason 64a4295147 git-sh-i18n.sh: add GIT_GETTEXT_POISON support
Change git-sh-i18n.sh to support the GIT_GETTEXT_POISON environment
variable like gettext.c does, this ensures that tests that use
git-sh-i18n.sh will fail under GETTEXT_POISON=YesPlease if they rely
on Git's C locale messages without declaring that they do.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00
Ævar Arnfjörð Bjarmason e00cf070a4 git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
Add a no-op wrapper library for Git's shell scripts. To split up the
gettext series I'm first submitting patches to gettextize the source
tree before I add any of the Makefile and Shell library changes needed
to actually use them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00