lang::message::edit (private)
lang::message::edit [ -update_sync ] package_key message_key locale \ edit_array_list
Defined in packages/acs-lang/tcl/lang-message-procs.tcl
Edit properties (meta data) of a language catalog message, but not the message text itself. To update or add message catalog text, use the lang::message::register proc. Implementation note: some of the dynamic sql edit code of this proc was copied from the auth::authority::edit proc and should probably be broken out into a general API.
- Switches:
- -update_sync (optional, boolean)
- If this switch is provided the sync_time of the message will be updated to current time. If not provided no update to sync_time will be made. If sync_time is contained in the edit_array_list then that value will override the update_sync flag.
- Parameters:
- package_key (required)
- The package_key of the message to update
- message_key (required)
- The message_key of the message to update
- locale (required)
- The locale of the message to update
- edit_array_list (required)
- An array list holding names of columns and the values to set them to. Valid keys in this array list are any column names in the lang_messages table.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- upgrade
Source code: array set edit_array $edit_array_list if { [info exists edit_array(message)] } { error "The proc lang::message::edit was invoked with the message attribute in the edit array. To edit the message text of a message use the lang::message::register proc instead" } # # Deleting/undeleting? # if { [info exists edit_array(deleted_p)] } { set edit_array(deleted_p) [db_boolean [string is true -strict $edit_array(deleted_p)]] if { [string is true -strict $edit_array(deleted_p)] } { set delete_p t set delete_comment "deleted" } else { set delete_p f set delete_comment "undeleted" } # # If we are deleting/undeleting we need to preserve the old message in the audit log # # Peter TODO: should these attributes be cached? # lang::message::get -package_key $package_key -message_key $message_key -locale $locale -array old_message_array lang::audit::changed_message $old_message_array(message) $package_key $message_key $locale $delete_comment $old_message_array(deleted_p) $old_message_array(sync_time) $old_message_array(conflict_p) $old_message_array(upgrade_status) # # If we are deleting an en_US message we need to mark the message as deleted in all locales # if {$delete_p && $locale eq "en_US"} { set message_locales [db_list all_message_locales { select locale from lang_messages where package_key = :package_key and message_key = :message_key and locale <> 'en_US' }] foreach message_locale $message_locales { lang::message::delete -package_key $package_key -message_key $message_key -locale $message_locale } } } set set_clauses [list] foreach name [array names edit_array] { lappend set_clauses "$name = :$name" set $name $edit_array($name) } if { $update_sync_p && ![info exists edit_array(sync_time)] } { lappend set_clauses {sync_time = current_timestamp} } if { [llength $set_clauses] > 0 } { set sql " update lang_messages set [join $set_clauses ", "] where package_key = :package_key and message_key = :message_key and locale = :locale " db_dml edit_message $sql }Generic XQL file: packages/acs-lang/tcl/lang-message-procs.xql
PostgreSQL XQL file: packages/acs-lang/tcl/lang-message-procs-postgresql.xql
Oracle XQL file: packages/acs-lang/tcl/lang-message-procs-oracle.xql