summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e7a85be)
raw | patch | inline | side by side (parent: e7a85be)
author | Jon Seymour <jon.seymour@gmail.com> | |
Sun, 7 Aug 2011 11:58:13 +0000 (21:58 +1000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 8 Aug 2011 19:02:16 +0000 (12:02 -0700) |
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>
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>
git-sh-i18n.sh | patch | blob | history |
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index 32ca59de82b6a26879128650bf40882f4ed16aa0..e672366f0c3db3b547233af146cd1bba275c0042 100644 (file)
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
printf "%s" "$1"
}
+ gettextln() {
+ printf "%s\n" "$1"
+ }
+
eval_gettext () {
printf "%s" "$1" | (
export PATH $(git sh-i18n--envsubst --variables "$1");
git sh-i18n--envsubst "$1"
)
}
+
+ eval_gettextln () {
+ printf "%s\n" "$1" | (
+ export PATH $(git sh-i18n--envsubst --variables "$1");
+ git sh-i18n--envsubst "$1"
+ )
+ }
else
gettext () {
printf "%s" "# GETTEXT POISON #"
}
+ gettextln () {
+ printf "%s\n" "# GETTEXT POISON #"
+ }
+
eval_gettext () {
printf "%s" "# GETTEXT POISON #"
}
+
+ eval_gettextln () {
+ printf "%s\n" "# GETTEXT POISON #"
+ }
fi