[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm /localize/localize de.pm es.pm pt.pm zh.pm /xml run.pm
bisitz
bisitz at source.lon-capa.org
Wed Dec 4 10:57:20 EST 2013
bisitz Wed Dec 4 15:57:20 2013 EDT
Modified files:
/loncom/homework structuretags.pm
/loncom/xml run.pm
/loncom/localize/localize de.pm es.pm pt.pm zh.pm
Log:
Proper internationalization of "Code ran too long" and other runtime error messages:
- Added missing &mt() calls
- Translate only after concatenation
- Re-use same phrases
- Updated related phrases in translation files
-------------- next part --------------
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.515 loncom/homework/structuretags.pm:1.516
--- loncom/homework/structuretags.pm:1.515 Thu Sep 5 12:07:29 2013
+++ loncom/homework/structuretags.pm Wed Dec 4 15:57:12 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.515 2013/09/05 12:07:29 goltermann Exp $
+# $Id: structuretags.pm,v 1.516 2013/12/04 15:57:12 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2057,9 +2057,15 @@
}
$return = &Apache::run::run($code,$safeeval);
}
- if ($error) {
- &Apache::lonxml::error('<pre>'.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occurred while running <while> on line').' '.$line.'</pre>');
- }
+ if ($error) {
+ &Apache::lonxml::error(
+ '<pre>'
+ .&mt('Code ran too long. It ran for more than [_1] seconds.',
+ $Apache::lonnet::perlvar{'lonScriptTimeout'})
+ .&mt('This occurred while running <while> on line [_1].',
+ $line)
+ .'</pre>');
+ }
} elsif ($target eq "edit") {
$result.= &Apache::edit::tag_end($target,$token,'');
}
Index: loncom/xml/run.pm
diff -u loncom/xml/run.pm:1.61 loncom/xml/run.pm:1.62
--- loncom/xml/run.pm:1.61 Tue Dec 18 18:27:43 2012
+++ loncom/xml/run.pm Wed Dec 4 15:57:15 2013
@@ -1,6 +1,6 @@
package Apache::run;
#
-# $Id: run.pm,v 1.61 2012/12/18 18:27:43 raeburn Exp $
+# $Id: run.pm,v 1.62 2013/12/04 15:57:15 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,7 @@
#
use HTML::Entities;
+use Apache::lonlocal;
$Apache::run::EVALUATE_STRING=<<'ENDEVALUATE';
my %_LONCAPA_INTERNAL_oldexpressions=();
@@ -95,20 +96,20 @@
$result = $safeeval->reval('return $_;');
chomp $result;
} else {
- if ($Apache::run::timeout) {
- $error = 'Code ran too long. It ran for more than '.
- $Apache::lonnet::perlvar{'lonScriptTimeout'}.' seconds';
- }
- &Apache::lonxml::error('substitution on <pre>'.
- &HTML::Entities::encode($expression,'<>&"').
- '</pre> with <pre>'.
- &HTML::Entities::encode($decls,'<>&"').
- '</pre> caused <pre>'.
- &HTML::Entities::encode($error,'<>&"').' '.
- &HTML::Entities::encode($innererror,'<>&"').
- '</pre>');
+ if ($Apache::run::timeout) {
+ $error =
+ &mt('Code ran too long. It ran for more than [_1] seconds.',
+ $Apache::lonnet::perlvar{'lonScriptTimeout'});
+ }
+ &Apache::lonxml::error(
+ &mt('Substitution on [_1] with [_2] caused:',
+ '<pre>'. &HTML::Entities::encode($expression,'<>&"').'</pre>',
+ '<pre>'.&HTML::Entities::encode($decls,'<>&"').'</pre>')
+ .'<br />'
+ .'<pre>'.&HTML::Entities::encode($error,'<>&"').' '
+ .&HTML::Entities::encode($innererror,'<>&"').'</pre>');
}
- return $result
+ return $result;
}
sub run {
@@ -129,24 +130,27 @@
};
my $error=$@;
if (($Apache::run::timeout || $error ne '' || $innererror ne '') && !$hideerrors) {
- if ($Apache::run::timeout) {
- $error = 'Code ran too long. It ran for more than '.
- $Apache::lonnet::perlvar{'lonScriptTimeout'}.' seconds';
- }
- my $errormsg='<pre>'.&HTML::Entities::encode($error,'<>&"').' '.
- &HTML::Entities::encode($innererror,'<>&"').
- '</pre> occurred while running <pre>';
- $code=&HTML::Entities::encode($code,'<>&"');
- if ($innererror=~/line (\d+)/) {
- my $linenumber=$1;
- my @code=split("\n",$code);
- if ($linenumber < scalar(@code)) {
- $code[$linenumber-1]='<b><font color="red">'.
- $code[$linenumber-1].'</font></b>';
- }
- $code=join("\n", at code);
- }
- &Apache::lonxml::error($errormsg.$code.'</pre>');
+ if ($Apache::run::timeout) {
+ $error = &mt('Code ran too long. It ran for more than [_1] seconds.',
+ $Apache::lonnet::perlvar{'lonScriptTimeout'});
+ }
+ $code=&HTML::Entities::encode($code,'<>&"');
+ if ($innererror=~/line (\d+)/) {
+ my $linenumber=$1;
+ my @code=split("\n",$code);
+ if ($linenumber < scalar(@code)) {
+ $code[$linenumber-1]=
+ '<span style="color:red;font-weight:bold;">'.
+ $code[$linenumber-1].'</span>';
+ }
+ $code=join("\n", at code);
+ }
+ &Apache::lonxml::error(
+ '<pre>'.&HTML::Entities::encode($error,'<>&"').' '.
+ &HTML::Entities::encode($innererror,'<>&"').
+ '</pre>'
+ .&mt('This occurred while running: [_1]',
+ '<pre>'.$code.'</pre>'));
}
if ( $#result < '1') {
return $result[0];
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.558 loncom/localize/localize/de.pm:1.559
--- loncom/localize/localize/de.pm:1.558 Tue Dec 3 18:44:49 2013
+++ loncom/localize/localize/de.pm Wed Dec 4 15:57:18 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# German Localization Lexicon
#
-# $Id: de.pm,v 1.558 2013/12/03 18:44:49 bisitz Exp $
+# $Id: de.pm,v 1.559 2013/12/04 15:57:18 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -9793,9 +9793,6 @@
'ERROR:'
=> 'FEHLER:',
- 'occurred while running'
-=> 'trat auf während der Ausführung von',
-
'(click for example)'
=> '(Klicken für Beispiel)',
@@ -12586,11 +12583,17 @@
'An error occurred while processing this resource. The author has been notified.'
=> 'Während der Verarbeitung dieser Ressource ist ein Fehler aufgetreten. Der Autor wurde informiert.',
- 'Code ran too long. It ran for more than'
-=> 'Die Ausführung hat zu lange gedauert. Sie dauerte länger als',
+ 'Code ran too long. It ran for more than [_1] seconds.'
+=> 'Die Ausführung hat zu lange gedauert ("Code ran too long"). Sie dauerte länger als [_1] Sekunden.',
+
+ 'This occurred while running <while> on line [_1].'
+=> 'Dies trat während der Ausführung von <while> in der Zeile [_1] auf.',
+
+ 'This occurred while running: [_1]'
+=> 'Dies trat auf während der Ausführung von: [_1]',
- 'seconds occurred while running <while> on line'
-=> 'Sekunden, während <while> ausgeführt wurde in Zeile',
+ 'Substitution on [_1] with [_2] caused:'
+=> 'Ersetzung von [_1] durch [_2] hat verursacht:',
'Correct answer'
=> 'Korrekte Antwort',
Index: loncom/localize/localize/es.pm
diff -u loncom/localize/localize/es.pm:1.74 loncom/localize/localize/es.pm:1.75
--- loncom/localize/localize/es.pm:1.74 Fri Aug 9 17:14:54 2013
+++ loncom/localize/localize/es.pm Wed Dec 4 15:57:18 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Spanish Localization Lexicon
#
-# $Id: es.pm,v 1.74 2013/08/09 17:14:54 bisitz Exp $
+# $Id: es.pm,v 1.75 2013/12/04 15:57:18 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8733,9 +8733,6 @@
'ERROR:'
=> 'ERROR:',
- 'occurred while running'
-=> 'ocurrió mientras corrÃa',
-
'(click for example)'
=> '(pulsar para ejemplo)',
@@ -11208,11 +11205,17 @@
'An error occurred while processing this resource. The author has been notified.'
=> 'Ocurrió un error mientras se procesaba este recurso. El autor fue notificado.',
- 'Code ran too long. It ran for more than'
-=> 'La ejecución del código tomó mucho tiempo. Corrió por más de',
+ 'Code ran too long. It ran for more than [_1] seconds.'
+=> 'La ejecución del código tomó mucho tiempo. Corrió por más de [_1] segundos.',
+
+ 'This occurred while running <while> on line [_1].'
+=> 'This occurred while running <while> on line [_1].', # '... ocurrió mientras se ejecutaba <while> en lÃnea [_1].',
+
+ 'This occurred while running: [_1]'
+=> 'This occurred while running: [_1]', # '... ocurrió mientras corrÃa: [_1]',
- 'seconds occurred while running <while> on line'
-=> 'segundos, ocurrió mientras se ejecutaba <while> en lÃnea',
+ 'Substitution on [_1] with [_2] caused:'
+=> 'Substitution on [_1] with [_2] caused:',
'Student View'
=> 'Vista de Estudiante',
Index: loncom/localize/localize/pt.pm
diff -u loncom/localize/localize/pt.pm:1.65 loncom/localize/localize/pt.pm:1.66
--- loncom/localize/localize/pt.pm:1.65 Mon Sep 23 17:34:58 2013
+++ loncom/localize/localize/pt.pm Wed Dec 4 15:57:18 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Portuguese Localization Lexicon
#
-# $Id: pt.pm,v 1.65 2013/09/23 17:34:58 bisitz Exp $
+# $Id: pt.pm,v 1.66 2013/12/04 15:57:18 bisitz Exp $
#
# Copyright UNICAMP, Sao Paulo
# Supported in part by Partnership in Global Learning
@@ -8577,9 +8577,6 @@
'Code'
=> 'Code',
- 'Code ran too long. It ran for more than'
-=> 'Code ran too long. It ran for more than',
-
'Collaborated with [_1]'
=> 'Collaborated with [_1]',
@@ -21411,9 +21408,6 @@
'numerical'
=> 'numerical',
- 'occurred while running'
-=> 'occurred while running',
-
'off'
=> 'off',
@@ -21573,8 +21567,17 @@
'search discussion postings (resources and discussion boards)'
=> 'search discussion postings (resources and discussion boards)',
- 'seconds occurred while running <while> on line'
-=> 'seconds occurred while running <while> on line',
+ 'Code ran too long. It ran for more than [_1] seconds.'
+=> 'Code ran too long. It ran for more than [_1] seconds.',
+
+ 'This occurred while running <while> on line [_1].'
+=> 'This occurred while running <while> on line [_1].',
+
+ 'This occurred while running: [_1]'
+=> 'This occurred while running: [_1]',
+
+ 'Substitution on [_1] with [_2] caused:'
+=> 'Substitution on [_1] with [_2] caused:',
'secs ago'
=> 'secs ago',
Index: loncom/localize/localize/zh.pm
diff -u loncom/localize/localize/zh.pm:1.113 loncom/localize/localize/zh.pm:1.114
--- loncom/localize/localize/zh.pm:1.113 Fri Nov 29 14:07:09 2013
+++ loncom/localize/localize/zh.pm Wed Dec 4 15:57:19 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Chinese Simplified Localization Lexicon
#
-# $Id: zh.pm,v 1.113 2013/11/29 14:07:09 bisitz Exp $
+# $Id: zh.pm,v 1.114 2013/12/04 15:57:19 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8583,9 +8583,6 @@
'ERROR:'
=> 'é误ï¼',
- 'occurred while running'
-=> 'occurred while running',
-
'(click for example)'
=> '(click for example)',
@@ -11060,11 +11057,17 @@
'An error occurred while processing this resource. The author has been notified.'
=> 'An error occurred while processing this resource. The author has been notified.',
- 'Code ran too long. It ran for more than'
-=> 'Code ran too long. It ran for more than',
+ 'Code ran too long. It ran for more than [_1] seconds.'
+=> 'Code ran too long. It ran for more than [_1] seconds.',
+
+ 'This occurred while running <while> on line [_1].'
+=> 'This occurred while running <while> on line [_1].',
+
+ 'This occurred while running: [_1]'
+=> 'This occurred while running: [_1]',
- 'seconds occurred while running <while> on line'
-=> 'seconds occurred while running <while> on line',
+ 'Substitution on [_1] with [_2] caused:'
+=> 'Substitution on [_1] with [_2] caused:',
'Student View'
=> 'å¦çè§é',
More information about the LON-CAPA-cvs
mailing list