# * start support for KDE help files
PROG=${0##*/}
-VERSION=1.38
+VERSION=1.40
usage () {
cat <<EOF
--with-kde find KDE help files
--with-omf find OMF files
--with-qm find QT .qm files
+ --with-django find translations in Django project
--all-name match all package/domain names
--without-mo skip *.mo locale files
-o NAME output will be saved to NAME
KDE='#'
OMF='#'
QM='#'
+DJANGO='#'
MO=''
OUTPUT=$NAME.lang
ALL_NAME='#'
QM=''
shift
;;
+ --with-django)
+ echo >&2 "$PROG: Enabling with Django"
+ DJANGO=''
+ shift
+ ;;
--without-mo)
echo >&2 "$PROG: Disabling .mo files"
MO='#'
if [ ! -f __find.files ] || [ "$TOP_DIR" -nt __find.files ]; then
find $TOP_DIR -xtype f -name '*.mo' | xargs -r file -L | \
sed -e '
- /, 1 messages$/d
+ /, 1 message/d
s/:.*//
s:'"$TOP_DIR"'::' > __find.files
else
/^[^%]/d
s:%lang(C) ::' >> $MO_NAME
+# OMF
(
if [ "$ALL_NAME" ]; then
grep -F $NAME __find.dirs
/^[^%]/d
s:%lang(C) ::' >> $MO_NAME
+# Django
+cat __find.dirs | sed -r -e '
+'"$DJANGO"'s:(.+/share/python.+/locale/)([^/@]+)(@quot|@boldquot)?(@[^/]*)?$:%lang(\2\4) \1\2\3\4:
+/^[^%]/d
+s:%lang(C) ::' >> $MO_NAME
+
if [ "$(grep -Ev '(^%defattr|^$)' $MO_NAME | wc -l)" -le 0 ]; then
echo >&2 "$PROG: Error: international files not found for '$NAME'!"
exit 1