Index: openacs-4/packages/acs-lang/acs-lang.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/acs-lang.info,v diff -u -r1.47 -r1.48 --- openacs-4/packages/acs-lang/acs-lang.info 14 May 2007 20:30:21 -0000 1.47 +++ openacs-4/packages/acs-lang/acs-lang.info 13 Aug 2007 11:13:45 -0000 1.48 @@ -7,7 +7,7 @@ t t - + Peter Marklund OpenACS Internationalization Support. 2007-04-22 @@ -17,16 +17,21 @@ 3 Internationalization and localization support routines and admin UI for manipulating Locales, request processor hooks, templating, accessing and managing the message catalog, and -locale-specific formatting functions for localizing dates, times, monetary amounts etc. +locale-specific formatting functions for localizing dates, times, monetary amounts etc. +package changed by Quest so that messages in database are not overwritten by default. +Also fixed message::register, so that no messages with wrong package key can be added. +Added the possibility to unregister messages. + - + + 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.42 -r1.43 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 10 Jan 2007 21:22:04 -0000 1.42 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 13 Aug 2007 11:13:45 -0000 1.43 @@ -545,6 +545,7 @@ } ad_proc -private lang::catalog::import_from_file { + {-keeplocal_p ""} file_path } {

@@ -561,6 +562,8 @@ with what's in the database).

+ @param keeplocal Overwrites the package parameter to keep local changes regardless what happened in the + catalog file. @param file_path The absolute path of the XML file to import messages from. The path must be on valid format, see apm_is_catalog_file @@ -606,7 +609,8 @@ array set message_count [lang::catalog::import_messages \ -file_messages_list [array get messages_array] \ -package_key $package_key \ - -locale $locale] + -locale $locale \ + -keeplocal_p $keeplocal_p] # Register descriptions foreach message_key $messages_array_names { @@ -630,6 +634,7 @@ {-file_messages_list:required} {-package_key:required} {-locale:required} + {-keeplocal_p ""} } {

Import a given set of messages from a catalog file to the database @@ -706,11 +711,22 @@ 14. All different. upgrade_action=update, conflict_p=t +

+ Introduction of a package parameter 'KeepLocalTranslations'. + If this parameter is set then we change the behaviour of the + following cases to upgrade_action=none: 4, 6, 7, 8, 12, 14. + A conflict is raised in this case. + + The parameter -keeplocal_p overwrites this package paramter if set. +

+ @param file_messages_list An array list with message keys as keys and the message of those keys as values, i.e. (key, value, key, value, ...) @param package_key The package_key for the messages. + + @param keeplocal_p Overwrites the package parameter if set @param locale The locale of the messages. @@ -721,6 +737,18 @@ @author Peter Marklund @author Lars Pind } { + + # package parameter or argument -keeplocal_p + if {![string length $keeplocal_p]} { + set keeplocal_p [parameter::get -parameter KeepLocalTranslations -default 1] + } + + if { [string is true $keeplocal_p] } { + ns_log Notice "Keep Local Changes while updating catalog for $package_key/$locale (keeplocal_p=$keeplocal_p)" + } else { + ns_log Notice "Overwrite Changes while updating catalog for $package_key/$locale (keeplocal_p=$keeplocal_p)" + } + set message_count(processed) 0 set message_count(added) 0 set message_count(updated) 0 @@ -828,14 +856,24 @@ update { # case 12 set import_case 12 - # update db with file message - set upgrade_status "updated" + + if {! $keeplocal_p} { + # update db with file message + set upgrade_status "updated" + } else { + set conflict_p "t" + } } delete { # case 7 set import_case 7 - # mark message in db deleted - set upgrade_status "deleted" + + if {! $keeplocal_p} { + # mark message in db deleted + set upgrade_status "deleted" + } else { + set conflict_p "t" + } } } } @@ -846,8 +884,10 @@ if { $db_messages($message_key) ne $file_messages($message_key) } { # case 8 set import_case 8 - # differing additions in db and file - set upgrade_status "updated" + if {! $keeplocal_p} { + # differing additions in db and file + set upgrade_status "updated" + } set conflict_p "t" } } @@ -860,16 +900,22 @@ if { $db_messages($message_key) ne $file_messages($message_key) } { # case 14 set import_case 14 - # differing updates in file and db - set upgrade_status "updated" + + if {! $keeplocal_p} { + # differing updates in file and db + set upgrade_status "updated" + } set conflict_p "t" } } delete { # case 6 set import_case 6 - # deletion in file but update in db - set upgrade_status "deleted" + + if {! $keeplocal_p} + # deletion in file but update in db + set upgrade_status "deleted" + } set conflict_p "t" } } @@ -880,8 +926,11 @@ update { # case 4 set import_case 4 - # deletion in db but update in file - set upgrade_status "added" ;# resurrect + + if {! $keeplocal_p} { + # deletion in db but update in file + set upgrade_status "added" ;# resurrect + } set conflict_p "t" } delete { @@ -972,6 +1021,7 @@ ad_proc -public lang::catalog::import { {-package_key {}} {-locales {}} + {-keeplocal_p {}} {-initialize:boolean} {-cache:boolean} } { @@ -982,6 +1032,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 keeplocal_p Overwrites the package parameter if set @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 @@ -1033,7 +1084,7 @@ foreach file_path $catalog_files { # Use a catch so that parse failure of one file doesn't cause the import of all files to fail array unset loop_message_count - if { [catch { array set loop_message_count [lang::catalog::import_from_file $file_path] } errMsg] } { + if { [catch { array set loop_message_count [lang::catalog::import_from_file -keeplocal_p $keeplocal_p $file_path] } errMsg] } { global errorInfo ns_log Error "The import of file $file_path failed, error message is:\n\n${errMsg}\n\nstack trace:\n\n$errorInfo\n\n" Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl,v diff -u -r1.48 -r1.49 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 10 Jan 2007 21:22:04 -0000 1.48 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 13 Aug 2007 11:13:45 -0000 1.49 @@ -78,6 +78,13 @@ set locale [lang::util::default_locale_from_lang $locale] } + # check for a valid package_key, or we end up with zombie-packages + if {![apm_package_installed_p_not_cached $package_key]} { + set error_message "lang::message::register - refusing to register message. The package key in ${package_key}.${message_key} is invalid!" + ns_log Error $error_message + error $error_message + } + # Create a globally (across packages) unique key for the cache set key "${package_key}.${message_key}" Index: openacs-4/packages/acs-lang/tcl/localization-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/localization-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/acs-lang/tcl/localization-procs.tcl 10 Jan 2007 21:22:04 -0000 1.20 +++ openacs-4/packages/acs-lang/tcl/localization-procs.tcl 13 Aug 2007 11:13:45 -0000 1.21 @@ -231,86 +231,138 @@ ad_proc -private lc_monetary { { -label_p 0 } { -style local } + { -truncate_p "t"} num locale {forced_frac_digits ""} {forced_currency_symbol ""} } { - Formats a monetary amount. + Returns the monetary amount formatted with (optional) currency symbol, decimal character and group separator. + Accepts as input a number num and the user's locale. Returns the number formatted as money with (optional) currency + symbol, decimal character and group separator based on the locale. It uses message keys to control these symbols - + the message keys are stored in the acs-lang catalog files. We should call lc_monetary with label_p set to "t", as we + want to display the currency symbol. We can override the locale's currency symbol by setting forced_currency_symbol + to whatever symbol we want to display (but should rarely need to do this). + + By default, lc_monetary will truncate (round down) to the number of decimal places given by the + acs-lang.localization-trunc_decimal_places message key for the locale. This truncating behaviour can be changed to + instead round up by passing in to lc_monetary the value "f" for truncate_p. The lc_monetary proc will then round up + to the value of the acs-lang frac_digits message key for the locale (the value of which in turn can be over-ridden by + passing forced_frac_digits to lc_monetary). If truncate_p is true, forced_frac_digits will be ignored. + + - @param label Specify this switch if you want to specify the label used for the currency. + + @param label_p Specify this switch if you want to specify the label used for the currency. @param style Set to int to display the ISO code as the currency label. Otherwise displays an HTML entity for the currency. The label parameter must be specified for this flag to take effect. @param num Number to format as a monetary amount. If this number could be negative you should put "--" in your call before it. - @param currency ISO currency code. - @param locale Locale used for formatting the number. + @param locale Locale used for formatting the number - this uses the acs-lang message keys. + @param forced_frac_digits Pass this in to override the acs-lang frac_digits or int_frac_digits. If truncate_p is true, forced_frac_digits will be ignored. + @param forced_currency_symbol Pass this in to override the acs-lang int_curr_symbol or currency_symbol. + @param truncate_p Pass this in if you want to to truncate (round down) to a number of decimal places. The number of + decimal places is determined by the acs-lang.localization-trunc_decimal_places message key, and should be a positive integer. For AIMS + we default this to true. @return Formatted monetary amount } { - if {$forced_frac_digits ne "" && [string is integer $forced_frac_digits]} { - set dig $forced_frac_digits + if {$num eq ""} { + #if they enter empty string, return empty string + #pages like payments end up getting 0.00 in empty cells otherwise + return $num } else { - # look up the digits - if {$style eq "int" } { - set dig [lc_get -locale $locale "int_frac_digits"] - } else { - set dig [lc_get -locale $locale "frac_digits"] - } - } + #first escape the locale's decimal character (dec) if it's in the list of chars that need to be escaped in regular expressions + set dec [lc_get -locale $locale "mon_decimal_point"] + set esc_dec $dec + set special_chars {[\^$.|?*+()} + if {[regexp $dec $special_chars]} {set esc_dec "\\$dec"} + #need to strip all non-numerics except the locale's decimal character + if {![regexp {^\-?[0-9]+$} $num]} { + regexp {^(\-?)(.*)} $num "" negg numm + regsub -all "\[^0-9$esc_dec\]" $numm "" numm + set num "" + append num $negg $numm + } + #replace the locale's decimal character with the database's decimal character (assuming for now that it's ".") + regsub -all "$esc_dec" $num "." num - # figure out if negative - if {$num < 0} { - set num [expr {abs($num)}] - set neg 1 - } else { - set neg 0 - } - - # generate formatted number - set out [format "%.${dig}f" $num] + if {![empty_string_p $forced_frac_digits] && [string is integer $forced_frac_digits]} { + set dig $forced_frac_digits + } else { + # look up the digits + if {[string compare $style int] == 0} { + set dig [lc_get -locale $locale "int_frac_digits"] + } else { + set dig [lc_get -locale $locale "frac_digits"] + } + } - # look up the label if needed - if {$forced_currency_symbol eq ""} { - if {$label_p} { - if {$style eq "int" } { - set sym [lc_get -locale $locale "int_curr_symbol"] - } else { - set sym [lc_get -locale $locale "currency_symbol"] - } - } else { - set sym {} - } - } else { - set sym $forced_currency_symbol - } + # figure out if negative + if {$num < 0} { + set num [expr abs($num)] + set neg 1 + } else { + set neg 0 + } - # signorama - if {$neg} { - set cs_precedes [lc_get -locale $locale "n_cs_precedes"] - set sep_by_space [lc_get -locale $locale "n_sep_by_space"] - set sign_pos [lc_get -locale $locale "n_sign_posn"] - set sign [lc_get -locale $locale "negative_sign"] - } else { - set cs_precedes [lc_get -locale $locale "p_cs_precedes"] - set sep_by_space [lc_get -locale $locale "p_sep_by_space"] - set sign_pos [lc_get -locale $locale "p_sign_posn"] - set sign [lc_get -locale $locale "positive_sign"] - } - - # decimal seperator - set dec [lc_get -locale $locale "mon_decimal_point"] - regsub {\.} $out $dec out + # generate formatted number + # Check if we are truncating + if {$truncate_p} { + set trunc_decimal_places [lc_get -locale $locale "trunc_decimal_places"] + set truncated_num [expr [expr floor([expr $num * pow(10,$trunc_decimal_places)])]/pow(10,$trunc_decimal_places)] + set out [format "%.${trunc_decimal_places}f" $truncated_num] + } else { + set out [format "%.${dig}f" $num] + } - # commify - set sep [lc_get -locale $locale "mon_thousands_sep"] - set grouping [lc_get -locale $locale "mon_grouping"] - set num [lc_sepfmt $out $grouping $sep] - - return [subst [nsv_get locale "money:$cs_precedes$sign_pos$sep_by_space"]] -} + # look up the label if needed + if {[empty_string_p $forced_currency_symbol]} { + if {$label_p} { + if {[string compare $style int] == 0} { + set sym [lc_get -locale $locale "int_curr_symbol"] + } else { + set sym [lc_get -locale $locale "currency_symbol"] + } + } else { + set sym {} + } + } else { + set sym $forced_currency_symbol + } + + # signorama + if {$neg} { + set cs_precedes [lc_get -locale $locale "n_cs_precedes"] + set sep_by_space [lc_get -locale $locale "n_sep_by_space"] + set sign_pos [lc_get -locale $locale "n_sign_posn"] + set sign [lc_get -locale $locale "negative_sign"] + } else { + set cs_precedes [lc_get -locale $locale "p_cs_precedes"] + set sep_by_space [lc_get -locale $locale "p_sep_by_space"] + set sign_pos [lc_get -locale $locale "p_sign_posn"] + set sign [lc_get -locale $locale "positive_sign"] + } + + # change decimal seperator back from dot to locales version + regsub {\.} $out $dec out + + # commify + set sep [lc_get -locale $locale "mon_thousands_sep"] + if {[ad_var_type_check_number_p $sep]} { + # The separator is a number. This is bad as it will bring bogus results and crash the server + set sep "," + } + + set grouping [lc_get -locale $locale "mon_grouping"] + set num [lc_sepfmt $out $grouping $sep] + + return [subst [nsv_get locale "money:$cs_precedes$sign_pos$sep_by_space"]] + } +} + ad_proc -public clock_to_ansi { seconds } { Index: openacs-4/packages/acs-lang/www/admin/export-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/export-messages.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-lang/www/admin/export-messages.adp 30 Jan 2004 14:53:06 -0000 1.3 +++ openacs-4/packages/acs-lang/www/admin/export-messages.adp 13 Aug 2007 11:13:46 -0000 1.4 @@ -1,32 +1,37 @@ - - @page_title;noquote@ - -Export results for - - all packages - - -package @package_key@ - -and - - all locales - - -locale @locale@ -. - -

- Export complete. -

- - -

- Catalog files are stored in the directory @catalog_dir@. -

-
- - - + + @page_title;noquote@ + +
+Export results for + + all packages + + +package @package_key@ + +and + + all locales + + +locale @locale@ +. + +
+
+

+ + Export complete. +

+ + +

+ Catalog files are stored in the directory @catalog_dir@. +

+
+ +


+

+ Index: openacs-4/packages/acs-lang/www/admin/import-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/import-messages.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/import-messages.adp 26 Feb 2004 15:28:47 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/import-messages.adp 13 Aug 2007 11:13:46 -0000 1.5 @@ -1,5 +1,12 @@ @page_title;noquote@ +
+ +

Please confirm that you want to overwrite the message catalog and lose your local changes: Yes, that is what I want!

+


+

No, go back!

+
+ Import results for @@ -15,7 +22,8 @@ locale @locale@ . - +
+

Import finished. Number of messages processed: @message_count.processed@, added: @message_count.added@, updated: @message_count.updated@, deleted: @message_count.deleted@. @@ -39,7 +47,8 @@ There are currently no conflicts in the database. - +


+
\ No newline at end of file Index: openacs-4/packages/acs-lang/www/admin/import-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/import-messages.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/import-messages.tcl 26 Feb 2004 15:28:47 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/import-messages.tcl 13 Aug 2007 11:13:46 -0000 1.5 @@ -15,9 +15,26 @@ ad_script_abort } +set confirm_url {} +if {[string length $keeplocal_p]} { + if {[string is true $keeplocal_p]} { + append page_title " (keep local changes)" + } else { + append page_title " (overwrite local changes)" + if {[string length $confirmed_p]} { + set confirmed_p 1 + } else { + set confirmed_p 0 + set confirm_url [export_vars -base [ad_conn url] { locale package_key keeplocal_p confirmed_p return_url}] + return + } + } +} + array set message_count [lang::catalog::import \ -package_key $package_key \ - -locales $locale] + -locales $locale \ + -keeplocal_p $keeplocal_p ] set conflict_count [lang::message::conflict_count \ -package_key $package_key \ Index: openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl 10 Jan 2007 21:22:04 -0000 1.9 +++ openacs-4/packages/acs-lang/www/admin/localized-message-new.tcl 13 Aug 2007 11:13:46 -0000 1.10 @@ -5,43 +5,59 @@ @author Bruno Mattarollo @author Christian Hvid + @author Christian Eva ( Error-handling, return / loop / cancel @creation-date 15 April 2002 @cvs-id $Id$ } { locale package_key {message_key ""} - {return_url {[export_vars -base message-list { locale package_key }]}} + {return_url {}} } +# cjeva: changed the way the return va is handled, so that it can be called from +# other parts of oacs and return there. So if it is called with a message-key, it will +# not display the two buttons. + +set default_return [export_vars -base message-list { locale package_key }] + # We rename to avoid conflict in queries set current_locale $locale set default_locale en_US -set locale_label [lang::util::get_label $current_locale] -set default_locale_label [lang::util::get_label $default_locale] +set locale_label [ad_locale_get_label $current_locale] +set default_locale_label [ad_locale_get_label $default_locale] set page_title "Create New Message" set context [list [list "package-list?[export_vars { locale }]" $locale_label] \ [list "message-list?[export_vars { locale package_key show }]" $package_key] \ $page_title] +set next_url [export_vars -base [ad_conn url] { locale package_key return_url}] - # We check that this request is coming for the system wide default # locale. If not, we can't allow the creation of a new localized # message. -if { $current_locale ne $default_locale } { +if { ![string equal $current_locale $default_locale] } { ad_return_error "Can only create messages in the default locale" "Can only create messages in the default locale" ad_script_abort } -form create message_new +set Lbutt [list [list Insert ok]] +if {![string length $return_url]} { + lappend Lbutt [list Return cancel] +} else { + set next_url $return_url +} + +form create message_new \ + -edit_buttons $Lbutt + element create message_new package_key_display -label "Package" -datatype text \ -widget inform -value $package_key @@ -58,13 +74,14 @@ # processing of the form element create message_new locale -label "locale" -datatype text -widget hidden +set focus message_new.message_key if { [form is_request message_new] } { element set_value message_new package_key $package_key element set_value message_new locale $current_locale element set_value message_new message_key $message_key element set_value message_new return_url $return_url - if { $message_key eq "" } { + if { [empty_string_p $message_key] } { set focus message_new.message_key } else { set focus message_new.message @@ -75,6 +92,17 @@ # We are not getting a request, so it's a post. Get and validate # the values + set button [form get_button message_new] + if {[string match cancel $button]} { + # go back + if {![string length $return_url]} { + + set return_url $default_return + } + ad_returnredirect $return_url + ad_script_abort + } + form get_values message_new # We have to check the format of the key submitted by the user, @@ -103,14 +131,16 @@ # We use the acs-lang registration of a translation. Simple, eh? - lang::message::register $locale $package_key $message_key $message + set err [catch {lang::message::register $locale $package_key $message_key $message} err_mess] + if { $err } { + util_user_message -message $err_mess + element set_error message_new package_key_display \ + $err_mess + } else { + + set escaped_locale [ns_urlencode $locale] - set escaped_locale [ns_urlencode $locale] - - forward $return_url - + ##forward $return_url + forward $next_url + } } - -set focus "" - -ad_return_template \ No newline at end of file Index: openacs-4/packages/acs-lang/www/admin/message-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-delete.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-lang/www/admin/message-delete.adp 11 Dec 2003 21:39:53 -0000 1.2 +++ openacs-4/packages/acs-lang/www/admin/message-delete.adp 13 Aug 2007 11:13:46 -0000 1.3 @@ -1,14 +1,28 @@ - - @page_title@ - @context;noquote@ - -

- -

- Deleting message for key @package_key@.@message_key@ in locale @locale@. -

- -
-@form_export_vars;noquote@ - -
+ + @page_title@ + @context;noquote@ + +

+
+

+ Deleting message for key @package_key@.@message_key@ in locale @locale@. +

+
+ +

+ + If you confirm with "Confirm unregister", then the message @package_key@.@message_key@ + is completely removed from all locales. + +

+ +

+
+ +

+ @form_export_vars;noquote@ + + + + +
Index: openacs-4/packages/acs-lang/www/admin/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-delete.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-lang/www/admin/message-delete.tcl 26 Feb 2005 16:00:10 -0000 1.3 +++ openacs-4/packages/acs-lang/www/admin/message-delete.tcl 13 Aug 2007 11:13:46 -0000 1.4 @@ -13,6 +13,10 @@ message_key show:optional confirm_p:optional + unregister_p:optional + {subm_delete {}} + {subm_unreg {}} + {return_url {}} } @@ -28,15 +32,30 @@ [list "message-list?[export_vars { locale package_key show }]" $package_key] \ $page_title] -set form_export_vars [export_vars -form { locale package_key message_key show {confirm_p 1} }] +# We let you unregister the messages key if you're in the default locale +set unregister_p [string equal $current_locale $default_locale] +set form_export_vars [export_vars -form { locale package_key message_key show {confirm_p 1} unregister_p return_url}] - if { [exists_and_not_null confirm_p] && [template::util::is_true $confirm_p] } { - lang::message::delete \ - -package_key $package_key \ - -message_key $message_key \ - -locale $locale + # check if we delete or unregister + + if {[string length $subm_delete]} { + lang::message::delete \ + -package_key $package_key \ + -message_key $message_key \ + -locale $locale + } - ad_returnredirect "message-list?[export_vars { locale package_key show }]" + if {[string length $subm_unreg]} { + lang::message::unregister \ + $package_key \ + $message_key + } + + if {[string length $return_url]} { + ad_returnredirect $return_url + } else { + ad_returnredirect "message-list?[export_vars { locale package_key show }]" + } ad_script_abort } Index: openacs-4/packages/acs-lang/www/admin/message-list-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/message-list-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-lang/www/admin/message-list-oracle.xql 26 Feb 2004 15:28:47 -0000 1.4 +++ openacs-4/packages/acs-lang/www/admin/message-list-oracle.xql 13 Aug 2007 11:13:46 -0000 1.5 @@ -22,7 +22,6 @@ and lm2.locale (+) = :locale and lm2.message_key (+) = lmk.message_key and lm2.package_key (+) = lmk.package_key - and lm1.deleted_p = 'f' $where_clause order by upper(lm1.message_key), lm1.message_key Index: openacs-4/packages/acs-lang/www/admin/message-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-list.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-lang/www/admin/message-list.adp 3 Jul 2006 12:29:50 -0000 1.10 +++ openacs-4/packages/acs-lang/www/admin/message-list.adp 13 Aug 2007 11:13:46 -0000 1.11 @@ -1,91 +1,94 @@ - - @page_title@ - @context;noquote@ -
- - - - - @form_vars;noquote@ - - -
Language
-
-
- -

- Show: - - | - @show_opts.label@ (@show_opts.count@) - @show_opts.label@ (@show_opts.count@) - -

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Message Key@default_locale_label@ Message@locale_label@ Message
- - - @messages.message_key_pretty@ - @messages.default_message@ - - DELETED (@messages.translated_message@) - - - @messages.translated_message@ - Not translated - - - -
-
-
+ + @page_title@ + @context;noquote@ + +

+ Show: + + | + @show_opts.label@ (@show_opts.count@) + @show_opts.label@ (@show_opts.count@) + +

+ + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Message Key@default_locale_label@ Message@locale_label@ Message
+ + + @messages.message_key_pretty@ + @messages.default_message@ + + DELETED (@messages.translated_message@) + + + @messages.translated_message@ + Not translated + + + +
+
+
Index: openacs-4/packages/acs-lang/www/admin/message-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/message-list.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-lang/www/admin/message-list.tcl 10 Jan 2007 21:22:04 -0000 1.12 +++ openacs-4/packages/acs-lang/www/admin/message-list.tcl 13 Aug 2007 11:13:46 -0000 1.13 @@ -32,16 +32,36 @@ set site_wide_admin_p [acs_user::site_wide_admin_p] -set export_messages_url [export_vars -base "export-messages" { package_key locale { return_url {[ad_return_url]} } }] -set import_messages_url [export_vars -base "import-messages" { package_key locale { return_url {[ad_return_url]} } }] +set return_url [export_vars -base [ad_conn url] {locale package_key}] +set export_messages_url [export_vars -base "export-messages" { package_key locale return_url }] + +set keeplocal_p [parameter::get -parameter KeepLocalTranslations -default ""] +set import_messages_url [export_vars -base "import-messages" { package_key locale keeplocal_p return_url }] + +if {[string length $keeplocal_p]} { + # we have the parameter, turn to opposite for the special url + if {[string is true $keeplocal_p]} { + set keeplocal_p 0 + set import_messages_normal_text "Keep local changes" + set import_messages_special_text "Discard local changes" + } else { + set keeplocal_p 1 + set import_messages_normal_text "Discard local changes" + set import_messages_special_text "Keep local changes" + } + set import_messages_special_url [export_vars -base "import-messages" { package_key locale keeplocal_p { return_url {[ad_return_url]} } }] +} + # We let you create new messages keys if you're in the default locale set create_p [string equal $current_locale $default_locale] -set new_message_url "localized-message-new?[export_vars { locale package_key }]" +set new_message_url "[export_vars -base localized-message-new { locale package_key }]" +set package_list_url "[export_vars -base package-list { locale }]" + ##### # # Counting messages Index: openacs-4/packages/acs-lang/www/admin/package-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/package-list.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-lang/www/admin/package-list.adp 30 Jan 2004 14:53:06 -0000 1.6 +++ openacs-4/packages/acs-lang/www/admin/package-list.adp 13 Aug 2007 11:13:46 -0000 1.7 @@ -10,8 +10,15 @@ Index: openacs-4/packages/acs-lang/www/admin/package-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/package-list.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-lang/www/admin/package-list.tcl 10 Jan 2007 21:22:04 -0000 1.7 +++ openacs-4/packages/acs-lang/www/admin/package-list.tcl 13 Aug 2007 11:13:46 -0000 1.8 @@ -31,9 +31,30 @@ set locale_enabled_p [expr [lsearch [lang::system::get_locales] $current_locale] != -1] set site_wide_admin_p [acs_user::site_wide_admin_p] +set import_all_url [export_vars -base import-messages { { locale $current_locale } {return_url {[ad_return_url]}} }] +set export_all_url [export_vars -base export-messages { { locale $current_locale } {return_url {[ad_return_url]}} }] +set keeplocal_p [parameter::get -parameter KeepLocalTranslations -default ""] +##qst::Debug "keeplocal_p=$keeplocal_p" ==1== +set import_all_url [export_vars -base "import-messages" { keeplocal_p {locale $current_locale} {return_url {[ad_return_url]}} }] +if {[string length $keeplocal_p]} { + # we have the parameter, turn to opposite for the special url + if {[string is true $keeplocal_p]} { + set keeplocal_p 0 + set import_all_normal_text "Keep local changes" + set import_all_special_text "Discard local changes" + } else { + set keeplocal_p 1 + set import_all_normal_text "Discard local changes" + set import_all_special_text "Keep local changes" + } + set import_all_special_url [export_vars -base "import-messages" { keeplocal_p {locale $current_locale} {return_url {[ad_return_url]}} }] +} else { + set import_all_special_url {} +} + ##### # # Package/message list @@ -113,6 +134,3 @@ } } - -set import_all_url [export_vars -base import-messages { { locale $current_locale } {return_url {[ad_return_url]}} }] -set export_all_url [export_vars -base export-messages { { locale $current_locale } {return_url {[ad_return_url]}} }]