CMake: Allow configuring features as cache variables.
[xz/debian.git] / debug / translation.bash
blobdf4210dd7ca366e1f72ba50c1fb9825089bd0366
1 #!/bin/bash
3 ###############################################################################
5 # Script to check output of some translated messages
7 # This should be useful for translators to check that the translated strings
8 # look good. This doesn't make xz print all possible strings, but it should
9 # cover most of the cases where mistakes can easily happen.
11 # Give the path and filename of the xz executable as an argument. If no
12 # arguments are given, this script uses ../src/xz/xz (relative to the
13 # location of this script).
15 # You may want to pipe the output of this script to less -S to view the
16 # tables printed by xz --list on a 80-column terminal. On the other hand,
17 # viewing the other messages may be better without -S.
19 ###############################################################################
21 # Author: Lasse Collin
23 # This file has been put into the public domain.
24 # You can do whatever you want with this file.
26 ###############################################################################
28 set -e
30 # If an argument was given, use it to set the location of the xz executable.
31 unset XZ
32 if [ -n "$1" ]; then
33 XZ=$1
34 [ "x${XZ:0:1}" != "x/" ] && XZ="$PWD/$XZ"
37 # Locate top_srcdir and go there.
38 top_srcdir="$(cd -- "$(dirname -- "$0")" && cd .. && pwd)"
39 cd -- "$top_srcdir"
41 # If XZ wasn't already set, use the default location.
42 XZ=${XZ-"$PWD/src/xz/xz"}
43 if [ "$(type -t "$XZ" || true)" != "file" ]; then
44 echo "Give the location of the xz executable as an argument" \
45 "to this script."
46 exit 1
48 XZ=$(type -p -- "$XZ")
50 # Print the xz version and locale information.
51 echo "$XZ --version"
52 "$XZ" --version
53 echo
54 if [ -d .git ] && type git > /dev/null 2>&1; then
55 echo "Source code version in $PWD:"
56 git describe --abbrev=4
58 echo
59 locale
60 echo
62 # Make the test files directory the current directory.
63 cd tests/files
65 # Put xz in PATH so that argv[0] stays short.
66 PATH=${XZ%/*}:$PATH
68 # Some of the test commands are error messages and thus don't
69 # return successfully.
70 set +e
72 for CMD in \
73 "xz --foobarbaz" \
74 "xz --memlimit=123abcd" \
75 "xz --memlimit=40MiB -6 /dev/null" \
76 "xz --memlimit=0 --info-memory" \
77 "xz --memlimit-compress=1234MiB --memlimit-decompress=50MiB --info-memory" \
78 "xz --verbose --verbose /dev/null | cat" \
79 "xz --lzma2=foobarbaz" \
80 "xz --lzma2=foobarbaz=abcd" \
81 "xz --lzma2=mf=abcd" \
82 "xz --lzma2=preset=foobarbaz" \
83 "xz --lzma2=mf=bt4,nice=2" \
84 "xz --lzma2=nice=50000" \
85 "xz --help" \
86 "xz --long-help" \
87 "xz --list good-*lzma2*" \
88 "xz --list good-1-check*" \
89 "xz --list --verbose good-*lzma2*" \
90 "xz --list --verbose good-1-check*" \
91 "xz --list --verbose --verbose good-*lzma2*" \
92 "xz --list --verbose --verbose good-1-check*" \
93 "xz --list --verbose --verbose unsupported-check.xz"
95 echo "-----------------------------------------------------------"
96 echo
97 echo "\$ $CMD"
98 eval "$CMD"
99 echo
100 done 2>&1