blob: 6ed75dcff40e53a11aed7b3099d1814003fb2179 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package JWebmail::Plugin::I18N2::Role;
use v5.22;
use warnings;
use utf8;
use Role::Tiny;
requires qw(translate);
sub languages {
require List::Util;
my $self = shift;
my @ret = $self->loaded_languages;
if (my $find = shift) {
return List::Util::any { $find eq $_ } @ret;
}
return wantarray ? sort @ret : @ret;
}
1
__END__
=encoding utf-8
=head1 DESCRIPTION
The translate method is called with self, the language and the word and
maybe additional arguments.
The languages method shall report all loaded languages when called with no
argument and if a language is loaded when given an argument.
A default languages method is provided that reads languages form the
loaded_language method.
|