www-el-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[www-el-commits] www-el GNUmakefile


From: Georgios Zarkadas
Subject: [www-el-commits] www-el GNUmakefile
Date: Thu, 30 Apr 2015 20:11:32 +0000

CVSROOT:        /cvsroot/www-el
Module name:    www-el
Changes by:     Georgios Zarkadas <gzarkadas>   15/04/30 20:11:32

Modified files:
        .              : GNUmakefile 

Log message:
        improved reporting

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/www-el/GNUmakefile?cvsroot=www-el&r1=1.28&r2=1.29

Patches:
Index: GNUmakefile
===================================================================
RCS file: /cvsroot/www-el/www-el/GNUmakefile,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- GNUmakefile 26 Apr 2015 22:56:15 -0000      1.28
+++ GNUmakefile 30 Apr 2015 20:11:31 -0000      1.29
@@ -123,6 +123,15 @@
   -e 's_\.pot$$_.$(TEAM).po_'`
 endef
 
+# All paths that store translations and templates in team / master
+# repositories. Note that sort removes duplicates, so path lists and
+# file lists are not the same.
+
+team_podirs := $(sort $(dir $(translations)))
+all_podirs := $(shell find $(wwwdir) -type d -name 'po')
+www_podirs := $(addprefix $(wwwdir),$(addsuffix /po,$(team_podirs)))
+todo_podirs := $(filter-out $(www_podirs),$(all_podirs))
+
 # All existing translations in team repository (leading ./ removed).
 
 translations := $(sort $(subst ./,,$(shell\
@@ -136,7 +145,8 @@
 miss_templates := $(filter-out $(exist_templates),$(templates))
 
 # All translations in master corresponding to existing translations.
-# Separate them to existing and missing (master) translations.
+# Separate them to existing and missing (master) translations.  The
+# later ones are probably new translations, not yet added to master.
 
 team_translations := $(foreach f,$(translations),$(call www_po_path,$(f)))
 exist_translations := $(wildcard $(team_translations))
@@ -147,18 +157,11 @@
 obsolete_translations := $(foreach\
  f,$(miss_templates),$(call team_po_path,$(f)))
 
-# All paths that store translations and templates in team / master
-# repositories. Note that sort removes duplicates, so path lists and
-# file lists are not the same.
+# Translations which are only to team repository, excluding those that
+# are obsolete. You should generally choose this set for publishing.
 
-# team po-dirs
-team_podirs := $(sort $(dir $(translations)))
-# all master po-dirs
-all_podirs := $(shell find $(wwwdir) -type d -name 'po')
-# master po-dirs with at least one translation
-www_podirs := $(addprefix $(wwwdir),$(addsuffix /po,$(team_podirs)))
-# master po-dirs without translations
-miss_podirs := $(filter-out $(www_podirs),$(all_podirs))
+private_translations := $(filter-out\
+ $(patsubst %.pot,%.$(TEAM).po,$(miss_templates)),$(miss_translations))
 
 # Retrieve all templates and team translations in the master repository.
 # Then compute various sets useful for reporting targets.
@@ -170,6 +173,8 @@
 
 unref_translations := $(filter-out $(team_translations),$(all_translations))
 
+# Templates that remain to be translated (no $(TEAM).po in team repository).
+
 todo_templates := $(filter-out $(exist_templates),$(all_templates))
 
 ## Messages and defines
@@ -257,23 +262,62 @@
 # Helper target to check which articles have to be updated.
 .PHONY: report
 report:
-       @echo "Translations in master repository that are *not*" \
-         "included at the team's repository:"
-       @for file in $(unref_translations); do \
+ifneq ($(strip $(unref_translations)),)
+       @echo "WARNING:" "Translations in master repository that are" \
+         "*not* included at the team's repository:"
+       @for file in $(unref_translations) ; do \
          printf "  %s\n" $$file ; \
        done
-       @echo "Obsolete translations (template removed at master repository):"
-       @for file in $(obsolete_translations); do \
+endif
+ifneq ($(strip $(obsolete_translations)),)
+       @echo "WARNING:" "Obsolete translations (template removed at" \
+         "master repository):"
+       @for file in $(obsolete_translations) ; do \
          printf "  %s\n" $$file ; \
        done
-       @export tmpfile=''  # protect previously set from rm
+endif
+ifneq ($(strip $(private_translations)),)
+       @echo "WARNING:" "Translations in team's repository that have" \
+         "*not* copied yet to master repository:"
+       @for file in $(private_translations) ; do \
+         printf "  %s\n" $(team_po_recipy) ; \
+       done
+endif
+       @echo "Pending Translations Status (T:translated, F:fuzzy," \
+         "U:untranlated, O:obsolete)"
+       @PAD="__________" ; \
+         printf "__%s__%s_%s_%s_%s___|__%s_|__%s_|__%s_|__%s_\n" \
+         "Filename" $$PAD $$PAD $$PAD $$PAD "T" "F" "U" "O"
        @for file in $(translations) ; do \
-         [ "$$tmpfile" = "" ] && tmpfile=`tempfile`; \
+         OBS=`$(MSGATTRIB) --obsolete $$file \
+           | awk 'BEGIN{RS="";FS="\n"} END{print (NR>0)?NR-1:NR}'`; \
          LC_ALL=C $(MSGFMT) --statistics -o /dev/null $$file 2>&1 \
-           | egrep '(fuzzy|untranslated)' >$$tmpfile; \
-         [ `wc --bytes <$$tmpfile` -eq 0 ] || printf '%-36s : %s\n' \
-            $$file "`sed 's/ [a-z]\+\([.,]\)/\1/g' $$tmpfile`" ; \
-         rm --force $$tmpfile; \
+           | sed -e 's/\(nt\)\?ranslated message\(s\)\?[.,]//g' \
+             -e 's/uzzy translation\(s\)\?[.,]//g' \
+             | awk -v fname=$$file -v obs=$$OBS ' \
+               BEGIN { \
+                 fmt="  %-56s:%4d %4d %4d %4d\n" \
+               } \
+               NF==6 { \
+                 printf(fmt,fname,$$1,$$3,$$5,obs) \
+               } \
+               NF==4 { \
+                 if ($$4=="f") { \
+                   v2=$$3; v3=0 \
+                 } else { \
+                   v2=0; v3=$$3 \
+                 } \
+                 printf(fmt,fname,$$1,v2,v3,obs) \
+               } \
+               NF==2 { \
+                 if ($$2=="t") { \
+                   v1=$$1; v2=0; v3=0 \
+                 } else { \
+                   v1=0; v2=0; v3=$$1 \
+                 } \
+                 printf(fmt,fname,v1,v2,v3,obs) \
+               }' \
+               | grep -vE ':[ 0-9]{4}( {4}0){3}' || true ; \
        done
 
 # Helper target to rewrap all PO files; avoids spurious diffs when



reply via email to

[Prev in Thread] Current Thread [Next in Thread]