]> git.pld-linux.org Git - packages/rpm-pld-macros.git/blobdiff - find-lang.sh
pass c/cxx/ld flags in rust macros; rel 4
[packages/rpm-pld-macros.git] / find-lang.sh
index 189cb62008add856e1be1807f08de47e439212de..3e13e14f0d1b69bef89cbe81c90c3ed56c7eb3b3 100755 (executable)
@@ -36,7 +36,7 @@
 #   * start support for KDE help files
 
 PROG=${0##*/}
-VERSION=1.38
+VERSION=1.40
 
 usage () {
 cat <<EOF
@@ -55,6 +55,7 @@ Additional options:
   --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
@@ -88,6 +89,7 @@ MATE='#'
 KDE='#'
 OMF='#'
 QM='#'
+DJANGO='#'
 MO=''
 OUTPUT=$NAME.lang
 ALL_NAME='#'
@@ -120,6 +122,11 @@ while test $# -gt 0; do
                QM=''
                shift
                ;;
+       --with-django)
+               echo >&2 "$PROG: Enabling with Django"
+               DJANGO=''
+               shift
+               ;;
        --without-mo)
                echo >&2 "$PROG: Disabling .mo files"
                MO='#'
@@ -158,7 +165,7 @@ echo '%defattr(644,root,root,755)' > $MO_NAME
 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
@@ -280,6 +287,7 @@ s:%lang(C) ::' >> $MO_NAME
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# OMF
 (
        if [ "$ALL_NAME" ]; then
                grep -F $NAME __find.dirs
@@ -292,6 +300,12 @@ s:%lang(C) ::' >> $MO_NAME
 /^[^%]/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
This page took 0.055116 seconds and 4 git commands to generate.