Imported Upstream version 2.15.2
[platform/upstream/git.git] / git-sh-i18n.sh
index 6a27f68..1ef1889 100644 (file)
@@ -1,9 +1,8 @@
-#!/bin/sh
+# This shell library is Git's interface to gettext.sh. See po/README
+# for usage instructions.
 #
 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
 #
-# This is Git's interface to gettext.sh. See po/README for usage
-# instructions.
 
 # Export the TEXTDOMAIN* data that we need for Git
 TEXTDOMAIN=git
@@ -54,6 +53,13 @@ gettext_without_eval_gettext)
                        git sh-i18n--envsubst "$1"
                )
        }
+
+       eval_ngettext () {
+               ngettext "$1" "$2" "$3" | (
+                       export PATH $(git sh-i18n--envsubst --variables "$2");
+                       git sh-i18n--envsubst "$2"
+               )
+       }
        ;;
 poison)
        # Emit garbage so that tests that incorrectly rely on translatable
@@ -65,6 +71,10 @@ poison)
        eval_gettext () {
                printf "%s" "# GETTEXT POISON #"
        }
+
+       eval_ngettext () {
+               printf "%s" "# GETTEXT POISON #"
+       }
        ;;
 *)
        gettext () {
@@ -77,6 +87,13 @@ poison)
                        git sh-i18n--envsubst "$1"
                )
        }
+
+       eval_ngettext () {
+               (test "$3" = 1 && printf "%s" "$1" || printf "%s" "$2") | (
+                       export PATH $(git sh-i18n--envsubst --variables "$2");
+                       git sh-i18n--envsubst "$2"
+               )
+       }
        ;;
 esac