3 #########################
5 # Find all t3:id numbers in XLF language files
6 # and check their uniqueness.
8 # @author Markus Klein <klein.t3@reelworx.at>
11 ##########################
13 function join { local IFS
="$1"; shift; echo "$*"; }
15 find typo3
-name '*.xlf' > xlffiles.txt
16 sed -ne 's/.*t3:id="\([0-9]\+\)".*/\1/pgM' `cat xlffiles.txt` |
sort > xlfids.txt
17 uniq xlfids.txt
> uxlfids.txt
18 XLFCNT
=$
(cat xlffiles.txt |
wc -l)
19 XLFIDCNT
=$
(cat xlfids.txt |
wc -l)
20 UXLFIDCNT
=$
(cat uxlfids.txt |
wc -l)
21 DIFFIDS
=$
(join , $
(uniq -d xlfids.txt
))
22 MISSINGIDS
=$
(join , $
(grep -LP 't3:id' `cat xlffiles.txt`))
23 rm xlfids.txt uxlfids.txt xlffiles.txt
24 if [ $XLFCNT -ne $XLFIDCNT ];
26 echo "There is at least one XLF file missing a unique ID (t3:id)."
27 echo "Missing in: $MISSINGIDS"
30 if [ $XLFIDCNT -ne $UXLFIDCNT ];
32 echo "There is an XLF id that does not seem to be UNIQUE."
33 echo "Search for t3:id $DIFFIDS"