#!/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, sql, and tcl files in the package. # Also checks that the info in the catalog filename matches info in # its xml content (package_key, locale and charset). # # 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) ### Functions start get_catalog_keys() { file_name=$1 echo $(${script_path}/mygrep '" $en_US_file || echo "$0: $package_key - Warning: key $catalog_key in $file_name missing in $en_US_file" done done } check_catalog_keys_have_lookups() { # Check that all keys in the catalog file are either in tcl or adp or info files for catalog_key in `get_catalog_keys catalog/${package_key}.en_US.ISO-8859-1.xml` do find -iname '*.tcl' | xargs ${script_path}/mygrep \ "${package_key}\.$catalog_key" \ || \ find -regex '.*\.\(info\|adp\|sql\|tcl\)' | xargs ${script_path}/mygrep \ "${package_key}\.$catalog_key" \ || \ echo "$0: $package_key - Warning key $catalog_key in catalog file not found in any adp, info, sql, or tcl file" done } check_tcl_file_lookups_are_in_catalog() { # Check that all message lookups in tcl files have entries in the message catalog for tcl_message_key in $(find -iname '*.tcl'|xargs ${script_path}/mygrep \ "(?ms)\[_\s+(?:\[ad_conn locale\]\s+)?\"?${package_key}\.([a-zA-Z0-9_\-\.]+)\"?") do egrep -q "