# eval_gettextln does not work correctly?

4 messages from 2012-08-22 to 2012-08-22. Participants: Nguyen Thai Ngoc Duy, Jonathan Nieder, Nguyễn Thái Ngọc Duy, Junio C Hamano.
Thread: https://gitlist.dev/t/31316

## Nguyen Thai Ngoc Duy, 2012-08-22 14:10

Subject: eval_gettextln does not work correctly?
Message-ID: <CACsJy8C4pcAj48sBOATZY21AgE5TdWysY6x-S6Xw8mWfQ9F4CA@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8C4pcAj48sBOATZY21AgE5TdWysY6x-S6Xw8mWfQ9F4CA%40mail.gmail.com

```
I was running git with preloadable_libintl.so to catch unmarked
strings and I saw this

domain "git"
msgid "The copy of the patch that failed is found in:\n"
"   /home/pclouds/w/git/t/trash
directory.t4254-am-corrupt/.git/rebase-apply/patch"
msgstr ""

which means git performed a lookup on that string. It is from git-am.sh:

eval_gettextln "The copy of the patch that failed is found in:
   $dotest/patch"

I suppose it should look up "...  $dotest/patch" instead (i.e. no
variable expansion). Something is wrong here? I have a few local
patches on top of master, but none of them touches gettext shell
functions.
-- 
Duy

```

## Jonathan Nieder, 2012-08-22 14:17

Subject: Re: eval_gettextln does not work correctly?
Message-ID: <20120822141726.GA674@mannheim-rule.local>
URL: https://gitlist.dev/e/20120822141726.GA674%40mannheim-rule.local
In-Reply-To: <CACsJy8C4pcAj48sBOATZY21AgE5TdWysY6x-S6Xw8mWfQ9F4CA@mail.gmail.com>

```
Nguyen Thai Ngoc Duy wrote:

> which means git performed a lookup on that string. It is from git-am.sh:
>
> eval_gettextln "The copy of the patch that failed is found in:
>    $dotest/patch"

Good catch.  It should use single-quotes.

```

## Nguyễn Thái Ngọc Duy, 2012-08-22 14:48

Subject: [PATCH] am: quote string for translation before passing to eval_gettextln
Message-ID: <1345646883-18746-1-git-send-email-pclouds@gmail.com>
URL: https://gitlist.dev/e/1345646883-18746-1-git-send-email-pclouds%40gmail.com
In-Reply-To: <20120822141726.GA674@mannheim-rule.local>

```
If it's not quoted, the string is expanded before it gets looked up in
gettext database and obviously nothing is returned.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 On Wed, Aug 22, 2012 at 9:17 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
 > Nguyen Thai Ngoc Duy wrote:
 >
 >> which means git performed a lookup on that string. It is from git-am.sh:
 >>
 >> eval_gettextln "The copy of the patch that failed is found in:
 >>    $dotest/patch"
 >
 > Good catch.  It should use single-quotes.

 Yep. Verified. Also checked that no other places have this problem.
 xgettext probably detects this too. Without this patch it does not
 collect this string. With this patch, it does.

 git-am.sh | 4 ++--
 1 tập tin đã bị thay đổi, 2 được thêm vào(+), 2 bị xóa(-)

diff --git a/git-am.sh b/git-am.sh
index bd9620c..c682d34 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -855,8 +855,8 @@ did you forget to use 'git add'?"
 		eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
 		if test "$(git config --bool advice.amworkdir)" != false
 		then
-			eval_gettextln "The copy of the patch that failed is found in:
-   $dotest/patch"
+			eval_gettextln 'The copy of the patch that failed is found in:
+   $dotest/patch'
 		fi
 		stop_here_user_resolve $this
 	fi
-- 
1.7.12.rc2.18.g61b472e

```

## Junio C Hamano, 2012-08-22 19:38

Subject: Re: [PATCH] am: quote string for translation before passing to eval_gettextln
Message-ID: <7vipca7m4q.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vipca7m4q.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1345646883-18746-1-git-send-email-pclouds@gmail.com>

```
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:

> If it's not quoted, the string is expanded before it gets looked up in
> gettext database and obviously nothing is returned.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> ...
>  Yep. Verified. Also checked that no other places have this problem.
>  xgettext probably detects this too. Without this patch it does not
>  collect this string. With this patch, it does.

Will queue; thanks.

>
>  git-am.sh | 4 ++--
>  1 tập tin đã bị thay đổi, 2 được thêm vào(+), 2 bị xóa(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index bd9620c..c682d34 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -855,8 +855,8 @@ did you forget to use 'git add'?"
>  		eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
>  		if test "$(git config --bool advice.amworkdir)" != false
>  		then
> -			eval_gettextln "The copy of the patch that failed is found in:
> -   $dotest/patch"
> +			eval_gettextln 'The copy of the patch that failed is found in:
> +   $dotest/patch'
>  		fi
>  		stop_here_user_resolve $this
>  	fi

```
