Skip to content

Commit

Permalink
Move locale setup to 'new'
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemhall committed Dec 4, 2023
1 parent 6b6df66 commit 4ae7de4
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions Koha/Plugin/Com/MarywoodUniversity/RoomReservations.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ our $equipment_index = $prefix . 'bookingequipment_idx';
our $roomequipment_table = $prefix . 'booking_room_equipment';
our $roomequipment_index = $prefix . 'bookingroomequipment_idx';

# set locale settings for gettext
my $self = new('Koha::Plugin::Com::MarywoodUniversity::RoomReservations');
my $cgi = $self->{'cgi'};

my $locale = C4::Languages::getlanguage($cgi);
$locale = substr( $locale, 0, 2 );
$ENV{'LANGUAGE'} = $locale;
setlocale Locale::Messages::LC_ALL(), '';
textdomain "com.marywooduniversity.roomreservations";

my $locale_path = abs_path( $self->mbf_path('translations') );
bindtextdomain "com.marywooduniversity.roomreservations" => $locale_path;

our $metadata = {
name => getTranslation('Room Reservations Plugin'),
author => 'Lee Jamison',
Expand Down Expand Up @@ -80,6 +67,18 @@ sub new {
## and returns our actual $self
my $self = $class->SUPER::new($args);

# set locale settings for gettext
my $cgi = $self->{'cgi'};

my $locale = C4::Languages::getlanguage($cgi);
$locale = substr( $locale, 0, 2 );
$ENV{'LANGUAGE'} = $locale;
setlocale Locale::Messages::LC_ALL(), '';
textdomain "com.marywooduniversity.roomreservations";

my $locale_path = abs_path( $self->mbf_path('translations') );
bindtextdomain "com.marywooduniversity.roomreservations" => $locale_path;

return $self;
}

Expand Down

0 comments on commit 4ae7de4

Please sign in to comment.