From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- bin/striplanguagetags.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 bin/striplanguagetags.sh (limited to 'bin/striplanguagetags.sh') diff --git a/bin/striplanguagetags.sh b/bin/striplanguagetags.sh new file mode 100755 index 000000000..0df4b0be5 --- /dev/null +++ b/bin/striplanguagetags.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# take a .zip containing a flat hierarchy of odf files and strip out the +# language and country tags in each of them and repack it all up +# should convert templates so that documents based on them use +# the default-document-language rather than the hardcoded lang-tag +# +# All a bit hacky, but it should work + +if [ -z "$CALLXSLTPROC" ]; then + echo "$0: \$CALLXSLTPROC not defined!" + echo "$0: Apparently we are not called from the build process, bailing out." + exit 1 +fi + +tempfoo=`basename $0` + +XSL=`mktemp /tmp/${tempfoo}.XXXXXX` +if [ $? -ne 0 ]; then + echo "$0: Can't create temp file, exiting..." + exit 1 +fi + +# On Windows, xsltproc is a non-Cygwin program, so we can't pass +# a Cygwin /tmp path to it +[ "$COM" == MSC ] && XSL=`cygpath -m -s $XSL` + +WRKDIR=`mktemp -d /tmp/${tempfoo}.XXXXXX` +if [ $? -ne 0 ]; then + echo "$0: Can't create temp dir, exiting..." + exit 1 +fi + +cat > $XSL << EOF + + + + + + + + + + + + + + + + + + + +EOF + +unzip -q $1 -d $WRKDIR +pushd $WRKDIR +for a in *; do + unzip -qc $a styles.xml > styles.tmp + eval "$CALLXSLTPROC -o styles.xml $XSL styles.tmp" + zip -qr $a styles.xml + rm styles.xml styles.tmp +done +popd +zip -qrj $1 $WRKDIR +rm -rf $WRKDIR +rm -f $XSL -- cgit v1.2.3