[LON-CAPA-cvs] cvs: loncom /homework imagechoice.pm
bisitz
bisitz at source.lon-capa.org
Fri Feb 14 12:01:30 EST 2014
bisitz Fri Feb 14 17:01:30 2014 EDT
Modified files:
/loncom/homework imagechoice.pm
Log:
- Internationalization:
- Added missing &mt() calls
- More flexible usage of button texts / re-use existing phrases
- Standard... headline, size, button texts, styles
- Improved wording; punctuation
- Mechanism which button was clicked more robust now
Index: loncom/homework/imagechoice.pm
diff -u loncom/homework/imagechoice.pm:1.17 loncom/homework/imagechoice.pm:1.18
--- loncom/homework/imagechoice.pm:1.17 Mon May 11 16:51:22 2009
+++ loncom/homework/imagechoice.pm Fri Feb 14 17:01:30 2014
@@ -1,4 +1,4 @@
-# $Id: imagechoice.pm,v 1.17 2009/05/11 16:51:22 bisitz Exp $
+# $Id: imagechoice.pm,v 1.18 2014/02/14 17:01:30 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -59,13 +59,12 @@
my $end_page =
&Apache::loncommon::end_page();
- $r->print(<<"ENDSUBM");
-$start_page
-<h3>Position Selected</h3>
-$display
-$needimage
-$end_page
-ENDSUBM
+ $r->print(
+ $start_page
+ .'<h1>'.&mt('Position Selected').'</h1>'
+ .$display
+ .$needimage
+ .$end_page);
}
sub storedata {
@@ -89,11 +88,11 @@
my (undef,$x,$y)=split(':',$env{"imagechoice.$id.coords"});
if ($env{"imagechoice.$id.formx"}) {
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formx"}.'.value='.$x.';';
- $display.="<p>The X coordinate is $x</p>\n";
+ $display.='<p>'.&mt('The X coordinate is [_1]',$x)."</p>\n";
}
if ($env{"imagechoice.$id.formy"}) {
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formy"}.'.value='.$y.';';
- $display.="<p>The Y coordinate is $y</p>\n";
+ $display.='<p>'.&mt('The Y coordinate is [_1]',$y)."</p>\n";
}
} elsif ($type eq 'polygon' or $type eq 'box') {
my $coordstr;
@@ -101,11 +100,13 @@
$coordstr.='('.shift(@coords).','.shift(@coords).')-';
}
chop($coordstr);
- $display.="<p>The selected coordinates are <tt>$coordstr</tt></p>\n";
+ $display.='<p>'.&mt('The selected coordinates are [_1]',"<tt>$coordstr</tt>")."</p>\n";
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formcoord"}.'.value="'.$coordstr.'";';
}
if ($display) {
- $display.="<p>If this window fails to close you may need to manually replace the old coordinates with the above value.</p>\n";
+ $display.='<p class="LC_info">'
+ .&mt('If this window fails to close you may need to manually replace the old coordinates with the above value.')
+ ."</p>\n";
}
&deletedata($id);
&closewindow($r,$output,$filename,$needimage,$display);
@@ -119,34 +120,38 @@
my (undef, at coords)=split(':',$env{"imagechoice.$id.coords"});
my $step=scalar(@coords)/2;
if ($step == 0) {
- $heading=&mt('Select First Coordinate on Image');
+ $heading=&mt('Select First Coordinate on Image.');
#$nextstage='<input type="hidden" name="type" value="pairtwo" />';
} elsif ($step == 1) {
- $heading=&mt('Select Second Coordinate on Image');
+ $heading=&mt('Select Second Coordinate on Image.');
#$nextstage='<input type="hidden" name="type" value="pairthree" />';
} else {
- $heading=&mt('Select Finish to save selection');
- $nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />';
+ $heading=&mt('Select [_1] to save selection.','"'.&mt('Save').'"');
+ $nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />';
}
} elsif ($type eq 'polygon') {
- $heading=&mt('Enter Coordinate or click finish to close Polygon');
- $nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />';
+ $heading=&mt('Click to select a Coordinate or click [_1] to close Polygon.',
+ '"'.&mt('Save').'"');
+ $nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />';
} elsif ($type eq 'point') {
- $heading=&mt('Click to select a Coordinate or click Finish to save current selection');
- $nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />';
+ $heading=&mt('Click to select a Coordinate or click [_1] to save current selection.',
+ '"'.&mt('Save').'"');
+ $nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />';
}
+ my $headline = 'Get Coordinates';
my $start_page =
- &Apache::loncommon::start_page('Get Coordinates',undef,
+ &Apache::loncommon::start_page($headline,undef,
{'bgcolor' => '#FFFFFF',
'only_body' => 1,});
-
my $end_page =
&Apache::loncommon::end_page();
+ $headline = &mt($headline);
my $canceltext=&mt('Cancel');
$r->print(<<"END");
$start_page
-<h3>$heading</h3>
+<h1>$headline</h1>
+<p>$heading</p>
<form method="post" action="/adm/imagechoice?token=$id">
$nextstage
<input type="submit" name="cancel" value="$canceltext" />
@@ -251,7 +256,7 @@
my (undef,$id) = split(/=/,$ENV{'QUERY_STRING'});
my $filename = &unescape($env{"imagechoice.$id.file"});
my $formname = $env{"imagechoice.$id.formname"};
- if ($env{'form.cancel'} eq &mt('Cancel')) {
+ if ($env{'form.cancel'}) { # eq &mt('Cancel')) {
&deletedata($id);
&closewindow($r,'',$filename);
return OK;
@@ -260,7 +265,7 @@
if (defined($env{'form.type'})) { $type=$env{'form.type'}; }
my $numcoords=&savecoord($id,$type);
my $imurl=&drawimage($r,$type,$filename,$id);
- if ($env{'form.finish'} eq &mt('Finish')) {
+ if ($env{'form.finish'}) { # eq &mt('Save')) {
&storedata($r,$type,$imurl,$id);
} else {
&getcoord($r,$type,$imurl,$id);
More information about the LON-CAPA-cvs
mailing list