Mercurial > mplayer.hg
annotate help/help_create.sh @ 27499:1dfad1b382fa
libass: fix type mismatch between size parameter and the way it's used
author | aurel |
---|---|
date | Fri, 05 Sep 2008 22:59:01 +0000 |
parents | 73921138ff30 |
children | eb42079ed5f7 |
rev | line source |
---|---|
26878
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
1 #!/bin/sh |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
2 # Create the messages header file from the master source file or a translation. |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
3 # Missing messages are filled in from the master message file and, if |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
4 # requested, character set conversion is performed. |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
5 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
6 MASTER=help/help_mp-en.h |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
7 TARGET=help_mp.h |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
8 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
9 TRANSLATION=$1 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
10 CHARSET=$2 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
11 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
12 missing_messages(){ |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
13 curr="" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
14 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
15 while read -r line; do |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
16 if echo "$line" | grep -q '^#define' ; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
17 curr=`printf "%s\n" "$line" | cut -d ' ' -f 2` |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
18 if grep -q "^#define $curr[ ]" "$TRANSLATION" ; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
19 curr="" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
20 fi |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
21 else |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
22 if [ -z "$line" ]; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
23 curr="" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
24 fi |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
25 fi |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
26 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
27 if [ -n "$curr" ]; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
28 printf "%s\n" "$line" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
29 fi |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
30 done |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
31 } |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
32 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
33 cat <<EOF > "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
34 /* WARNING! This is a generated file, do NOT edit. |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
35 * See the help/ subdirectory for the editable files. */ |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
36 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
37 #ifndef MPLAYER_HELP_MP_H |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
38 #define MPLAYER_HELP_MP_H |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
39 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
40 EOF |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
41 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
42 cat "$TRANSLATION" >> "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
43 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
44 cat <<EOF >> "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
45 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
46 /* untranslated messages from the English master file */ |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
47 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
48 EOF |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
49 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
50 if test "$MASTER" != "$TRANSLATION" ; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
51 missing_messages < "$MASTER" >> "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
52 fi |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
53 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
54 cat <<EOF >> "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
55 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
56 #endif /* MPLAYER_HELP_MP_H */ |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
57 EOF |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
58 |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
59 if test $CHARSET != UTF-8 ; then |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
60 iconv -f UTF-8 -t "$CHARSET" "$TARGET" > "${TARGET}.tmp" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
61 mv "${TARGET}.tmp" "$TARGET" |
73921138ff30
Move messages header file creation to a separate shell script.
diego
parents:
diff
changeset
|
62 fi |