diff --git a/bin/access-check-manager.cgi.in b/bin/access-check-manager.cgi.in index 9cf8b59d95070c0d26064314480b3ebf2b690e6e..bac9ef59d066566ced30526aa50e58eb749c5e17 100755 --- a/bin/access-check-manager.cgi.in +++ b/bin/access-check-manager.cgi.in @@ -6,6 +6,7 @@ use utf8; use lib qw(@modulesdir@); use Config::Tiny; +use File::Basename; use AccountManager::App; @@ -16,8 +17,11 @@ if (!$configuration) { die Config::Tiny->errstr() . "\n"; } +my $configuration_directory = dirname($configuration_file); + my $app = AccountManager::App->new( - configuration => $configuration + configuration => $configuration, + custom_l10n => sprintf("%s/l10n", $configuration_directory) ); $app->run(); diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index f7af532142b8c3d7138d035964e1b063aff7e8e2..ff5f2d06d746a9a5f94c3a6629e5fb1bda1c57a8 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -87,6 +87,7 @@ sub new { } ); } + $self->{lh}->load_custom_lexicon($args{custom_l10n}); if (!$self->{configuration}->{mailer}) { $self->{logger}->fatal( diff --git a/lib/AccountManager/L10N.pm b/lib/AccountManager/L10N.pm index 515c038545977d603e837dc509faa3c57dd0f0ec..c8c17b4d4ab8331702c2caaa9138041f65d9d621 100644 --- a/lib/AccountManager/L10N.pm +++ b/lib/AccountManager/L10N.pm @@ -4,5 +4,20 @@ use strict; use warnings; use base 'Locale::Maketext'; +use Locale::Maketext::Lexicon::Gettext; + +sub load_custom_lexicon { + my ($self, $directory) = @_; + + my $language = $self->language_tag(); + + my $lexicon_file = sprintf("%s/%s.po", $directory , $language); + return unless -f $lexicon_file; + + Locale::Maketext::Lexicon->import({ + $language => [Gettext => $lexicon_file], + _decode => 1, + }); +} 1;