Lines 23-31
our $DYNAMIC_FILTERS = {
Link Here
|
23 |
# There are two ways to fix this: |
23 |
# There are two ways to fix this: |
24 |
# 1. Change the order of arguments in Koha::Template::Plugin::I18N and |
24 |
# 1. Change the order of arguments in Koha::Template::Plugin::I18N and |
25 |
# change the -k options in xgettext-tt2 (the msgid must be first), or |
25 |
# change the -k options in xgettext-tt2 (the msgid must be first), or |
26 |
# 2. Use different keywords, and add them as -k options in xgettext-tt2 |
26 |
# 2. Usesdf different keywords, and add them as -k options in xgettext-tt2 |
27 |
}; |
27 |
}; |
28 |
|
28 |
|
|
|
29 |
=head1 METHODS |
30 |
|
31 |
=head2 fetch |
32 |
|
33 |
Instanticate or return a ref to the filter subroutines |
34 |
|
35 |
=cut |
36 |
|
29 |
sub fetch { |
37 |
sub fetch { |
30 |
my ( $self, $name, $args, $context ) = @_; |
38 |
my ( $self, $name, $args, $context ) = @_; |
31 |
|
39 |
|
Lines 38-56
sub fetch {
Link Here
|
38 |
return ( undef, Template::Constants::STATUS_DECLINED ); |
46 |
return ( undef, Template::Constants::STATUS_DECLINED ); |
39 |
} |
47 |
} |
40 |
|
48 |
|
41 |
# This sub is never called in theory as Template::Filters::store is called |
49 |
=head2 store |
42 |
# first and accept all filters. |
50 |
|
43 |
# We declare it anyway, just in case the order of filter providers is changed |
51 |
This sub is never called in theory as Template::Filters::store is called |
|
|
52 |
first and accept all filters. |
53 |
We declare it anyway, just in case the order of filter providers is changed |
54 |
|
55 |
=cut |
56 |
|
44 |
sub store { |
57 |
sub store { |
45 |
return ( undef, Template::Constants::STATUS_DECLINED ); |
58 |
return ( undef, Template::Constants::STATUS_DECLINED ); |
46 |
} |
59 |
} |
47 |
|
60 |
|
|
|
61 |
=head2 t |
62 |
|
63 |
[% var | t %] |
64 |
|
65 |
Translate - The simplest type of translatable string where |
66 |
there are no variables and not pluralisations to consider. |
67 |
|
68 |
=cut |
69 |
|
48 |
sub t { |
70 |
sub t { |
49 |
my ($msgid) = @_; |
71 |
my ($msgid) = @_; |
50 |
|
72 |
|
51 |
return __($msgid); |
73 |
return __($msgid); |
52 |
} |
74 |
} |
53 |
|
75 |
|
|
|
76 |
=head2 tx_factory |
77 |
|
78 |
[% var | tx("hello {name}", { name = name }) %] |
79 |
|
80 |
Mapped to the tx filter. |
81 |
|
82 |
Translate with variable - A translatable string that |
83 |
includes a variable |
84 |
|
85 |
=cut |
86 |
|
54 |
sub tx_factory { |
87 |
sub tx_factory { |
55 |
my ( $context, $vars ) = @_; |
88 |
my ( $context, $vars ) = @_; |
56 |
|
89 |
|
Lines 61-66
sub tx_factory {
Link Here
|
61 |
} |
94 |
} |
62 |
} |
95 |
} |
63 |
|
96 |
|
|
|
97 |
=head2 tn_factory |
98 |
|
99 |
[% var | tn("item", "items", count) %] |
100 |
|
101 |
Mapped to the tn filter |
102 |
|
103 |
Translate with plural - A translatable string that needs |
104 |
singular and plural forms |
105 |
|
106 |
=cut |
107 |
|
64 |
sub tn_factory { |
108 |
sub tn_factory { |
65 |
my ( $context, $msgid_plural, $count ) = @_; |
109 |
my ( $context, $msgid_plural, $count ) = @_; |
66 |
|
110 |
|
Lines 71-76
sub tn_factory {
Link Here
|
71 |
} |
115 |
} |
72 |
} |
116 |
} |
73 |
|
117 |
|
|
|
118 |
=head2 tnx_factory |
119 |
|
120 |
[% var | tnx("{count} item", "{count} items", count, { count = count }) %] |
121 |
|
122 |
Mapped to the tnx filter |
123 |
|
124 |
Translate with plural and variable - A translatable string |
125 |
that needs singular and plural forms and includes a variable |
126 |
|
127 |
=cut |
128 |
|
74 |
sub tnx_factory { |
129 |
sub tnx_factory { |
75 |
my ( $context, $msgid_plural, $count, $vars ) = @_; |
130 |
my ( $context, $msgid_plural, $count, $vars ) = @_; |
76 |
|
131 |
|
77 |
- |
|
|