--- loncom/homework/structuretags.pm 2007/09/10 13:39:16 1.393 +++ loncom/homework/structuretags.pm 2007/09/10 16:25:38 1.394 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.393 2007/09/10 13:39:16 www Exp $ +# $Id: structuretags.pm,v 1.394 2007/09/10 16:25:38 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1140,17 +1140,25 @@ sub start_languageblock { $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') { my $include = $token->[2]->{'include'}; my $exclude = $token->[2]->{'exclude'}; - my %languages=&Apache::loncommon::display_languages(); + my $preferred_language=(&Apache::loncommon::preferred_languages)[0]; +# This should not even happen, since we should at least have the server language + unless ($preferred_language) { $preferred_language='en'; } +# If the languageblock has no arguments, show the contents $result='1'; +# Do we have an include argument? if ($include) { +# If include is specified, by default, don't render the block $result=''; - foreach (split(/\,/,$include)) { - if ($languages{$_}) { $result='1'; } + foreach my $included_language (split(/\,/,$include)) { +# ... but if my preferred language is included, render it + if ($included_language eq $preferred_language) { $result='1'; } } } +# Do we have an exclude argument? if ($exclude) { - foreach (split(/\,/,$exclude)) { - if ($languages{$_}) { $result='0'; } + $result='1'; + foreach my $excluded_language (split(/\,/,$exclude)) { + if ($excluded_language eq $preferred_language) { $result='0'; } } } if ( ! $result ) {