Skip to content

Commit e00cf07

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ba67aaf commit e00cf07

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
/git-sh-i18n
131131
/git-sh-i18n--envsubst
132132
/git-sh-setup
133+
/git-sh-i18n
133134
/git-shell
134135
/git-shortlog
135136
/git-show

Documentation/git-sh-i18n.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ SCRIPT_LIB += git-rebase--am
381381
SCRIPT_LIB += git-rebase--interactive
382382
SCRIPT_LIB += git-rebase--merge
383383
SCRIPT_LIB += git-sh-setup
384+
SCRIPT_LIB += git-sh-i18n
384385

385386
SCRIPT_PERL += git-add--interactive.perl
386387
SCRIPT_PERL += git-difftool.perl

git-sh-i18n.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

0 commit comments

Comments
 (0)