* i18n: git-submodule message does not appear in git.pot
@ 2012-06-02 11:35 Vincent van Ravesteijn
2012-06-03 8:05 ` Jiang Xin
0 siblings, 1 reply; 4+ messages in thread
From: Vincent van Ravesteijn @ 2012-06-02 11:35 UTC (permalink / raw)
To: git, avarab, worldhello.net
In commit b9b9c22f [1] the string "--cached cannot be used with --files"
is translated using an extra "--" between "gettext" and the string. This
does not work because in the current git.pot file there is now:
#: git-submodule.sh:713
msgid "--"
msgstr ""
Removing this exta "--" fixes the problem for me (GNU gettext v0.18.1)
[1] b9b9c22f; Aevar Arnfjord Bjarmason; Sat May 21 2011; i18n:
git-submodule "cached cannot be used" message.
Kind regards,
Vincent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i18n: git-submodule message does not appear in git.pot
2012-06-02 11:35 i18n: git-submodule message does not appear in git.pot Vincent van Ravesteijn
@ 2012-06-03 8:05 ` Jiang Xin
2012-06-03 8:24 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Jiang Xin @ 2012-06-03 8:05 UTC (permalink / raw)
To: Vincent van Ravesteijn
Cc: git, Ævar Arnfjörð Bjarmason, Junio C Hamano
2012/6/2 Vincent van Ravesteijn <vfr@lyx.org>:
> In commit b9b9c22f [1] the string "--cached cannot be used with --files" is
> translated using an extra "--" between "gettext" and the string. This does
> not work because in the current git.pot file there is now:
>
> #: git-submodule.sh:713
> msgid "--"
> msgstr ""
>
It's really a trouble.
> Removing this exta "--" fixes the problem for me (GNU gettext v0.18.1)
You can not remove the extra '--', or gettext report error:
$ gettext "--cached cannot be used with --files"
gettext: unrecognized option '--cached cannot be used with --files'
Try `gettext --help' for more information.
My fix is call gettextln in here instead of gettext, and in the gettextln
function, we pass a extra '--' option between gettext and the message id.
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index 6a27f..dbabf 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -49,7 +49,7 @@ gnu)
gettext_without_eval_gettext)
# Solaris has a gettext(1) but no eval_gettext(1)
eval_gettext () {
- gettext "$1" | (
+ gettext -- "$1" | (
export PATH $(git sh-i18n--envsubst --variables "$1");
git sh-i18n--envsubst "$1"
)
@@ -68,10 +68,20 @@ poison)
;;
*)
gettext () {
+ # Bypass options, such as '--'.
+ while test $# -gt 1
+ do
+ shift
+ done
printf "%s" "$1"
}
eval_gettext () {
+ # Bypass options, such as '--'.
+ while test $# -gt 1
+ do
+ shift
+ done
printf "%s" "$1" | (
export PATH $(git sh-i18n--envsubst --variables "$1");
git sh-i18n--envsubst "$1"
@@ -82,7 +92,7 @@ esac
# Git-specific wrapper functions
gettextln () {
- gettext "$1"
+ gettext -- "$1"
echo
}
diff --git a/git-submodule.sh b/git-submodule.sh
index 5c61a..bb9f6 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -710,7 +710,7 @@ cmd_summary() {
if [ -n "$files" ]
then
test -n "$cached" &&
- die "$(gettext -- "--cached cannot be used with --files")"
+ die "$(gettextln "--cached cannot be used with --files")"
diff_cmd=diff-files
head=
fi
>> [1] b9b9c22f; Aevar Arnfjord Bjarmason; Sat May 21 2011; i18n: git-submodule
> "cached cannot be used" message.
In commit b9b9c22f, Ævar described this problem clearly.
commit b9b9c22f6db3e3c089098ba04fbc885e2cb4f4dd
Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date: Sat May 21 18:44:03 2011 +0000
i18n: git-submodule "cached cannot be used" message
Gettextize the "--cached cannot be used with --files" message. Since
this message starts with "--" we have to pass "--" as the first
argument. This works with both GNU gettext 0.18.1 (as expected), and
the gettext(1) on Solaris 10.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
And I found another issue: since we have two extra gettext wrapper
gettextln and eval_gettextln, we should do somthing for xgettext in
Makefile, or messages marked by gettextln and eval_gettextln would
not extract to 'po/git.pot'.
diff --git a/Makefile b/Makefile
index 4592f..dc3fd 100644
--- a/Makefile
+++ b/Makefile
@@ -2333,7 +2333,8 @@ XGETTEXT_FLAGS = \
--from-code=UTF-8
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
--keyword=_ --keyword=N_ --keyword="Q_:1,2"
-XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
+XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
+ --keyword=gettextln --keyword=eval_gettextln
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(XDIFF_H) $(VCSSVN_H) $(MISC_H)
LOCALIZED_SH := $(SCRIPT_SH)
--
Jiang Xin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i18n: git-submodule message does not appear in git.pot
2012-06-03 8:05 ` Jiang Xin
@ 2012-06-03 8:24 ` Andreas Schwab
2012-06-03 9:14 ` Jiang Xin
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2012-06-03 8:24 UTC (permalink / raw)
To: Jiang Xin
Cc: Vincent van Ravesteijn, git,
Ævar Arnfjörð Bjarmason, Junio C Hamano
Jiang Xin <worldhello.net@gmail.com> writes:
> gettext () {
> + # Bypass options, such as '--'.
> + while test $# -gt 1
> + do
> + shift
> + done
shift $(($#-1))
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i18n: git-submodule message does not appear in git.pot
2012-06-03 8:24 ` Andreas Schwab
@ 2012-06-03 9:14 ` Jiang Xin
0 siblings, 0 replies; 4+ messages in thread
From: Jiang Xin @ 2012-06-03 9:14 UTC (permalink / raw)
To: Andreas Schwab
Cc: Vincent van Ravesteijn, git, Ævar Arnfjörð,
Junio C Hamano
2012/6/3 Andreas Schwab <schwab@linux-m68k.org>:
>> gettext () {
>> + # Bypass options, such as '--'.
>> + while test $# -gt 1
>> + do
>> + shift
>> + done
>
> shift $(($#-1))
That's better.
--
Jiang Xin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-03 9:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-02 11:35 i18n: git-submodule message does not appear in git.pot Vincent van Ravesteijn
2012-06-03 8:05 ` Jiang Xin
2012-06-03 8:24 ` Andreas Schwab
2012-06-03 9:14 ` Jiang Xin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).