Às 19:27 de 23-05-2016, Vasco Almeida escreveu:
> Add eval_ngettext dummy function to be called by tests when running
> under GETTEXT_POISON. Otherwise, tests would fail under gettext poison
> because that function could not be found.
> 
> [...]
>
> diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
> index e6c3116..c14c303 100644
> --- a/git-sh-i18n.sh
> +++ b/git-sh-i18n.sh
> @@ -64,6 +64,10 @@ poison)
>       eval_gettext () {
>               printf "%s" "# GETTEXT POISON #"
>       }
> +
> +     eval_ngettext () {
> +             printf "%s" "# GETTEXT POISON #"
> +     }
>       ;;
>  *)
>       gettext () {

Perhaps, I should have added more eval_ngettext dummy functions in other
places in this file. Not exclusively to the poison part of the switch case.

I see Solaris is a special case (gettext_without_eval_gettext), does it
have eval_ngettext? Probably not, since it does not have
eval_gettext(1). In such case, we would call ngettext like it's done for
eval_gettext, assuming Solaris has ngettext.

The relevant part of git-sh-i18n.sh updated with this patch:

# ... and then follow that decision.
case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
gnu)
        # Use libintl's gettext.sh, or fall back to English if we can't.
        . gettext.sh
        ;;
gettext_without_eval_gettext)
        # Solaris has a gettext(1) but no eval_gettext(1)
        eval_gettext () {
                gettext "$1" | (
                        export PATH $(git sh-i18n--envsubst --variables "$1");
                        git sh-i18n--envsubst "$1"
                )
        }
        ;;
poison)
        # Emit garbage so that tests that incorrectly rely on translatable
        # strings will fail.
        gettext () {
                printf "%s" "# GETTEXT POISON #"
        }

        eval_gettext () {
                printf "%s" "# GETTEXT POISON #"
        }

        eval_ngettext () {
                printf "%s" "# GETTEXT POISON #"
        }
        ;;
*)
        gettext () {
                printf "%s" "$1"
        }

        eval_gettext () {
                printf "%s" "$1" | (
                        export PATH $(git sh-i18n--envsubst --variables "$1");
                        git sh-i18n--envsubst "$1"
                )
        }
        ;;
esac
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to