Diff for /loncom/localize/lonlocal.pm between versions 1.61 and 1.64

version 1.61, 2010/07/07 16:30:48 version 1.64, 2012/10/25 13:47:31
Line 81  Inside might be something like this Line 81  Inside might be something like this
      if ($status eq 'WON') {       if ($status eq 'WON') {
         $message='You have won.';          $message='You have won.';
      } elsif ($status eq 'LOST') {       } elsif ($status eq 'LOST') {
         $message='You are a total looser.';          $message='You are a total loser.';
      }       }
      return $message;       return $message;
  }   }
Line 103  The first two examples are easy: Line 103  The first two examples are easy:
      if ($status eq 'WON') {       if ($status eq 'WON') {
         $message='You have won.';          $message='You have won.';
      } elsif ($status eq 'LOST') {       } elsif ($status eq 'LOST') {
         $message='You are a total looser.';          $message='You are a total loser.';
      }       }
      return &mt($message);       return &mt($message);
  }   }
Line 135  like this: Line 135  like this:
     'You have won.'      'You have won.'
  => 'Sie haben gewonnen.',   => 'Sie haben gewonnen.',
   
     'You are a total looser.'      'You are a total loser.'
  => 'Sie sind der totale Verlierer.',   => 'Sie sind der totale Verlierer.',
   
     'Rules'      'Rules'
Line 264  sub preferred_languages { Line 264  sub preferred_languages {
   
     my $defdom = &Apache::lonnet::default_login_domain();      my $defdom = &Apache::lonnet::default_login_domain();
     foreach my $domtype ($Apache::lonnet::env{'user.domain'},$Apache::lonnet::env{'request.role.domain'},$defdom) {      foreach my $domtype ($Apache::lonnet::env{'user.domain'},$Apache::lonnet::env{'request.role.domain'},$defdom) {
         if ($domtype ne '') {          if (($domtype ne '') && ($domtype ne 'public')) {
             my %domdefs = &Apache::lonnet::get_domain_defaults($domtype);              my %domdefs = &Apache::lonnet::get_domain_defaults($domtype);
             if ($domdefs{'lang_def'} ne '') {              if ($domdefs{'lang_def'} ne '') {
                 push(@languages,$domdefs{'lang_def'});                  push(@languages,$domdefs{'lang_def'});
Line 334  sub texthash { Line 334  sub texthash {
 # ========= Get a handle (do not invoke in vain, leave this to access handlers)  # ========= Get a handle (do not invoke in vain, leave this to access handlers)
   
 sub get_language_handle {  sub get_language_handle {
     my $r=shift;      my ($r,$chosen) = @_;
     if ($r) {      if ($r) {
  my $headers=$r->headers_in;   my $headers=$r->headers_in;
  $ENV{'HTTP_ACCEPT_LANGUAGE'}=$headers->{'Accept-language'};   $ENV{'HTTP_ACCEPT_LANGUAGE'}=$headers->{'Accept-language'};
     }      }
     my @languages=&preferred_languages();      my @languages;
       if ($chosen ne '') {
           @languages=($chosen);
       } else {
           @languages=&preferred_languages();
       }
     $ENV{'HTTP_ACCEPT_LANGUAGE'}='';      $ENV{'HTTP_ACCEPT_LANGUAGE'}='';
     $lh=Apache::localize->get_handle(@languages);      $lh=Apache::localize->get_handle(@languages);
     $current_language=&current_language();      $current_language=&current_language();
Line 377  sub gettimezone { Line 382  sub gettimezone {
         if ($uroledomdefs{'timezone_def'} ne '') {          if ($uroledomdefs{'timezone_def'} ne '') {
             $timezone = $uroledomdefs{'timezone_def'};              $timezone = $uroledomdefs{'timezone_def'};
         }          }
     } elsif ($Apache::lonnet::env{'user.domain'} ne '') {      } elsif (($Apache::lonnet::env{'user.domain'} ne '') && 
                ($Apache::lonnet::env{'user.domain'} ne 'public')) {
         my %udomdefaults =           my %udomdefaults = 
             &Apache::lonnet::get_domain_defaults($Apache::lonnet::env{'user.domain'});              &Apache::lonnet::get_domain_defaults($Apache::lonnet::env{'user.domain'});
         if ($udomdefaults{'timezone_def'} ne '') {          if ($udomdefaults{'timezone_def'} ne '') {
Line 569  sub mt_escape { Line 575  sub mt_escape {
     $$str_ref =~s/([\[\]])/~$1/g;      $$str_ref =~s/([\[\]])/~$1/g;
 }  }
   
   =pod
   
   =item * choose_language
   
   choose_language prompts a user to enter a two letter language code via
   keyboard when running a script from the command line. Default is en.
   
   =cut
   
   sub choose_language {
       my %languages = (
                         ar => 'Arabic',
                         de => 'German',
                         en => 'English',
                         es => 'Spanish',
                         fa => 'Persian',
                         fr => 'French',
                         he => 'Hebrew',
                         ja => 'Japanese',
                         pt => 'Portuguese',
                         ru => 'Russian',
                         tr => 'Turkish',
                         zh => 'Chinese (Simplified)'
                      );
       my @posslangs = sort(keys(%languages));
       my $langlist = join('|',@posslangs);
       my $lang = 'en';
       print 'Language: English (en). Change? ['.$langlist.']? ';
       my $langchoice = <STDIN>;
       chomp($langchoice);
       $langchoice =~ s/(^\s+|\s+$)//g;
       $langchoice = lc($langchoice);
       if (defined($languages{$langchoice})) {
           $lang = $langchoice;
       }
       return $lang;
   }
   
 1;  1;
   
 __END__  __END__

Removed from v.1.61  
changed lines
  Added in v.1.64


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.