--- loncom/interface/loncommon.pm 2008/09/11 21:05:19 1.685 +++ loncom/interface/loncommon.pm 2008/09/13 02:37:26 1.686 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.685 2008/09/11 21:05:19 tempelho Exp $ +# $Id: loncommon.pm,v 1.686 2008/09/13 02:37:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2988,14 +2988,19 @@ sub preferred_languages { } } } + return &get_genlanguages(@languages); +} + +sub get_genlanguages { + my (@languages) = @_; # turn "en-ca" into "en-ca,en" my @genlanguages; foreach my $lang (@languages) { - unless ($lang=~/\w/) { next; } - push(@genlanguages,$lang); - if ($lang=~/(\-|\_)/) { - push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); - } + unless ($lang=~/\w/) { next; } + push(@genlanguages,$lang); + if ($lang=~/(\-|\_)/) { + push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); + } } #uniqueify the languages list my %count;