~ubuntu-branches/ubuntu/trusty/gettext/trusty

« back to all changes in this revision

Viewing changes to misc/gettext-sh

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2002-04-10 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20020410131742-npf89tsaygdolprj
Tags: upstream-0.10.40
ImportĀ upstreamĀ versionĀ 0.10.40

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 1995 Free Software Foundation, Inc.
 
2
# Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2, or (at your option)
 
7
# any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
#
 
18
# Shell script excerpt to be inserted in shell scripts which are intended
 
19
# to be internationalized using GNU gettext.
 
20
#
 
21
# Precondition:
 
22
# ${PACKAGE-IDENT} is the name of one program of the package which
 
23
#               understands the --print-text-domain-dir option
 
24
# ${PACKAGE-NAME} is the name of the message domain the package uses
 
25
# ${PATH}       should list all directories which should be searched
 
26
#               for either `gettext' or ${PACKAGE-IDENT}.
 
27
#
 
28
# Postcondition:
 
29
# ${echo}       command to use like Un*x echo command which translates
 
30
#               its arguments when a translation is available.
 
31
#
 
32
save_IFS="${IFS}"
 
33
IFS="${IFS}:"
 
34
gettext_dir=FAILED
 
35
locale_dir=FAILED
 
36
for dir in ${PATH}
 
37
do
 
38
  if test "${gettext_dir}" = "FAILED" && test -x ${dir}/gettext \
 
39
     && (${dir}/gettext --version >/dev/null 2>&1)
 
40
  then
 
41
    set `${dir}/gettext --version 2>&1`
 
42
    if test "$3" = "GNU"
 
43
    then
 
44
      gettext_dir=${dir}
 
45
    fi
 
46
  fi
 
47
  if test "${locale_dir}" = "FAILED" && test -x ${dir}/${PACKAGE-IDENT} \
 
48
     && (${dir}/${PACKAGE-IDENT} --print-text-domain-dir >/dev/null 2>&1)
 
49
  then
 
50
    locale_dir=`${dir}/${PACKAGE-IDENT} --print-text-domain-dir`
 
51
  fi
 
52
done
 
53
IFS="${save_IFS}"
 
54
if test "${locale_dir}" = "FAILED" || test "${gettext_dir}" = "FAILED"
 
55
then
 
56
  echo=echo
 
57
else
 
58
  TEXTDOMAINDIR=${locale_dir}
 
59
  export TEXTDOMAINDIR
 
60
  TEXTDOMAIN=${PACKAGE-NAME}
 
61
  export TEXTDOMAIN
 
62
  echo="${gettext_dir}/gettext -s"
 
63
fi