summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-messages
blob: 153c50696dd4cca3cc4cfad1ccda2e5686b2bcd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh -e
# $Id$
# Public domain.  Originally written 2009, Norbert Preining.
# 
# update the master messages.pot catalog and merge the result into the
# respective .po files.

# notes on transition to tcl/tk frontend

# Until the 2019 pretest stage we use a combined message catalog.


# Afterwards, we drop the perl input files and use tcl- rather than
# perl syntax for the temporary file with short descriptions.

# For tcl, all .po files are converted to tcl-compatible .msg
# files, using the msgfmt utility.

mydir=`cd \`dirname $0\` && /bin/pwd`
Master=`cd $mydir/../.. && /bin/pwd`
transdir=$Master/tlpkg/translations
tmpfile=$Master/tlpkg/translations/shortdesc.pl

cd $Master || exit 1
cp $transdir/messages.pot $transdir/messages.prev
sed -n 's/^shortdesc \(.*\)/__("\1");/p' \
    tlpkg/tlpsrc/scheme-*.tlpsrc \
    tlpkg/tlpsrc/collection-*.tlpsrc \
    >$tmpfile
#
cat install-tl >>$tmpfile
#
# rely on file extensions for source language identification
xgettext -o tlpkg/translations/messages.pot	\
	--copyright-holder="TeX Live Team"	\
	--msgid-bugs-address=tex-live@tug.org	\
	--package-version=2019			\
	--package-name="TeX Live"		\
        -k__ -k\$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2 -kN__ -k  \
       tlpkg/installer/tracked-install.pl \
       tlpkg/installer/install-menu-wizard.pl \
       tlpkg/installer/install-menu-perltk.pl \
       texmf-dist/scripts/texlive/tlmgrgui.pl \
       tlpkg/installer/install-tl-gui.tcl \
       tlpkg/tltcl/tltcl.tcl \
       texmf-dist/scripts/tlshell/tlshell.tcl \
       $tmpfile

cd $transdir || exit 1
failed=0

tmpa=`mktemp`
tmpb=`mktemp`
sed /POT-Creation-Date:/d <messages.prev >$tmpa
sed /POT-Creation-Date:/d <messages.pot >$tmpb

if cmp -s $tmpa $tmpb; then
  echo "$0: no msg changes."
  mv messages.prev messages.pot
else
  # we get here only if there have been changes.
  for i in *.po; do
    printf "$i "
    msgmerge --backup=none --no-fuzzy-matching --update $i messages.pot
    if test $? -ne 0; then
      echo "$0: msgmerge failed: $i" >&2
      failed=`expr $failed + 1`
    fi
  done
fi

rm -f $tmpfile $tmpa $tmpb messages.prev

exit $failed