#!/bin/sh
# $Id$
-# findlang - automagically generate list of language specific files
+# find-lang - automagically generate list of language specific files
# for inclusion in an rpm spec file.
# This does assume that the *.mo files are under .../share/locale/...
# Run with no arguments gets a usage message.
--with-gnome find GNOME help files
--with-kde find KDE help files
--with-omf find OMF files
+ --with-qm find QT .qm files
--all-name match all package/domain names
--without-mo skip *.mo locale files
-o NAME output will be saved to NAME
GNOME='#'
KDE='#'
OMF='#'
+QM='#'
MO=''
OUTPUT=$NAME.lang
ALL_NAME='#'
NO_ALL_NAME=''
APPEND=''
-while test $# -gt 0 ; do
+while test $# -gt 0; do
case "$1" in
--with-gnome)
GNOME=''
OMF=''
shift
;;
+ --with-qm)
+ echo "$PROG: Enabling with Qt QM"
+ QM=''
+ shift
+ ;;
--without-mo)
echo "$PROG: Disabling .mo files"
MO='#'
MO_NAME=.$OUTPUT.tmp~
echo '%defattr(644,root,root,755)' > $MO_NAME
+# .mo
if [ ! -f __find.files ] || [ "$TOP_DIR" -nt __find.files ]; then
find $TOP_DIR -xtype f -name '*.mo' | xargs -r file -L | \
sed -e '
echo "$PROG: Using cached __find.files"
fi
+# .omf
if [ ! -f __omf.files ] || [ "$TOP_DIR" -nt __omf.files ]; then
find $TOP_DIR -type f -name '*.omf' | \
sed -e '
echo "$PROG: Using cached __omf.files"
fi
+# .qm
+if [ ! -f __qm.files ] || [ "$TOP_DIR" -nt __qm.files ]; then
+ find $TOP_DIR -type f -name '*.qm' | \
+ sed -e '
+ s:'"$TOP_DIR"'::' > __qm.files
+else
+ echo "$PROG: Using cached __qm.files"
+fi
+
+# .mo
(
if [ "$ALL_NAME" ]; then
fgrep $NAME __find.files
/^[^%]/d
s:%lang(C) ::' >> $MO_NAME
+# .omf
(
if [ "$ALL_NAME" ]; then
fgrep $NAME __omf.files
/^[^%]/d
s:%lang(C) ::' >> $MO_NAME
+# .qm
+(
+ if [ "$ALL_NAME" ]; then
+ fgrep $NAME __qm.files
+ else
+ cat __qm.files
+ fi
+) | sed '
+'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*\.qm$\):%lang(\2\4) \1\2\3\4\5:
+'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*/'"$NAME"'\.qm$\):%lang(\2\4) \1\2\3\4\5:
+/^[^%]/d
+s:%lang(C) ::' >> $MO_NAME
+
if [ ! -f __find.dirs ] || [ "$TOP_DIR" -nt __find.dirs ]; then
find $TOP_DIR -mindepth 1 -type d | sed 's:'"$TOP_DIR"'::' > __find.dirs
else
echo "$PROG: Using cached __find.dirs"
fi
+# gnome
(
if [ "$ALL_NAME" ]; then
fgrep $NAME __find.dirs
/^[^%]/d
s:%lang(C) ::' >> $MO_NAME
+# kde
(
if [ "$ALL_NAME" ]; then
fgrep $NAME __find.dirs