--- loncom/homework/inputtags.pm 2012/12/28 16:12:07 1.313 +++ loncom/homework/inputtags.pm 2012/12/28 18:22:13 1.314 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.313 2012/12/28 16:12:07 raeburn Exp $ +# $Id: inputtags.pm,v 1.314 2012/12/28 18:22:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -266,8 +266,9 @@ sub start_textfield { my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser, $style); $result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2); + my $spell_langs = &spelling_languages(); $result .= &Apache::edit::select_arg('Spellcheck for:', 'spellcheck', - ['none', 'en', 'de', 'fr'], $token); + $spell_langs, $token); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'rows','cols', @@ -461,8 +462,9 @@ sub start_textline { 'addchars',$token,10); $result.=&Apache::edit::select_arg('Readonly:','readonly', ['no','yes'],$token); + my $spell_langs = &spelling_languages(); $result.=&Apache::edit::select_arg("Spellcheck for: ", 'spellcheck', - ['none', 'en', 'de', 'fr'], $token); + $spell_langs, $token); $result.=&Apache::edit::end_row(); $result.=&Apache::edit::end_table(); } elsif ($target eq 'modified') { @@ -1755,6 +1757,21 @@ sub get_tries_text { return $tries_text; } +sub spelling_languages { + my %langchoices; + foreach my $id (&Apache::loncommon::languageids()) { + my $code = &Apache::loncommon::supportedlanguagecode($id); + if ($code ne '') { + $langchoices{$code} = &Apache::loncommon::plainlanguagedescription($id); + } + } + my @spelllangs = ('none'); + foreach my $code ('en','de','he','es','fr','pt','tr') { + push(@spelllangs,[$code,$langchoices{$code}]); + } + return \@spelllangs; +} + 1; __END__