215 lines
6.1 KiB
Diff
215 lines
6.1 KiB
Diff
|
--- scripts/find-lang.sh.orig 2021-06-21 12:00:44.650612737 +0000
|
||
|
+++ scripts/find-lang.sh 2021-09-23 19:12:01.428275661 +0000
|
||
|
@@ -37,11 +37,11 @@ the top of the tree containing the files
|
||
|
PACKAGE_NAME is the %{name} of the package. This should also be
|
||
|
the basename of the .mo files. the output is written to
|
||
|
PACKAGE_NAME.lang unless \$3 is given in which case output is written
|
||
|
-to \$3.
|
||
|
+to \$3 (note that \$3 is appended to if given).
|
||
|
Additional options:
|
||
|
- --with-gnome find GNOME help files
|
||
|
+ --without-gnome do not find GNOME help files
|
||
|
--with-mate find MATE help files
|
||
|
- --with-kde find KDE help files
|
||
|
+ --without-kde do not find KDE help files
|
||
|
--with-qt find Qt translation files
|
||
|
--with-html find HTML files
|
||
|
--with-man find localized man pages
|
||
|
@@ -65,9 +65,9 @@ else NAMES[0]=$1
|
||
|
fi
|
||
|
shift
|
||
|
|
||
|
-GNOME=#
|
||
|
+GNOME=
|
||
|
MATE=#
|
||
|
-KDE=#
|
||
|
+KDE=
|
||
|
QT=#
|
||
|
MAN=#
|
||
|
HTML=#
|
||
|
@@ -89,6 +89,14 @@ while test $# -gt 0 ; do
|
||
|
KDE=
|
||
|
shift
|
||
|
;;
|
||
|
+ --without-gnome )
|
||
|
+ GNOME=#
|
||
|
+ shift
|
||
|
+ ;;
|
||
|
+ --without-kde )
|
||
|
+ KDE=#
|
||
|
+ shift
|
||
|
+ ;;
|
||
|
--with-qt )
|
||
|
QT=
|
||
|
shift
|
||
|
@@ -118,11 +126,13 @@ while test $# -gt 0 ; do
|
||
|
shift
|
||
|
;;
|
||
|
esac
|
||
|
-done
|
||
|
+done
|
||
|
|
||
|
-if [ -f $MO_NAME ]; then
|
||
|
- rm $MO_NAME
|
||
|
+if ! test -s $MO_NAME ; then
|
||
|
+ echo "%defattr (644, root, root, 755)" > $MO_NAME
|
||
|
fi
|
||
|
+MO_NAME_NEW=$MO_NAME.tmp.$$
|
||
|
+rm -f $MO_NAME_NEW
|
||
|
|
||
|
for NAME in ${NAMES[@]}; do
|
||
|
|
||
|
@@ -132,7 +142,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -140,27 +150,27 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
-'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir \1:
|
||
|
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir %doc \1:
|
||
|
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
|
||
|
-'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) \1\2:
|
||
|
-'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
|
||
|
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
|
||
|
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir %doc \1:
|
||
|
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
|
||
|
-'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) \1\2:
|
||
|
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
|
||
|
s:%lang(.*) .*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
|
||
|
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
|
||
|
s:^\([^%].*\)::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type f|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -168,7 +178,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
|
||
|
s:^[^%].*::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find $TOP_DIR -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -181,14 +191,14 @@ s:'"$TOP_DIR"'::
|
||
|
s:%lang(.*) .*/mate/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
'"$NO_ALL_NAME$MATE"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
|
||
|
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
|
||
|
s:^\([^%].*\)::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type f|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -196,7 +206,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
|
||
|
s:^[^%].*::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
KDE3_HTML=`kde-config --expandvars --install html 2>/dev/null`
|
||
|
if [ x"$KDE3_HTML" != x ] && [ -d "$TOP_DIR$KDE3_HTML" ]; then
|
||
|
@@ -208,7 +218,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
fi
|
||
|
|
||
|
KDE4_HTML=`kde4-config --expandvars --install html 2>/dev/null`
|
||
|
@@ -221,7 +231,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
fi
|
||
|
|
||
|
KF5_HTML=`kf5-config --expandvars --install html 2>/dev/null`
|
||
|
@@ -234,7 +244,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
fi
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
@@ -245,7 +255,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type f -o -type l|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -258,7 +268,7 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1:
|
||
|
s:^[^%].*::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type d|sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
@@ -266,19 +276,24 @@ s:'"$TOP_DIR"'::
|
||
|
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
find "$TOP_DIR" -type f -o -type l|sed -r 's/\.(bz2|gz|xz|lzma|Z)$//g' | sed '
|
||
|
s:'"$TOP_DIR"'::
|
||
|
'"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*:
|
||
|
s:^\([^%].*\)::
|
||
|
s:%lang(C) ::
|
||
|
-/^$/d' >> $MO_NAME
|
||
|
+/^$/d' >> $MO_NAME_NEW
|
||
|
|
||
|
done # for NAME in ${NAMES[@]}
|
||
|
|
||
|
-if ! grep -q / $MO_NAME; then
|
||
|
- echo "No translations found for ${NAME} in ${TOP_DIR}"
|
||
|
+if ! grep -q / $MO_NAME_NEW; then
|
||
|
+ echo "No translations found for ${NAMES[*]} in ${TOP_DIR}"
|
||
|
+ rm -f $MO_NAME_NEW
|
||
|
exit 1
|
||
|
fi
|
||
|
+
|
||
|
+sort -u $MO_NAME_NEW >> $MO_NAME
|
||
|
+rm -f $MO_NAME_NEW
|
||
|
+
|
||
|
exit 0
|