{"thread":{"id":"30686","subject":"i18n: git-submodule message does not appear in git.pot","startedAt":"2012-06-02T11:35:51Z","lastAt":"2012-06-03T09:14:34Z","messageCount":4,"participants":["Vincent van Ravesteijn","Jiang Xin","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"192712","messageId":"4FC9FA97.7020908@lyx.org","threadId":"30686","inReplyTo":null,"subject":"i18n: git-submodule message does not appear in git.pot","fromName":"Vincent van Ravesteijn","fromEmail":"vfr@lyx.org","sentAt":"2012-06-02T11:35:51Z","receivedAt":"2012-06-02T11:35:51Z","isPatch":false,"sender":{"key":"vfr@lyx.org","avatar":"https://avatars.githubusercontent.com/u/687868?v=4"},"body":"In commit b9b9c22f [1] the string \"--cached cannot be used with --files\" \nis translated using an extra \"--\" between \"gettext\" and the string. This \ndoes not work because in the current git.pot file there is now:\n\n#: git-submodule.sh:713\nmsgid \"--\"\nmsgstr \"\"\n\nRemoving this exta \"--\" fixes the problem for me (GNU gettext v0.18.1)\n\n[1] b9b9c22f; Aevar Arnfjord Bjarmason; Sat May 21 2011; i18n: \ngit-submodule \"cached cannot be used\" message.\n\nKind regards,\n\nVincent\n"},{"id":"192739","messageId":"CANYiYbFrdNGpyTy3sVHPfm9R0bK-0S0Yh8BxxK4WkAbaaQRaNA@mail.gmail.com","threadId":"30686","inReplyTo":"4FC9FA97.7020908@lyx.org","subject":"Re: i18n: git-submodule message does not appear in git.pot","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2012-06-03T08:05:24Z","receivedAt":"2012-06-03T08:05:24Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2012/6/2 Vincent van Ravesteijn <vfr@lyx.org>:\n> In commit b9b9c22f [1] the string \"--cached cannot be used with --files\" is\n> translated using an extra \"--\" between \"gettext\" and the string. This does\n> not work because in the current git.pot file there is now:\n>\n> #: git-submodule.sh:713\n> msgid \"--\"\n> msgstr \"\"\n>\n\nIt's really a trouble.\n\n> Removing this exta \"--\" fixes the problem for me (GNU gettext v0.18.1)\n\nYou can not remove the extra '--', or gettext report error:\n\n    $ gettext \"--cached cannot be used with --files\"\n    gettext: unrecognized option '--cached cannot be used with --files'\n    Try `gettext --help' for more information.\n\nMy fix is call gettextln in here instead of gettext, and in the gettextln\nfunction, we pass a extra '--' option between gettext and the message id.\n\ndiff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\nindex 6a27f..dbabf 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -49,7 +49,7 @@ gnu)\n gettext_without_eval_gettext)\n \t# Solaris has a gettext(1) but no eval_gettext(1)\n \teval_gettext () {\n-\t\tgettext \"$1\" | (\n+\t\tgettext -- \"$1\" | (\n \t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n \t\t\tgit sh-i18n--envsubst \"$1\"\n \t\t)\n@@ -68,10 +68,20 @@ poison)\n \t;;\n *)\n \tgettext () {\n+\t\t# Bypass options, such as '--'.\n+\t\twhile test $# -gt 1\n+\t\tdo\n+\t\t\tshift\n+\t\tdone\n \t\tprintf \"%s\" \"$1\"\n \t}\n\n \teval_gettext () {\n+\t\t# Bypass options, such as '--'.\n+\t\twhile test $# -gt 1\n+\t\tdo\n+\t\t\tshift\n+\t\tdone\n \t\tprintf \"%s\" \"$1\" | (\n \t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n \t\t\tgit sh-i18n--envsubst \"$1\"\n@@ -82,7 +92,7 @@ esac\n\n # Git-specific wrapper functions\n gettextln () {\n-\tgettext \"$1\"\n+\tgettext -- \"$1\"\n \techo\n }\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 5c61a..bb9f6 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -710,7 +710,7 @@ cmd_summary() {\n \tif [ -n \"$files\" ]\n \tthen\n \t\ttest -n \"$cached\" &&\n-\t\tdie \"$(gettext -- \"--cached cannot be used with --files\")\"\n+\t\tdie \"$(gettextln \"--cached cannot be used with --files\")\"\n \t\tdiff_cmd=diff-files\n \t\thead=\n \tfi\n\n\n>> [1] b9b9c22f; Aevar Arnfjord Bjarmason; Sat May 21 2011; i18n: git-submodule\n> \"cached cannot be used\" message.\n\nIn commit b9b9c22f, Ævar described this problem clearly.\n\ncommit b9b9c22f6db3e3c089098ba04fbc885e2cb4f4dd\nAuthor: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nDate:   Sat May 21 18:44:03 2011 +0000\n\n    i18n: git-submodule \"cached cannot be used\" message\n\n    Gettextize the \"--cached cannot be used with --files\" message. Since\n    this message starts with \"--\" we have to pass \"--\" as the first\n    argument. This works with both GNU gettext 0.18.1 (as expected), and\n    the gettext(1) on Solaris 10.\n\n    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n\nAnd I found another issue: since we have two extra gettext wrapper\ngettextln and eval_gettextln, we should do somthing for xgettext in\nMakefile, or messages marked by gettextln and eval_gettextln would\nnot extract to 'po/git.pot'.\n\ndiff --git a/Makefile b/Makefile\nindex 4592f..dc3fd 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2333,7 +2333,8 @@ XGETTEXT_FLAGS = \\\n        --from-code=UTF-8\n XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n        --keyword=_ --keyword=N_ --keyword=\"Q_:1,2\"\n-XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell\n+XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n+       --keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(XDIFF_H) $(VCSSVN_H) $(MISC_H)\n LOCALIZED_SH := $(SCRIPT_SH)\n\n\n-- \nJiang Xin\n"},{"id":"192740","messageId":"m2r4tw3isb.fsf@linux-m68k.org","threadId":"30686","inReplyTo":"CANYiYbFrdNGpyTy3sVHPfm9R0bK-0S0Yh8BxxK4WkAbaaQRaNA@mail.gmail.com","subject":"Re: i18n: git-submodule message does not appear in git.pot","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-06-03T08:24:04Z","receivedAt":"2012-06-03T08:24:04Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n>  \tgettext () {\n> +\t\t# Bypass options, such as '--'.\n> +\t\twhile test $# -gt 1\n> +\t\tdo\n> +\t\t\tshift\n> +\t\tdone\n\n                shift $(($#-1))\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"192741","messageId":"CANYiYbH3p8Ti02CCri+ZxkcNgxzFqb-cqUchSXF_Py_OFOhQXg@mail.gmail.com","threadId":"30686","inReplyTo":"m2r4tw3isb.fsf@linux-m68k.org","subject":"Re: i18n: git-submodule message does not appear in git.pot","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2012-06-03T09:14:34Z","receivedAt":"2012-06-03T09:14:34Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2012/6/3 Andreas Schwab <schwab@linux-m68k.org>:\n>>       gettext () {\n>> +             # Bypass options, such as '--'.\n>> +             while test $# -gt 1\n>> +             do\n>> +                     shift\n>> +             done\n>\n>                shift $(($#-1))\n\nThat's better.\n\n-- \nJiang Xin\n"}]}