Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-admin/www/apm/version-extract-message-keys.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-admin/www/apm/version-extract-message-keys.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,9 @@ + +@page_title@ +@context_bar@ + +@processing_html_result@ + +

+@proceed_label@ +

Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n-process-2.adp~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,9 @@ + +@page_title@ +@context_bar@ + +@processing_html_result@ + +

+@process_next_link@ +

\ No newline at end of file Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,98 @@ +ad_page_contract { + Internationalize a certain adp file. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 8 October 2002 + @cvs-id $Id: version-i18n-process-2.tcl,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + {adp_files:multiple,notnull} + {adp_action:multiple} + {message_keys:multiple ""} +} + +set next_adp_file [lindex $adp_files 0] + +ns_log Notice "adp_files $adp_files next_adp_file $next_adp_file" + +set page_title "Internationalizing ADP File $next_adp_file" +set context_bar [ad_context_bar $page_title] + +# Figure out which actions to take on the selected adp:s +set replace_text_p [ad_decode [lsearch -exact $adp_action replace_text] "-1" "0" "1"] +set replace_tags_p [ad_decode [lsearch -exact $adp_action replace_tags] "-1" "0" "1"] + +# We need either or both of the actions to be selected +if { (! $replace_text_p) && (! $replace_tags_p) } { + ad_return_complaint "Invalid HTML Parameters" "You must choose an action to take on selected adp files, either replace_text or replace_tags or both." + ad_script_abort +} + +# Do text replacement +if { $replace_text_p } { + # Process the next adp file in the list + set text_adp_file $next_adp_file + set number_of_processed_files 1 + + ns_log Notice "Replacing text in file $text_adp_file with message tags" + append processing_html_result "

Text replacements for $text_adp_file

" + set adp_text_result_list [lang::util::replace_adp_text_with_message_tags "[acs_root_dir]/$text_adp_file" write $message_keys] + set text_replacement_list [lindex $adp_text_result_list 0] + set text_untouched_list [lindex $adp_text_result_list 1] + + append processing_html_result "Replaced [llength $text_replacement_list] texts:
" + foreach text_replacement $text_replacement_list { + append processing_html_result "replaced text \"[lindex $text_replacement 1]\" using key [lindex $text_replacement 0]
" + } + + if { [llength $text_untouched_list] > 0 } { + append processing_html_result "
[llength $text_untouched_list] pieces of text were left untouched. Please take note of these texts and do any necessary translations by manually inserting <#message_key text#> tags in the adp file (the message keys should contain only letters and underscores). You may then reload this page. The texts to consider for translation are:
" + } else { + append processing_html_result "
[llength $text_untouched_list] pieces of text were left untouched." + } + foreach untouched_text $text_untouched_list { + append processing_html_result "\"$untouched_text\"
" + } +} + +# Do tag replacement +if { $replace_tags_p } { + if { $replace_text_p } { + # We are also replacing text, so only process one adp file + set tags_adp_files $next_adp_file + set number_of_processed_files 1 + } else { + # We are only doing tag replacement, so process all adp files + set tags_adp_files $adp_files + set number_of_processed_files [llength $adp_files] + } + + foreach adp_file $tags_adp_files { + ns_log Notice "Replacing tags in file $adp_file with keys and doing insertion into message catalog" + append processing_html_result "

Message tag replacements for $adp_file

" + + set number_of_replacements [lang::util::extract_keys_from_adps $adp_file] + + append processing_html_result "Did $number_of_replacements replacements, any further details are in the log file" + } +} + +# Remove the processed file from the file list. +set adp_files [lrange $adp_files $number_of_processed_files end] + +# The proceed link will be to the next adp file if there is one and back to the I18N page +# if we're done +set proceed_url_export_vars [export_vars -url {version_id adp_files:multiple adp_action:multiple}] +if { [llength $adp_files] > 0 } { + # There are no more files to process so present a link back to the i18n page for this version + set proceed_url "version-i18n-process?${proceed_url_export_vars}" + set proceed_label "Process next adp file" + +} else { + # There are more files to process. This means we are doing text replacements + # so present a link back to the page for choosing keys for the next adp file + set proceed_url "version-i18n?${proceed_url_export_vars}" + set proceed_label "Return to the I18N page for this package" +} + +ad_return_template Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n-process-2.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + Internationalize a certain adp file. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 8 October 2002 + @cvs-id $Id: version-i18n-process-2.tcl~,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + {adp_files:multiple} + {adp_action:multiple} + {message_keys:multiple ""} +} + +# Process the next adp file in the list +set adp_file [lindex $adp_files 0] + +set page_title "Internationalizing ADP File $adp_file" +set context_bar [ad_context_bar $page_title] + +# Figure out which actions to take on the selected adp:s +set replace_text_p [ad_decode [lsearch -exact $adp_action replace_text] "-1" "0" "1"] +set replace_tags_p [ad_decode [lsearch -exact $adp_action replace_tags] "-1" "0" "1"] + +if { $replace_text_p } { + ns_log Notice "Replacing text in file $adp_file with message tags" + append processing_html_result "

Text replacements

" + set adp_text_result_list [lang::util::replace_adp_text_with_tags "[acs_root_dir]/$adp_file" write $message_keys] + set number_of_text_snippets [lindex $adp_text_result_list 0] + if { ![empty_string_p [lindex $adp_text_result_list 1]] } { + set text_report ", here is the report:
[lindex $adp_text_result_list 1]" + } else { + set text_report "" + } + + append processing_html_result "Replaced $number_of_text_snippets texts $text_report" +} + +if { $replace_tags_p } { + ns_log Notice "Replacing tags in file $adp_file with keys and doing insertion into message catalog" + append processing_html_result "

Message tag replacements

" + + set number_of_replacements [lang::util::extract_keys_from_adps $adp_file] + + append processing_html_result "Did $number_of_replacements replacements, any further details are in the log file" +} + +# Remove the processed file from the file list. If there are more adp files to process +set adp_files [lrange $adp_files 1 end] + +if {} { + set process_next_link "Process next ADP file" +} else { + +} + + +ad_return_template Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,33 @@ + +@page_title@ +@context_bar@ + +Choose which message keys to use for file @adp_file@. If you leave a message key blank no replacement will be done +and the corresponding text in the adp will be left untouched. The text that is actually replaced is bold and highlighted +with a yellow background in the "Text to Replace" column. + +
+ +
+ @hidden_form_vars@ + + + + + + + + + + + + + +
Text to ReplaceMessage key to use
@replacements.text@
+ +

+ +

+
+ +
Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n-process.adp~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,32 @@ + +@page_title@ +@context_bar@ + +Choose which message keys to use for file @adp_file@. If you leave a message key blank no replacement will be done +and the corresponding text in the adp will be left untouched. + +
+ +
+ + + + + + + + + + + + + + +
Text to ReplaceMessage key to use
@replacements.text@
+ +

+ +

+
+ +
\ No newline at end of file Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { + Internationalize a certain adp file. Give the user the possibility to + determine which texts should be substituted and which keys should be used. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 8 October 2002 + @cvs-id $Id: version-i18n-process.tcl,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + {adp_files:multiple} + {adp_action:multiple} +} + +db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id" + +set page_title "Internationalization of $pretty_name $version_name" +set context_bar [ad_context_bar $page_title] + +# Figure out which actions to take on the selected adp:s +set replace_text_p [ad_decode [lsearch -exact $adp_action replace_text] "-1" "0" "1"] +set replace_tags_p [ad_decode [lsearch -exact $adp_action replace_tags] "-1" "0" "1"] + +# If no texts should be replaced we need not give the user a choice of keys to use and +# can go straight to the processing +set redirect_url "version-i18n-process-2?[export_vars -url {version_id adp_files:multiple adp_action:multiple}]" +if { ! $replace_text_p } { + + ad_returnredirect $redirect_url + ad_script_abort +} + +# Process one adp at a time interactively +set adp_file [lindex $adp_files 0] + +set adp_report_list [lang::util::replace_adp_text_with_message_tags "[acs_root_dir]/$adp_file" report] +set adp_replace_list [lindex $adp_report_list 0] +set adp_no_replace_list [lindex $adp_report_list 1] + +if { [llength $adp_replace_list] == 0 } { + # There are no replacements to choose keys for so go straight to the processing result page + ad_returnredirect $redirect_url + ad_script_abort +} + +multirow create replacements key text + +foreach key_pair $adp_replace_list { + multirow append replacements [lindex $key_pair 0] [lindex $key_pair 1] +} + +set hidden_form_vars [export_vars -form {version_id adp_files:multiple adp_action:multiple}] + +ad_return_template Index: openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n-process.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,44 @@ +ad_page_contract { + Internationalize a certain adp file. Give the user the possibility to + determine which texts should be substituted and which keys should be used. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 8 October 2002 + @cvs-id $Id: version-i18n-process.tcl~,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + {adp_files:multiple} + {adp_action:multiple} +} + +db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id" + +set page_title "Internationalization of $pretty_name $version_name" +set context_bar [ad_context_bar $page_title] + +# Figure out which actions to take on the selected adp:s +set replace_text_p [ad_decode [lsearch -exact $adp_action replace_text] "-1" "0" "1"] +set replace_tags_p [ad_decode [lsearch -exact $adp_action replace_tags] "-1" "0" "1"] + +# If no texts should be replaced we need not give the user a choice of keys to use and +# can go straight to the processing +if { ! $replace_text_p } { + + ad_returnredirect "version-i18n-process-2?[export_vars -url {version_id adp_files adp_action}]" + ad_script_abort +} + +# Process one adp at a time interactively +set adp_file [lindex $adp_files 0] + +set adp_report_list [lang::util::replace_adp_text_with_message_tags "[acs_root_dir]/$adp_file" report] +set adp_replace_list [lindex $adp_report_list 0] +set adp_no_replace_list [lindex $adp_report_list 1] + +multirow create replacements key text + +foreach key_pair $adp_replace_list { + multirow append replacements [lindex $key_pair 0] [lindex $key_pair 1] +} + +ad_return_template Index: openacs-4/packages/acs-admin/www/apm/version-i18n.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n.adp 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,82 @@ + +@page_title@ +@context_bar@ + +
+ +

+ +

+ +@pre_select_filter@ | @status_filter@ + +
+ +

Important Instructions

+ +

The I18N status of adp files

+

+Clicking on the "Show I18N status of files" link above will display three counts for each adp file - the number of potential +translatable text messages, the number of temporary tags (on the syntax <#message_key text#>), and the number of +message key lookups in the file (i.e. occurencies of \#message_key\#). +

+ +

+A fully translated adp must have 0 tags, it typically +has 0 or only a few texts deemed translatable by our script and any number of message key lookups (the last count). Our script +sometimes considers for example Javascript to be translatable, but don't worry - you will have the opportunity to tell +it to leave such texts untouched. +

+ +

Actions to take on adp files

+

+The last two checkboxes in the form above let you choose which of the two available scripts to run on the selected adp files. +You have to choose at least one of these actions, by default both are selected and for almost all cases this is the setting +that we recommend. Running both those actions on an untranslated, or partially translated adp, should automate most +of the translation and leave you with little manual work to do. +

+ +

+To the best of our knowledge there is no harm in running those +actions multiple times on files. +

+ +

+If the adp status for a file shows 0 translatable texts, then the "Replace texts with tags" +action will do nothing. Likewise, if the adp status shows 0 tags then "Replace tags with keys and insert into catalog" +action will have no effect. +

+ +

Replacing text with tags

+

+If you select "Replace text with tags" +then for each adp file a script will attempt to replace translatable text with temporary <#message_key text#> tags. You will +have the opportunity to edit the message keys to use. You will also be able to indicate when a piece of text should be left +untouched (since it should not be subject to translation, for example Javascript code). +

+ +

+Any pieces of text that our script could not automatically extract, for example pieces of text with embedded adp variables (i.e. \@var_name\@), will be listed on the result page. Make sure to take note of these texts and translate them manually. Suppose for example +that our script tells you that it left the text "Forum \@forum_name\@" untouched. What you should do then is to edit the corresponding +adp file and manually replace that text with something like "<#Forum Forum#> \@forum_name\@". After you have made all such manual edits +you can simply run the second action labeled "Replace tags with keys and insert into catalog". +

+ +

Replace tags with keys and insert into catalog

+If selected, this action will be executed after the "Replace text with tags" action. It will replace any occurence of the +temporary <#message_key text#> tags with \#message_key\# lookups in the adp files and insert the corresponding +keys and messages into the en_US catalog file for the package. + +

+Entries for the extracted messages will be added to the en_US catalog file only if they do not already exist in that file. +If the messages don't contain the package key prefix this prefix will be added before insertion into the message catalog. +

+ +

+The message tags are processed from the adp:s in the order +that they appear. If the key of a message tag is already in the catalog +file then the message texts will be compared. If the message texts in the tag and in the catalog file are identical then no +insertion is done to the catalog file. If they differ it is assumed that the new message should be inserted into the +catalog file but with a different key. In this case a warning is issued in the log file and an integer is appended to the +message key to make it unique before insertion into the catalog file is done. +

Index: openacs-4/packages/acs-admin/www/apm/version-i18n.adp~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n.adp~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n.adp~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,13 @@ + +@page_title@ +@context_bar@ + +
+ +

+ +

+ +@pre_select_filter@ | @status_filter@ + +
Index: openacs-4/packages/acs-admin/www/apm/version-i18n.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-i18n.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n.tcl 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,110 @@ +ad_page_contract { + Show internationalization status for a certain package version. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 8 October 2002 + @cvs-id $Id: version-i18n.tcl,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + {pre_select_files_p "1"} + {show_status_p "0"} +} + +db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id" + +set page_title "Internationalization of $pretty_name $version_name" +set context_bar [ad_context_bar $page_title] + +set adp_file_option_list [list] +set adp_preselect_list [list] +set package_key [apm_package_key_from_version_id $version_id] +foreach file [lsort [ad_find_all_files [acs_package_root_dir $package_key]]] { + + if { [regexp {\.adp$} $file match] } { + set relative_path [ad_make_relative_path $file] + + # Get statistics on number of message tags + if { $show_status_p } { + set adp_file_id [open $file r] + set adp_file_contents [read $adp_file_id] + set number_of_message_tags [llength [lang::util::get_adp_message_indices $adp_file_contents]] + set number_of_message_keys [llength [lang::util::get_hash_indices $adp_file_contents]] + set adp_text_result_list [lang::util::replace_adp_text_with_message_tags $file report] + set number_of_text_snippets [llength [lindex $adp_text_result_list 0]] + + close $adp_file_id + + set status_string "$number_of_text_snippets texts, $number_of_message_tags tags, $number_of_message_keys keys" + } else { + set status_string "" + } + + # Checkbox label in first element and value in second + lappend adp_file_option_list [list "$relative_path $status_string" $relative_path] + + if { $pre_select_files_p } { + lappend adp_preselect_list $relative_path + } + + } +} + +form create adp_list_form -action "version-i18n-process" + +element create adp_list_form version_id \ + -datatype integer \ + -widget hidden \ + -value $version_id + +element create adp_list_form adp_files \ + -datatype text \ + -widget checkbox \ + -label "ADP Templates" \ + -options $adp_file_option_list \ + -values $adp_preselect_list + +element create adp_list_form adp_action \ + -datatype text \ + -widget checkbox \ + -label "Action to take on files" \ + -options {{{Replace text with tags} replace_text} {{Replace tags with keys and insert into catalog} replace_tags}} \ + -values {replace_text replace_tags} \ + -section action_section + +if { [form is_valid adp_list_form] } { + # The form was submitted + # Take action on selected adp:s + + set adp_file_list [element get_values adp_list_form adp_files] + + set action_list [element get_values adp_list_form adp_action] + set replace_text_p [ad_decode [lsearch -exact $action_list replace_text] "-1" "0" "1"] + set replace_tags_p [ad_decode [lsearch -exact $action_list replace_tags] "-1" "0" "1"] + + foreach adp_file $adp_file_list { + if { $replace_text_p } { + ns_log Notice "Replacing text in file $adp_file with message tags" + } + + if { $replace_tags_p } { + ns_log Notice "Replacing tags in file $adp_file with keys and doing insertion into message catalog" + } + } + + ad_returnredirect "version-i18n?version_id=$version_id" + ad_script_abort +} + +if { $pre_select_files_p } { + set pre_select_filter "Unselect all files" +} else { + set pre_select_filter "Select all files" +} + +if { $show_status_p } { + set status_filter "Hide I18N status of files" +} else { + set status_filter "Show I18N status of files" +} + +ad_return_template Index: openacs-4/packages/acs-admin/www/apm/version-i18n.tcl~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-i18n.tcl~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/apm/version-i18n.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 @@ -0,0 +1,13 @@ +ad_page_contract { + Do message key extraction for a certain APM package version. + First let the user choose which adps to extract message keys from + and then do the actual extraction. Redirects back to viewing the + package version. + + @author Peter Marklund (peter@collaboraid.biz) + @creation-date 1 October 2002 + @cvs-id $Id: version-i18n.tcl~,v 1.1 2002/10/09 16:03:50 lars Exp $ +} { + version_id:integer,notnull + +} Index: openacs-4/packages/acs-admin/www/apm/version-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-view.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-admin/www/apm/version-view.tcl 7 Oct 2002 15:17:23 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/version-view.tcl 9 Oct 2002 16:03:50 -0000 1.6 @@ -218,7 +218,7 @@
  • Manage file information
  • Manage parameter information
  • Display an XML package specification file for this version -
  • Extract message catalog Keys (used for multilinguality) from adp pages and generate message catalog files. Lets you choose which adp files to extract from. +
  • Manage Internationalization " if { ![info exists installed_version_id] || $installed_version_id == $version_id && \