View | Details | Raw Unified | Return to bug 24068
Collapse All | Expand All

(-)a/Koha/Template/Plugin/I18N.pm (-2 / +44 lines)
Lines 30-40 Koha::Template::Plugin::I18N - Translate strings in templates Link Here
30
30
31
=head1 SYNOPSIS
31
=head1 SYNOPSIS
32
32
33
    [% PROCESS 'i18n.inc' %]
34
35
    . . .
36
37
    [% I18N.t("Hello!") %]
38
    [% I18N.tx("Hello {name}", { name = name }) %]
39
    [% I18N.tn("Hello friend", "Hello friends", count) %]
40
    [% I18N.tnx("Hello my {count} friend", "Hello my {count} friends", count, { count = count }) %]
41
    [% I18N.tp('verb', 'Item') # to order %]
42
    [% I18N.tnp('bibliographic material', "item", "items", count) %]
43
    [% I18N.tnpx('bibliographic material', "{count} item", "{count} items", count, { count = count }) %]
44
33
Do not use this plugin directly. Add the following directive
45
Do not use this plugin directly. Add the following directive
34
46
35
    [% PROCESS 'i18n.inc' %]
47
    [% PROCESS 'i18n.inc' %]
36
48
37
and use the macros defined here
49
and use the macros defined.
38
50
39
=head1 METHODS
51
=head1 METHODS
40
52
Lines 42-47 and use the macros defined here Link Here
42
54
43
    [% I18N.t("hello") %]
55
    [% I18N.t("hello") %]
44
56
57
Translate - The simplest type of translatable string where 
58
there are no variables and not pluralisations to consider.
59
45
=cut
60
=cut
46
61
47
sub t {
62
sub t {
Lines 53-58 sub t { Link Here
53
68
54
    [% I18N.tx("hello {name}", { name = name }) %]
69
    [% I18N.tx("hello {name}", { name = name }) %]
55
70
71
Translate with variable - A translatable string that 
72
includes a variable
73
56
=cut
74
=cut
57
75
58
sub tx {
76
sub tx {
Lines 64-69 sub tx { Link Here
64
82
65
    [% I18N.tn("item", "items", count) %]
83
    [% I18N.tn("item", "items", count) %]
66
84
85
Translate with plural - A translatable string that needs 
86
singular and plural forms
87
67
=cut
88
=cut
68
89
69
sub tn {
90
sub tn {
Lines 75-80 sub tn { Link Here
75
96
76
    [% I18N.tnx("{count} item", "{count} items", count, { count = count }) %]
97
    [% I18N.tnx("{count} item", "{count} items", count, { count = count }) %]
77
98
99
Translate with plural and variable - A translatable string
100
that needs singular and plural forms and includes a variable
101
78
=cut
102
=cut
79
103
80
sub tnx {
104
sub tnx {
Lines 97-102 sub txn { Link Here
97
121
98
    [% I18N.tp("context", "hello") %]
122
    [% I18N.tp("context", "hello") %]
99
123
124
Translate with context - A translatable string where a 
125
context hint would be helpful to translators.
126
127
An example would be where in english a single word may be
128
be used as both a verb and a noun. You may want to add a
129
note to distinguish this particular use case so translators
130
can understand the context correctly.
131
100
=cut
132
=cut
101
133
102
sub tp {
134
sub tp {
Lines 108-113 sub tp { Link Here
108
140
109
    [% I18N.tpx("context", "hello {name}", { name = name }) %]
141
    [% I18N.tpx("context", "hello {name}", { name = name }) %]
110
142
143
Translate with context and variable - A translatable string
144
that needs both a contextual hint and includes a variable.
145
111
=cut
146
=cut
112
147
113
sub tpx {
148
sub tpx {
Lines 119-124 sub tpx { Link Here
119
154
120
    [% I18N.tnp("context", "item", "items", count) %]
155
    [% I18N.tnp("context", "item", "items", count) %]
121
156
157
Translate with context and plural - A translatable string
158
that needs both a contextual hints and singular and plural
159
forms.
160
122
=cut
161
=cut
123
162
124
sub tnp {
163
sub tnp {
Lines 130-135 sub tnp { Link Here
130
169
131
    [% I18N.tnpx("context", "{count} item", "{count} items", count, { count = count }) %]
170
    [% I18N.tnpx("context", "{count} item", "{count} items", count, { count = count }) %]
132
171
172
Translate with context, plural and variables - A translatable
173
string that needs contextual hints, singular and plural forms
174
and also includes variables.
175
133
=cut
176
=cut
134
177
135
sub tnpx {
178
sub tnpx {
136
- 

Return to bug 24068