diff --git a/Makefile b/Makefile index 288cb2ec88..ef2da0e9b5 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,15 @@ all: subdirs localmenus date_today SOURCEUPDATES # Dive into subdirectories # ----------------------------------------------------------------------------- -SUBDIRS := $(shell find */* -name "Makefile" | xargs --max-args=1 dirname) +SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname) .PHONY: subdirs $(SUBDIRS) subdirs: $(SUBDIRS) +# run jobs for tools/ only after events/ and news/ have been completed +tools: | events news + $(SUBDIRS): $(MAKE) -k -C $@ || true @@ -54,11 +57,13 @@ d_year.en.xml: d_month.en.xml grep -q '$(YEAR)' $@ || echo '$(YEAR)' >$@ .PHONY: SOURCEUPDATES + +# finish jobs in subdirs before updating .sources +SOURCEUPDATES: | subdirs + SOURCEUPDATES: $(shell find ./ -name '*.sources') SOURCEREQS = $(shell ./build/source_globber.sh sourceglobs $@ |sed -r 's;$$;.??.xml;g') SOURCEDIRS = $(shell sed -rn 's;^(.*/)[^/]*:(\[\]|global)$$;\1;gp' $@) .SECONDEXPANSION: -%.sources: $$(SOURCEREQS) - touch $@ -%.sources: $$(SOURCEDIRS) +%.sources: $$(SOURCEDIRS) $$(SOURCEREQS) touch $@ diff --git a/tools/translation-log.sh b/tools/translation-log.sh index e7ce6ad2a4..9d0dc5aac9 100755 --- a/tools/translation-log.sh +++ b/tools/translation-log.sh @@ -36,6 +36,26 @@ infile=$1 outdir=$2 +# ----------------------------------------------------------------------------- +# Create a list of files +# ----------------------------------------------------------------------------- + +getlanguages(){ + for i in index.*.xhtml; + do + echo $i|cut -d . -f 2 + done|grep -xv en +} + +languages="$(getlanguages)" +> $infile +for lang in $(getlanguages) +do + find . -name '*.en.xhtml' -exec bash -c 'echo '$lang' $(dirname '{}'|xargs echo -n; echo -n /; basename {} .en.xhtml){.'$lang'.xhtml,.en.xhtml}' ';' + > ${infile}.$lang +done >> $infile + + # ----------------------------------------------------------------------------- # Create a separate file per language # ----------------------------------------------------------------------------- @@ -47,28 +67,22 @@ outdir=$2 # Performance seems to be much better if we do it in 2 separate runs. # Otherwise, we would have to run the grep for each line of the file. -# First run: missing translations -sort "${infile}" \ - | uniq \ - | sed --expression='s/\.\///g' \ - | grep --invert-match --file="tools/translation-ignore.txt" \ - | while read language wantfile havefile; do - if [ ! -f "${wantfile}" ]; then - date="$(date --iso-8601 --reference=${havefile})" - echo "missing ${date} ${wantfile} NONE ${havefile}" >> "${infile}.${language}" - fi -done - -# Second run: outdated translations +# First: missing translations +# Second: outdated translations sort "${infile}" \ | uniq \ | sed --expression='s/\.\///g' \ | while read language wantfile havefile; do - if [ -f "${wantfile}" ]; then - date1="$(date --iso-8601 --reference=${wantfile})" - date2="$(date --iso-8601 --reference=${havefile})" - echo "outdated ${date2} ${wantfile} ${date1} ${havefile}" >> "${infile}.${language}" - fi + havedate="$(date --reference=${havefile} +%s)" + if [ ! -f "${wantfile}" ]; then + echo "missing ${havedate} ${wantfile} NONE ${havefile}" >> "${infile}.${language}" + else + date="$(date --reference=${wantfile} +%s)" + if [[ $date -lt $havedate ]] + then + echo "outdated ${havedate} ${wantfile} ${date} ${havefile}" >> "${infile}.${language}" + fi + fi done @@ -139,14 +153,14 @@ for file in ${infile}.*; do echo " " echo " ${wantfile}" echo " " - echo " ${date1}" + echo " $( date +%d-%m-%Y -d @${date1} )" echo " " echo " [changelog]" echo " " echo " " echo " ${havefile}" echo " " - echo " ${date2}" + echo " $( date +%d-%m-%Y -d @${date2} )" echo " " echo " [changelog]" echo " " @@ -157,7 +171,7 @@ for file in ${infile}.*; do echo " " echo " ${havefile}" echo " " - echo " ${date2}" + echo " $( date +%d-%m-%Y -d @${date2} )" fi echo " " done @@ -209,14 +223,14 @@ grep --no-filename "^outdated" ${infile}.* \ echo " " echo " ${wantfile}" echo " " - echo " ${date1}" + echo " $( date +%d-%m-%Y -d @${date1})" echo " " echo " [changelog]" echo " " echo " " echo " ${havefile}" echo " " - echo " ${date2}" + echo " $( date +%d-%m-%Y -d @${date2})" echo " " echo " [changelog]" echo " "