--- loncom/interface/loncommon.pm 2003/09/19 15:06:42 1.121 +++ loncom/interface/loncommon.pm 2003/10/05 00:44:44 1.126 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.121 2003/09/19 15:06:42 albertel Exp $ +# $Id: loncommon.pm,v 1.126 2003/10/05 00:44:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,6 +80,7 @@ my $readit; # ----------------------------------------------- Filetypes/Languages/Copyright my %language; +my %supported_language; my %cprtag; my %fe; my %fd; my %category_extensions; @@ -146,8 +147,11 @@ BEGIN { while (<$fh>) { next if /^\#/; chomp; - my ($key,$two,$country,$three,$enc,$val)=(split(/\t/,$_)); + my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$_)); $language{$key}=$val.' - '.$enc; + if ($sup) { + $supported_language{$key}=$sup; + } } } } @@ -1505,7 +1509,10 @@ returns description of a specified langu =cut sub languagedescription { - return $language{shift(@_)}; + my $code=shift; + return ($supported_language{$code}?'* ':''). + $language{$code}. + ($supported_language{$code}?' ('.&mt('interface available').')':''); } =pod @@ -1664,10 +1671,6 @@ sub preferred_languages { return @genlanguages; } -sub current_language { - return (&preferred_languages)[0]; -} - ############################################################### ## Student Answer Attempts ## ############################################################### @@ -2325,6 +2328,14 @@ sub no_cache { #$r->header_out("Expires" => $date); } +sub content_type { + my ($r,$type,$charset) = @_; + unless ($charset) { + $charset=&Apache::lonlocal::current_encoding; + } + $r->content_type($type.($charset?'; charset='.$charset:'')); +} + =pod =item * add_to_env($name,$value)