--- loncom/interface/loncommon.pm 2011/11/14 00:20:34 1.1028 +++ loncom/interface/loncommon.pm 2011/12/26 13:47:18 1.1028.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1028 2011/11/14 00:20:34 raeburn Exp $ +# $Id: loncommon.pm,v 1.1028.2.1 2011/12/26 13:47:18 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -154,6 +154,7 @@ sub ssi_with_retries { # ----------------------------------------------- Filetypes/Languages/Copyright my %language; my %supported_language; +my %latex_language; # Language name LaTeX uses for selecting hyphenation. my %cprtag; my %scprtag; my %fe; my %fd; my %fm; @@ -186,11 +187,14 @@ BEGIN { while (my $line = <$fh>) { next if ($line=~/^\#/); chomp($line); - my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$line)); + my ($key,$two,$country,$three,$enc,$val,$sup,$latex)=(split(/\t/,$line)); $language{$key}=$val.' - '.$enc; if ($sup) { $supported_language{$key}=$sup; } + if ($latex) { + $latex_language{$two} = $latex; + } } close($fh); } @@ -3230,17 +3234,50 @@ sub languagedescription { ($supported_language{$code}?' ('.&mt('interface available').')':''); } +=pod + +=item * &plainlanguagedescription + +Returns both the plain language description (e.g. 'Creoles and Pidgins, English-based (Other)') +and the language character encoding (e.g. ISO) separated by a ' - ' string. + +=cut + sub plainlanguagedescription { my $code=shift; return $language{$code}; } +=pod + +=item * &supportedlanguagecode + +Returns the supported language code (e.g. sptutf maps to pt) given a language +code. + +=cut + sub supportedlanguagecode { my $code=shift; return $supported_language{$code}; } =pod + +=item * &latexlanguage() + +Given a language key code returns the correspondnig language to use +to select the correct hyphenation on LaTeX printouts. This is undef if there +is no supported hyphenation for the language code. + +=cut + +sub latexlanguage { + my $code = shift; + return $latex_language{$code}; +} + +=pod =item * ©rightids()