diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-08 23:32:10 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-08 23:32:10 +0200 |
commit | 926ec7a6b85e6e3f7335a8c5ddcccd51937ee2d8 (patch) | |
tree | b7a420a919d0146f2a0bd2e1e577b795fcb99202 /lib/JWebmail/Plugin/I18N2 | |
parent | 4510e3720274865996ef056f1687997ba0b482be (diff) |
added a build configuration step
Diffstat (limited to 'lib/JWebmail/Plugin/I18N2')
-rw-r--r-- | lib/JWebmail/Plugin/I18N2/Maketext.pm | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/JWebmail/Plugin/I18N2/Maketext.pm b/lib/JWebmail/Plugin/I18N2/Maketext.pm index ef3b08d..1046a99 100644 --- a/lib/JWebmail/Plugin/I18N2/Maketext.pm +++ b/lib/JWebmail/Plugin/I18N2/Maketext.pm @@ -1,12 +1,12 @@ package JWebmail::Plugin::I18N2::Maketext; -use v5.22; +use v5.24; use warnings; use utf8; use JWebmail::I18N; -use File::Basename 'fileparse'; +use Mojo::File qw(path curfile); use Role::Tiny::With; with 'JWebmail::Plugin::I18N2::Role'; @@ -16,19 +16,10 @@ sub new { my $class = shift; my $conf = @_ == 1 ? shift : {@_}; - my $lexica = $conf->{directory}; + my $lexica = curfile->dirname->child('..', '..', 'I18N'); - my @languages = keys %{$conf->{languages} // {}}; - - unless (@languages) { - use autodie; - - opendir(my $dh, $lexica); - my @res = grep { /\.pm$/ && -f "$lexica/$_" } readdir $dh; - closedir($dh); - @languages = map { scalar fileparse $_, '.pm' } @res; - @languages = map { my ($l, $c) = split '_', $_, 2; $c ? "$l-\U$c" : $l } @languages; - } + my $res = $lexica->list()->map('basename', '.pm'); + my @languages = map { my ($l, $c) = split '_', $_, 2; $c ? "$l-\U$c" : $l } @$res; if (my $dl = $conf->{default_language}) { push @languages, $dl; }; my $self = {}; |