Index: openacs-4/packages/acs-lang/tcl/acs-lang-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/acs-lang-init.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-lang/tcl/acs-lang-init.tcl 16 Oct 2003 10:50:12 -0000 1.7 +++ openacs-4/packages/acs-lang/tcl/acs-lang-init.tcl 16 Oct 2003 16:25:49 -0000 1.8 @@ -6,5 +6,5 @@ @cvs-id $Id$ } -# Load message catalog from the database to memory -lang::message::cache +# This is done in a scheduled proc so that it won't take up time at server startup. +ad_schedule_proc -once t 5 lang::catalog::import -initialize -cache 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.33 -r1.34 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 16 Oct 2003 15:17:01 -0000 1.33 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 16 Oct 2003 16:25:49 -0000 1.34 @@ -646,6 +646,7 @@ ad_proc -public lang::catalog::import { {-package_key {}} {-locales {}} + {-initialize:boolean} {-cache:boolean} } { Import messages from catalog files to the database. By default all messages @@ -654,6 +655,7 @@ @param package_key Restrict the import to the package with this key @param locales A list of locales to restrict the import to + @param initialize Only load messages from packages that have never before had any message imported @param cache Provide this switch if you want the proc to cache all the imported messages @author Peter Marklund @@ -664,7 +666,16 @@ set package_key_list [apm_enabled_packages] } + if { $initialize_p } { + set uninitialized_packages [db_list select_uninitialized {}] + } + foreach package_key $package_key_list { + if {$initialize_p && [lsearch -exact $uninitialized_packages $package_key] == -1} { + # The package is already initialized + continue + } + # Skip the package if it has no catalog files at all if { ![file exists [package_catalog_dir $package_key]] } { continue Index: openacs-4/packages/acs-lang/tcl/lang-catalog-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-catalog-procs.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.xql 16 Oct 2003 10:50:12 -0000 1.10 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.xql 16 Oct 2003 16:25:49 -0000 1.11 @@ -1,6 +1,21 @@ + + + select package_key + from apm_package_types + where exists (select 1 + from apm_package_versions + where package_key = apm_package_types.package_key + and installed_p = 't' + and enabled_p = 't') + and not exists (select 1 + from lang_message_keys + where package_key = apm_package_types.package_key) + + + select distinct locale