[BUGFIX] Namespace prefix t3 for id on file is not defined 24/40724/5
authorXavier Perseguers <xavier@typo3.org>
Mon, 29 Jun 2015 15:11:32 +0000 (17:11 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 30 Jun 2015 07:42:40 +0000 (09:42 +0200)
Change-Id: If9cf05b0d6d98a6aa3e07dc50ab8c96750183613
Resolves: #67814
Releases: master
Reviewed-on: http://review.typo3.org/40724
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Build/Scripts/xlfcheck.sh
typo3/sysext/indexed_search/Resources/Private/Language/locallang_mod.xlf

index fd3c5ce..d7765d8 100755 (executable)
@@ -2,25 +2,54 @@
 
 #########################
 #
-# Find all t3:id numbers in XLF language files
+# Find all xmlns:t3 namespace definition and
+# t3:id numbers in XLF language files
 # and check their uniqueness.
 #
+# Use from within TYPO3 CMS source
+#
 # @author Markus Klein <klein.t3@reelworx.at>
 # @date 2014-11-14
 #
 ##########################
 
+XLF_FILES="xlffiles.txt"
+XLF_IDS="xlfids.txt"
+XLF_XMLNS="xlfxmlns.txt"
+
 function join { local IFS="$1"; shift; echo "$*"; }
 
-find typo3 -name '*.xlf' > xlffiles.txt
-sed -ne 's/.*t3:id="\([0-9]\+\)".*/\1/pgM' `cat xlffiles.txt` | sort > xlfids.txt
-uniq xlfids.txt > uxlfids.txt
+echo 'Collecting XLF files'
+find typo3/ -name '*.xlf' > $XLF_FILES
 XLFCNT=$(cat xlffiles.txt | wc -l)
-XLFIDCNT=$(cat xlfids.txt | wc -l)
-UXLFIDCNT=$(cat uxlfids.txt | wc -l)
-DIFFIDS=$(join , $(uniq -d xlfids.txt))
-MISSINGIDS=$(join , $(grep -LP 't3:id' `cat xlffiles.txt`))
-rm xlfids.txt uxlfids.txt xlffiles.txt
+
+# Check for xmlns
+echo 'Extracting xmlns:t3 information'
+sed -ne 's/.*\(xmlns:t3="http:\/\/typo3.org\/schemas\/xliff"\)/\1/pg' `cat $XLF_FILES` | sort > $XLF_XMLNS
+XLFXMLNSCNT=$(cat $XLF_XMLNS | wc -l)
+DIFFXMLNS=$(join , $(uniq -d $XLF_XMLNS))
+MISSINGXMLNS=$(join , $(grep -L 'xmlns:t3="http://typo3.org/schemas/xliff"' `cat $XLF_FILES`))
+
+# Checks for t3:id
+echo 'Extracting t3:id information'
+sed -ne 's/.*t3:id="\([0-9]\+\)".*/\1/pg' `cat $XLF_FILES` | sort > $XLF_IDS
+
+echo 'Processing ids'
+XLFIDCNT=$(cat $XLF_IDS | wc -l)
+UXLFIDCNT=$(uniq $XLF_IDS | wc -l)
+DIFFIDS=$(join , $(uniq -d $XLF_IDS))
+MISSINGIDS=$(join , $(grep -L 't3:id' `cat $XLF_FILES`))
+
+# Cleanup of temporary files
+rm $XLF_IDS $XLF_FILES $XLF_XMLNS
+
+if [ $XLFCNT -ne $XLFXMLNSCNT ];
+then
+       echo "There is at least one XLF file missing a xmlns for t3 (xmlns:t3)."
+       echo "Missing in: $MISSINGXMLNS"
+       exit 1
+fi
+
 if [ $XLFCNT -ne $XLFIDCNT ];
 then
        echo "There is at least one XLF file missing a unique ID (t3:id)."
@@ -33,4 +62,5 @@ then
        echo "Search for t3:id $DIFFIDS"
        exit 1
 fi
+
 exit 0
index f5baa7d..63225d6 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
+<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
        <file t3:id="1418239562" source-language="en" datatype="plaintext" original="messages" date="2014-09-19T16:43:33Z" product-name="indexed_search">
                <header/>
                <body>