Index: openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl,v diff -u -r1.60.2.3 -r1.60.2.4 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 10 Aug 2019 15:10:51 -0000 1.60.2.3 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 4 Sep 2019 15:32:46 -0000 1.60.2.4 @@ -144,15 +144,10 @@ @author Peter Marklund } { - ad_try { - glob [package_catalog_dir $package_key]/$package_key.${locale}.* - } on ok {r} { - set has_file_in_locale_p 1 - } on error {errorMsg} { - set has_file_in_locale_p 0 - } + set locale_files [glob -nocomplain -- \ + [package_catalog_dir $package_key]/$package_key.${locale}.*] - return $has_file_in_locale_p + return [expr {[llength $locale_files] > 0}] } ad_proc -private lang::catalog::get_catalog_file_path { Index: openacs-4/packages/acs-lang/tcl/test/acs-lang-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/test/acs-lang-test-procs.tcl,v diff -u -r1.28.2.6 -r1.28.2.7 --- openacs-4/packages/acs-lang/tcl/test/acs-lang-test-procs.tcl 16 Jun 2019 13:12:34 -0000 1.28.2.6 +++ openacs-4/packages/acs-lang/tcl/test/acs-lang-test-procs.tcl 4 Sep 2019 15:32:46 -0000 1.28.2.7 @@ -1149,6 +1149,29 @@ } } +aa_register_case \ + -procs { + lang::catalog::package_has_files_in_locale_p + } lang_package_has_files_in_locale_p { + Check that this private interface returns the right value when + a a catalog file for a package is available or not + } { + set locale en_US + foreach package_key {acs-lang acs-kernel acs-subsite} { + aa_true "We have message keys for '$package_key'->'$locale'" \ + [lang::catalog::package_has_files_in_locale_p $package_key $locale] + } + set bogus_package_key [ad_generate_random_string] + set bogus_locale [ad_generate_random_string] + aa_false "We don't have message keys for bogus '$bogus_package_key'->'$locale'" \ + [lang::catalog::package_has_files_in_locale_p $bogus_package_key $locale] + aa_false "We don't have message keys for bogus '$package_key'->'$bogus_locale'" \ + [lang::catalog::package_has_files_in_locale_p $package_key $bogus_locale] + aa_false "We don't have message keys for bogus '$bogus_package_key'->'$bogus_locale'" \ + [lang::catalog::package_has_files_in_locale_p $bogus_package_key $bogus_locale] + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4