Index: openacs-4/packages/acs-lang/bin/check-catalog.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/bin/check-catalog.sh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-lang/bin/check-catalog.sh 24 Oct 2002 09:06:39 -0000 1.1 @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Check consistency of the en_US message catalog of the given package. +# Checks that the set of keys in the message catalog is identical to the +# set of keys in the adp, info, and tcl files in the package. +# The scripts assumes that message lookups in adp and info files are +# on the format #package_key.message_key#, and that message lookups +# in tcl files are always done with the underscore procedure. +# +# usage: check-catalog.sh package_key +# +# @author Peter Marklund (peter@collaboraid.biz) + +script_path=$(dirname $(which $0)) + +export package_key=$1 +package_path="${script_path}/../../${package_key}" + +cd $package_path + +# Check that all keys in the catalog file are either in tcl or adp or info files +for catalog_key in $(${script_path}/mygrep ' [files...] +# +# @author Peter Marklund (peter@collaboraid.biz) + +if ($ARGV[0] =~ /^-m/) { + shift; + # Undefine the record separator to read the whole file in one go + undef $/; + $pattern = shift; + # Let . match newline + if ($pattern !~ /^\w*\(\?\w*s\w*\)/) { + $pattern = "(?s)$pattern"; + } +} else { + $pattern = shift; +} + +# Take input from STDIN or from files +my $have_match = 0; +while ($line = <>) { + if ($line =~ /$pattern/) { + if (defined($1)) { + print STDOUT "$1\n"; + } + + $have_match = 1; + } +} + +$have_match ? exit 0 : exit 1;