From ac8826fc402388798b1a5e963b16a219148cfd29 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 16 Nov 2012 02:03:21 +0000 Subject: wrapped most text blurbs in [_ ] to enable translation of them svn path=/trunk/scripts/guiplugins/search-plugin/; revision=16552 --- search-plugin.tcl | 95 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/search-plugin.tcl b/search-plugin.tcl index 23a5740..efd2f40 100644 --- a/search-plugin.tcl +++ b/search-plugin.tcl @@ -88,11 +88,12 @@ proc ::dialog_search::open_file { xpos ypos mytoplevel type clicked } { } else { $mytoplevel.resultstext configure -cursor hand2 if {$type eq "file"} { - $mytoplevel.statusbar configure -text "Open [file join $basedir $filename]" + $mytoplevel.statusbar configure -text \ + [format [_ "Open %s"] [file join $basedir $filename]] } else { set msg "" if {$type eq "dir_in_fm"} {set msg {in external file browser: }} - $mytoplevel.statusbar configure -text [format "Browse %s%s" \ + $mytoplevel.statusbar configure -text [format [_ "Browse %s%s"] \ $msg [file dirname [file join $basedir $filename]]] } } @@ -112,7 +113,7 @@ proc ::dialog_search::grab_metavalue { xpos ypos mytoplevel clicked } { if {$clicked eq "1"} { ::dialog_search::searchfor $text } else { - $mytoplevel.statusbar configure -text [format "Search for pattern: %s" $text] + $mytoplevel.statusbar configure -text [format [_ "Search for pattern: %s"] $text] } } @@ -177,27 +178,27 @@ proc ::dialog_search::error { fid error_type } { $widget configure -state normal $widget delete 0.0 end print_navbar $widget - $widget insert end "Error\n" homepage_title - $widget insert end "The\ + $widget insert end [_ "Error\n"] homepage_title + $widget insert end [_ "The\ Pd Search Tool can't use the search\ term you entered\nThe tcl interpreter gave\ - the following error:\n\n$fid\n\n" description + the following error:\n\n$fid\n\n"] description if { $error_type eq "badlist" } { - $widget insert end "The search\ + $widget insert end [_ "The search\ term you enter must be formatted as a proper\ tcl list. This usually isn't an issue unless\ you use some special characters like brackets\ or unmatched quotes in your search. For more\ - info on tcl lists, see:\n\n" description + info on tcl lists, see:\n\n"] description $widget insert end \ "http://www.tcl.tk/man/tcl/tutorial/Tcl14.html" description } elseif { $error_type eq "badregex" } { - $widget insert end "The search\ + $widget insert end [_ "The search\ term you enter must have the proper syntax for a\ regular expression in Tcl. This usually isn't an\ issue unless you use special characters to create\ a complex regular expression. For more info on\ - regular expressions in Tcl, see:\n\n" description + regular expressions in Tcl, see:\n\n"] description $widget insert end \ "http://www.tcl.tk/man/tcl8.5/TclCmd/re_syntax.htm" } @@ -274,7 +275,7 @@ proc ::dialog_search::results_epilog {widget} { variable filelist .search.searchtextentry configure -foreground black -background white $widget delete {1.0 lineend -1 chars} 1.end - $widget insert 1.end "Found " "navbar" + $widget insert 1.end [_ "Found "] "navbar" set i 0 foreach genre $genres { set tag [join $genre "_"] @@ -282,7 +283,8 @@ proc ::dialog_search::results_epilog {widget} { $widget insert 1.end [lindex $count $i] "$tag navbar" incr i } - $widget insert 1.end " matches out of [llength $filelist] docs" "navbar" + $widget insert 1.end \ + [format [_ " matches out of %s docs"] [llength $filelist]] "navbar" $widget configure -state disabled } @@ -397,9 +399,9 @@ proc ::dialog_search::printresult {filename basedir file_contents widget mixed_d set title $filename } if {[regexp -nocase {license\.txt} $filename]} { - set description "text of the license for this software" + set description [_ "text of the license for this software"] } elseif {[regexp -nocase {readme\.txt} $filename]} { - set description "general information from the author" + set description [_ "general information from the author"] } else { regexp -nocase -- "#X text \[0-9\]+ \[0-9\]+ description\[:\]? (.*?);.*" $file_contents -> description regsub -all {[{}\\]} $description {} description @@ -435,11 +437,11 @@ proc ::dialog_search::printresult {filename basedir file_contents widget mixed_d $widget insert end "$basedir" basedir $widget insert end "$filename" filename if { $description eq "" } { - set description "No DESCRIPTION tag." + set description [_ "No DESCRIPTION tag."] } $widget insert end "\n$description\n" "description $genre_name" if { $keywords ne "" } { - $widget insert end "Keywords:" "metakey $genre_name" + $widget insert end [_ "Keywords:"] "metakey $genre_name" set i 0 foreach value $keywords { set metavalue "metavalue$i" @@ -483,15 +485,15 @@ proc ::dialog_search::intro { t } { variable navbar {} $t configure -state normal $t delete 0.0 end - $t insert end "Enter terms above. Use the dropdown " homepage_description - $t insert end "menu to filter by category.\n" homepage_description - $t insert end "Browse the Documentation\n" homepage_title - $t insert end "The \"doc\" directory" "link clickable_dir intro_link0" + $t insert end [_ "Enter terms above. Use the dropdown "] homepage_description + $t insert end [_ "menu to filter by category.\n"] homepage_description + $t insert end [_ "Browse the Documentation\n"] homepage_title + $t insert end [_ "The \"doc\" directory"] "link clickable_dir intro_link0" $t insert end [file join $::sys_libdir doc] basedir $t insert end "0" is_libdir $t insert end "\n" description - $t insert end "External Pd libraries\n" "link libdirs intro_libdirs" - $t insert end "Introductory Topics\n" homepage_title + $t insert end [_ "External Pd libraries\n"] "link libdirs intro_libdirs" + $t insert end [_ "Introductory Topics\n"] homepage_title set intro_docs { \ "Pd Manual" 1.manual "HTML manual for Pure Data" \ "Control Structure" 2.control.examples "tutorials for control objects" \ @@ -506,20 +508,20 @@ proc ::dialog_search::intro { t } { $t insert end " $desc\n" description set i [expr {($i+1)%30}] } - $t insert end "All About Pd" "link homepage_file" + $t insert end [_ "All About Pd"] "link homepage_file" $t insert end [file join $::sys_libdir doc 5.reference] basedir $t insert end all_about.pd filename - $t insert end " reference patches for key concepts and settings\ - in Pd\n" description - $t insert end "Advanced Topics\n" homepage_title + $t insert end [_ " reference patches for key concepts and settings\ + in Pd\n"] description + $t insert end [_ "Advanced Topics\n"] homepage_title set advanced_docs [list \ - "Networking" [file join manuals 3.Networking] "sending data over networks with Pd" \ - "Writing Externals" 6.externs "how to code control and signal objects in C" \ - "Data Structures" 4.data.structures "creating graphical objects in Pure Data" \ - "Dynamic Patching" [file join manuals pd-msg] "programmatically create/destroy Pd\ - objects" \ - "Implementation Details" [file join manuals Pd] "file format specification, license text,\ - etc." + [_ "Networking"] [file join manuals 3.Networking] [_ "sending data over networks with Pd"] \ + [_ "Writing Externals"] 6.externs [_ "how to code control and signal objects in C"] \ + [_ "Data Structures"] 4.data.structures [_ "creating graphical objects in Pure Data"] \ + [_ "Dynamic Patching"] [file join manuals pd-msg] [_ "programmatically create/destroy Pd\ + objects"] \ + [_ "Implementation Details"] [file join manuals Pd] [_ "file format specification, license text,\ + etc."] ] set i 0 foreach {title dir desc} $advanced_docs { @@ -530,10 +532,10 @@ proc ::dialog_search::intro { t } { $t insert end " $desc\n" description set i [expr {($i+1)%30}] } - $t insert end "Keywords\n" homepage_title - $t insert end "Many of the help documents are categorized by keyword. Click\ + $t insert end [_ "Keywords\n"] homepage_title + $t insert end [_ "Many of the help documents are categorized by keyword. Click\ a link below to search for documents that have been tagged with that\ - keyword.\n" \ + keyword.\n"] \ homepage_description set keywords { \ {abstraction "object itself is written in Pure Data"} \ @@ -654,7 +656,7 @@ proc ::dialog_search::print_libdirs {textwidget libdirs} { variable navbar {} $textwidget configure -state normal $textwidget delete 0.0 end - lappend navbar [list "External libraries" "link libdirs navbar" {}] + lappend navbar [list [_ "External libraries"] "link libdirs navbar" {}] print_navbar $textwidget # now clear out the navbar and then add "externals (flag) to it..." set i 0 @@ -676,7 +678,7 @@ proc ::dialog_search::print_libdirs {textwidget libdirs} { regsub -all { \\,} $description {,} description $textwidget insert end "$description\n" description } else { - $textwidget insert end "no DESCRIPTION tag or values.\n" description + $textwidget insert end [_ "no DESCRIPTION tag or values.\n"] description } foreach tag {Author License Version} { if {[regexp -nocase -- "#X text \[0-9\]+ \[0-9\]+ $tag (.*?);.*" [join $file_contents] -> values]} { @@ -751,7 +753,7 @@ proc ::dialog_search::print_navbar {text} { variable navbar set separator - $text insert 1.0 "\n" navbar - $text insert 1.0 "Home" "link intro navbar" + $text insert 1.0 [_ "Home"] "link intro navbar" if {[llength $navbar] == 0} {return} for {set i 0} {$i<[expr {[llength $navbar]-1}]} {incr i} { $text insert 1.end " $separator " navbar @@ -786,8 +788,8 @@ proc ::dialog_search::get_info {xpos ypos mytoplevel} { set meta [format "%s-meta.pd" [file tail $fulldir]] if {[regexp {5.reference} $fulldir]} { tk_messageBox -message {Internal Object} \ - -detail {This help patch is for an internal Pd class} \ - -parent $mytoplevel -title Search + -detail [_ "This help patch is for an internal Pd class"] \ + -parent $mytoplevel -title [_ "Search"] set match 1 } else { # check for a readme file (use libname-meta.pd as a last resort) @@ -800,8 +802,9 @@ proc ::dialog_search::get_info {xpos ypos mytoplevel} { } } if {!$match} { - tk_messageBox -message {Sorry, can't find a README file\ - for this object's library.} -title Search + tk_messageBox -message \ + [_ "Sorry, can't find a README file for this object's library." \ + -title [_ "Search"] } } @@ -848,7 +851,7 @@ proc ::dialog_search::create_dialog {mytoplevel} { -padx 8 -pady 4 -spacing3 2 ttk::scrollbar $mytoplevel.yscrollbar -command "$mytoplevel.resultstext yview" \ -takefocus 0 - ttk::label $mytoplevel.statusbar -text "Pure Data Search" -justify left \ + ttk::label $mytoplevel.statusbar -text [_ "Pure Data Search"] -justify left \ -padding {4 4 4 4} grid $mytoplevel.f.genrebox $mytoplevel.f.matchall_check \ @@ -893,13 +896,13 @@ proc ::dialog_search::create_dialog {mytoplevel} { $mytoplevel.resultstext tag bind intro "::dialog_search::intro \ $mytoplevel.resultstext" $mytoplevel.resultstext tag bind intro "$mytoplevel.statusbar \ - configure -text \"Go back to the main help page\"" + configure -text \"[_ {Go back to the main help page}]\"" $mytoplevel.resultstext tag bind intro "$mytoplevel.statusbar \ configure -text \"\"" $mytoplevel.resultstext tag bind libdirs "::dialog_search::build_libdirs \ $mytoplevel.resultstext" $mytoplevel.resultstext tag bind libdirs "$mytoplevel.statusbar configure \ - -text \"Browse all external libraries that have the libdir format\"" + -text \"[_ {Browse all external libraries that have the libdir format}]\"" $mytoplevel.resultstext tag bind libdirs "$mytoplevel.statusbar configure \ -text \"\"" # hack to force new events for tags and links next to each other -- cgit v1.2.1