Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bed8ba6d

Von Moritz Bunkus vor etwa 14 Jahren hinzugefügt

  • ID bed8ba6d6cbcb0c8b33528bed6d49709d1ef6282
  • Vorgänger f5f077a7
  • Nachfolger b32553a3

Locale-Objekte pro Sprache cachen

Damit braucht die FastCGI-basierte Variante locale/de/all nicht bei
jedem Aufruf neu einzulesen.

Unterschiede anzeigen:

SL/Locale.pm
47 47

  
48 48
use strict;
49 49

  
50
my %locales_by_country;
51

  
50 52
sub new {
51 53
  $main::lxdebug->enter_sub();
52 54

  
......
56 58
  $country   =~ s|.*/||;
57 59
  $country   =~ s|\.||g;
58 60

  
59
  my $self = {};
60
  bless $self, $type;
61
  if (!$locales_by_country{$country}) {
62
    my $self = {};
63
    bless $self, $type;
64

  
65
    $self->_init($country);
61 66

  
62
  $self->_init($country);
67
    $locales_by_country{$country} = $self;
68
  }
63 69

  
64 70
  $main::lxdebug->leave_sub();
65 71

  
66
  return $self;
72
  return $locales_by_country{$country}
67 73
}
68 74

  
69 75
sub _init {

Auch abrufbar als: Unified diff