git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers

Add a no-op wrapper library for Git's shell scripts. To split up the gettext series I'm first submitting patches to gettextize the source tree before I add any of the Makefile and Shell library changes needed to actually use them. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed May 14, 2011 at 13:47 UTC e00cf070a45351e4170b75e016597695d1962a87
4 files changed +61
.gitignore
+1
@@ -130,6 +130,7 @@
130 /git-sh-i18n
131 /git-sh-i18n--envsubst
132 /git-sh-setup
133 +/git-sh-i18n
134 /git-shell
135 /git-shortlog
136 /git-show
Documentation/git-sh-i18n.txt new
+42
@@ -0,0 +1,42 @@
1 +git-sh-i18n(1)
2 +==============
3 +
4 +NAME
5 +----
6 +git-sh-i18n - Git's i18n setup code for shell scripts
7 +
8 +SYNOPSIS
9 +--------
10 +'. "$(git --exec-path)/git-sh-i18n"'
11 +
12 +DESCRIPTION
13 +-----------
14 +
15 +This is not a command the end user would want to run. Ever.
16 +This documentation is meant for people who are studying the
17 +Porcelain-ish scripts and/or are writing new ones.
18 +
19 +The 'git sh-i18n scriptlet is designed to be sourced (using
20 +`.`) by Git's porcelain programs implemented in shell
21 +script. It provides wrappers for the GNU `gettext` and
22 +`eval_gettext` functions accessible through the `gettext.sh`
23 +script, and provides pass-through fallbacks on systems
24 +without GNU gettext.
25 +
26 +FUNCTIONS
27 +---------
28 +
29 +gettext::
30 + Currently a dummy fall-through function implemented as a wrapper
31 + around `printf(1)`. Will be replaced by a real gettext
32 + implementation in a later version.
33 +
34 +eval_gettext::
35 + Currently a dummy fall-through function implemented as a wrapper
36 + around `printf(1)` with variables expanded by the
37 + linkgit:git-sh-i18n--envsubst[1] helper. Will be replaced by a
38 + real gettext implementation in a later version.
39 +
40 +GIT
41 +---
42 +Part of the linkgit:git[1] suite
Makefile
+1
@@ -381,6 +381,7 @@ SCRIPT_LIB += git-rebase--am
381 SCRIPT_LIB += git-rebase--interactive
382 SCRIPT_LIB += git-rebase--merge
383 SCRIPT_LIB += git-sh-setup
384 +SCRIPT_LIB += git-sh-i18n
385
386 SCRIPT_PERL += git-add--interactive.perl
387 SCRIPT_PERL += git-difftool.perl
git-sh-i18n.sh new
+17
@@ -0,0 +1,17 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
4 +#
5 +# This is a skeleton no-op implementation of gettext for Git. It'll be
6 +# replaced by something that uses gettext.sh in a future patch series.
7 +
8 +gettext () {
9 + printf "%s" "$1"
10 +}
11 +
12 +eval_gettext () {
13 + printf "%s" "$1" | (
14 + export PATH $(git sh-i18n--envsubst --variables "$1");
15 + git sh-i18n--envsubst "$1"
16 + )
17 +}