Re: [PATCH/RFC v3 0/7] Add internationalization support to Git
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:48:53
On Tue, Jun 1, 2010 at 23:39, Ævar Arnfjörð Bjarmason [off-list ref] wrote:
Here's version 3 of the patch series begun by Jeff Epler to make Git optionally translatable with GNU gettext. This version contains a lot of fixes to issues pointe out by Jakub Narebski, and other misc. [...] * The GIT_TEXTDOMAINDIR environment variable can be set to override where the C/Perl/Shell locale files are found. This is intended to be set by the test suite.
I made a silly error in my rebases and rewrote this commit out of my
tree. Instead of sending new commits here's the `git diff -w` below:
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index d67901c..379c9a1 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -219,7 +219,12 @@ if test $? -eq 0
then
TEXTDOMAIN=git
export TEXDTOMAIN
+ if [ -z "$GIT_TEXTDOMAINDIR" ]
+ then
TEXTDOMAINDIR="@@LOCALEDIR@@"
+ else
+ TEXTDOMAINDIR=$GIT_TEXTDOMAINDIR
+ fi
export TEXTDOMAINDIR
else
# Since GNU gettext.sh isn't available we'll have to define our
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 568fd3d..e19d99b 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -11,7 +11,7 @@ our @EXPORT_OK = @EXPORT;
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR = '++LOCALEDIR++';
+ our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
require POSIX;
POSIX->import(qw(setlocale));
diff --git a/t/t0200-gettext.sh b/t/t0200-gettext.sh
index a8f9edd..7c2a4cb 100755
--- a/t/t0200-gettext.sh
+++ b/t/t0200-gettext.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+export GIT_TEXTDOMAINDIR=`pwd`/../share/locale
+
test_description='Gettext support for Git'
. ./test-lib.sh
. ../../git-sh-setup
@@ -9,7 +11,8 @@ test_expect_success 'sanity: $TEXTDOMAIN is git' '
'
test_expect_success 'sanity: $TEXTDOMAINDIR exists' '
- test -d $TEXTDOMAINDIR
+ test -d $TEXTDOMAINDIR &&
+ test $TEXTDOMAINDIR = $GIT_TEXTDOMAINDIR
'
test_expect_success 'sanity: Icelandic locale was compiled' '
Along with another silly error:
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 379c9a1..da8c47f 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -218,7 +218,7 @@ esac
if test $? -eq 0
then
TEXTDOMAIN=git
- export TEXDTOMAIN
+ export TEXTDOMAIN
if [ -z "$GIT_TEXTDOMAINDIR" ]
then
TEXTDOMAINDIR="@@LOCALEDIR@@"
These fixes will be included (along with any other fixes) in my next
series. Which'll be submitted after soliciting more RFC
comments. Sorry everyone.