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 -N --- openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.adp~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ - -@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 -N -r1.1 -r1.2 --- openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl 9 Oct 2002 16:03:50 -0000 1.1 +++ openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl 10 Oct 2002 14:34:38 -0000 1.2 @@ -46,7 +46,7 @@ } 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:
" + 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, the text in the tag must have greater than and lesser than signs HTML quoted). At a later stage you can then run the action \"Replace tags with text and insert into catalog\" on the file. The texts to consider for translation are:
" } else { append processing_html_result "
[llength $text_untouched_list] pieces of text were left untouched." } @@ -71,7 +71,7 @@ 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] + set number_of_replacements [lang::util::replace_adp_message_tags_with_lookups $adp_file] append processing_html_result "Did $number_of_replacements replacements, any further details are in the log 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/Attic/version-i18n-process-2.tcl~,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-i18n-process-2.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,57 +0,0 @@ -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/Attic/version-i18n-process.adp~,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-i18n-process.adp~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,32 +0,0 @@ - -@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/Attic/version-i18n-process.tcl~,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-i18n-process.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,44 +0,0 @@ -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 -N -r1.1 -r1.2 --- openacs-4/packages/acs-admin/www/apm/version-i18n.adp 9 Oct 2002 16:03:50 -0000 1.1 +++ openacs-4/packages/acs-admin/www/apm/version-i18n.adp 10 Oct 2002 14:34:38 -0000 1.2 @@ -38,7 +38,10 @@

To the best of our knowledge there is no harm in running those -actions multiple times on files. +actions multiple times on files. Before an adp file is modified it will be backed up to +a file with the name of the original file with the ending .orig appended to it (i.e. +www/a-file.adp is backed up to www/a-file.adp.orig). However +if such an .orig file already exists no backup is done.

@@ -56,12 +59,27 @@

-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 +Any pieces of text that our script finds that it 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".

+

+Note: running this action will not find translatable text within HTML or adp tags on +adp pages (i.e. text in alt tags of images), nor will it find translatable text in tcl files. Such texts will have to be found manually. +If those texts are in adp files they are best replaced with the <#message_key text#> tags that +can be extracted by the action described below. Here are some commands that we used on Linux to look for texts in +adp pages not found by the script: + +

+# List image tags, look for alt attributes with literal text
+find -iname '*.adp'|xargs egrep -i '<img'
+# List submit buttons, look for text in the value attribute 
+find -iname '*.adp'|xargs egrep -i '<input[^>]*type="?submit'
+
+

+

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 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 -N --- openacs-4/packages/acs-admin/www/apm/version-i18n.adp~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ - -@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/Attic/version-i18n.tcl~,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-i18n.tcl~ 9 Oct 2002 16:03:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ -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 - -}