mirror of
https://github.com/mpv-player/mpv
synced 2024-12-21 06:14:32 +00:00
1bb19a7f48
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26910 b3059339-0415-0410-9bf9-f77b7e298cf2
63 lines
1.2 KiB
Bash
Executable File
63 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Create the messages header file from the master source file or a translation.
|
|
# Missing messages are filled in from the master message file and, if
|
|
# requested, character set conversion is performed.
|
|
|
|
MASTER=help/help_mp-en.h
|
|
TARGET=help_mp.h
|
|
|
|
TRANSLATION=$1
|
|
CHARSET=$2
|
|
|
|
missing_messages(){
|
|
curr=""
|
|
|
|
while read -r line; do
|
|
if echo "$line" | grep -q '^#define' ; then
|
|
curr=`printf "%s\n" "$line" | cut -d ' ' -f 2`
|
|
if grep -q "^#define $curr[ ]" "$TRANSLATION" ; then
|
|
curr=""
|
|
fi
|
|
else
|
|
if [ -z "$line" ]; then
|
|
curr=""
|
|
fi
|
|
fi
|
|
|
|
if [ -n "$curr" ]; then
|
|
printf "%s\n" "$line"
|
|
fi
|
|
done
|
|
}
|
|
|
|
cat <<EOF > "$TARGET"
|
|
/* WARNING! This is a generated file, do NOT edit.
|
|
* See the help/ subdirectory for the editable files. */
|
|
|
|
#ifndef MPLAYER_HELP_MP_H
|
|
#define MPLAYER_HELP_MP_H
|
|
|
|
EOF
|
|
|
|
cat "$TRANSLATION" >> "$TARGET"
|
|
|
|
cat <<EOF >> "$TARGET"
|
|
|
|
/* untranslated messages from the English master file */
|
|
|
|
EOF
|
|
|
|
if test "$MASTER" != "$TRANSLATION" ; then
|
|
missing_messages < "$MASTER" >> "$TARGET"
|
|
fi
|
|
|
|
cat <<EOF >> "$TARGET"
|
|
|
|
#endif /* MPLAYER_HELP_MP_H */
|
|
EOF
|
|
|
|
if test $CHARSET != UTF-8 ; then
|
|
iconv -f UTF-8 -t "$CHARSET" "$TARGET" > "${TARGET}.tmp"
|
|
mv "${TARGET}.tmp" "$TARGET"
|
|
fi
|