lang::catalog::export (public)
lang::catalog::export [ -package_key package_key ] \ [ -locales locales ]
Defined in packages/acs-lang/tcl/lang-catalog-procs.tcl
Exports I18N messages from the database to XML catalog files. By default exports messages for all enabled packages and all enabled locales on the system. Can be restricted to export only for a certain package and/or a list of locales.
- Switches:
- -package_key (optional)
- A key of a package to restrict the export to
- -locales (optional)
- A list of locales to restrict the export to
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_catalog_import_export
Source code: if { $package_key ne "" } { set package_key_list $package_key } else { set package_key_list [apm_enabled_packages] } foreach package_key $package_key_list { # We do not want to export acs-translations. This usually is a very bad idea as the object_ids are different from site to site. if {$package_key ne "acs-translations" } { # Loop over all locales that the package has messages in # and write a catalog file for each such locale db_foreach get_locales_for_package {} { # If we are only exporting certain locales and this is not one of them - continue if { [llength $locales] > 0 && $locale ni $locales } { continue } # Get messages and descriptions for the locale set messages_list [list] set descriptions_list [list] foreach message_tuple [all_messages_for_package_and_locale $package_key $locale] { lassign $message_tuple message_key message description lappend messages_list $message_key $message lappend descriptions_list $message_key $description } set catalog_file_path [get_catalog_file_path -package_key $package_key -locale $locale] export_to_file -descriptions_list $descriptions_list $catalog_file_path $messages_list # Messages exported to file are in sync with file db_dml update_sync_time {} } } }Generic XQL file: <fullquery name="lang::catalog::export.update_sync_time"> <querytext> update lang_messages set sync_time = current_timestamp where package_key = :package_key and locale = :locale </querytext> </fullquery> <fullquery name="lang::catalog::export.get_locales_for_package"> <querytext> select distinct locale from lang_messages where package_key = :package_key </querytext> </fullquery>packages/acs-lang/tcl/lang-catalog-procs.xql
PostgreSQL XQL file: packages/acs-lang/tcl/lang-catalog-procs-postgresql.xql
Oracle XQL file: packages/acs-lang/tcl/lang-catalog-procs-oracle.xql