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

(-)a/Koha/I18N.pm (-2 / +24 lines)
Lines 50-56 sub init { Link Here
50
    my $cache = Koha::Cache::Memory::Lite->get_instance();
50
    my $cache = Koha::Cache::Memory::Lite->get_instance();
51
    my $cache_key = 'i18n:initialized';
51
    my $cache_key = 'i18n:initialized';
52
    unless ($cache->get_from_cache($cache_key)) {
52
    unless ($cache->get_from_cache($cache_key)) {
53
        Locale::Messages->select_package('gettext_pp');
54
        my @system_locales = grep { chomp; not (/^C/ || $_ eq 'POSIX') } qx/locale -a/;
53
        my @system_locales = grep { chomp; not (/^C/ || $_ eq 'POSIX') } qx/locale -a/;
55
        if (@system_locales) {
54
        if (@system_locales) {
56
            # LANG needs to be set to a valid locale,
55
            # LANG needs to be set to a valid locale,
Lines 86-109 sub init { Link Here
86
sub __ {
85
sub __ {
87
    my ($msgid) = @_;
86
    my ($msgid) = @_;
88
87
88
    $msgid = Encode::encode_utf8($msgid);
89
89
    return _gettext(\&gettext, [ $msgid ]);
90
    return _gettext(\&gettext, [ $msgid ]);
90
}
91
}
91
92
92
sub __x {
93
sub __x {
93
    my ($msgid, %vars) = @_;
94
    my ($msgid, %vars) = @_;
94
95
96
    $msgid = Encode::encode_utf8($msgid);
97
95
    return _gettext(\&gettext, [ $msgid ], %vars);
98
    return _gettext(\&gettext, [ $msgid ], %vars);
96
}
99
}
97
100
98
sub __n {
101
sub __n {
99
    my ($msgid, $msgid_plural, $count) = @_;
102
    my ($msgid, $msgid_plural, $count) = @_;
100
103
104
    $msgid = Encode::encode_utf8($msgid);
105
    $msgid_plural = Encode::encode_utf8($msgid_plural);
106
101
    return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ]);
107
    return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ]);
102
}
108
}
103
109
104
sub __nx {
110
sub __nx {
105
    my ($msgid, $msgid_plural, $count, %vars) = @_;
111
    my ($msgid, $msgid_plural, $count, %vars) = @_;
106
112
113
    $msgid = Encode::encode_utf8($msgid);
114
    $msgid_plural = Encode::encode_utf8($msgid_plural);
115
107
    return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ], %vars);
116
    return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ], %vars);
108
}
117
}
109
118
Lines 114-137 sub __xn { Link Here
114
sub __p {
123
sub __p {
115
    my ($msgctxt, $msgid) = @_;
124
    my ($msgctxt, $msgid) = @_;
116
125
126
    $msgctxt = Encode::encode_utf8($msgctxt);
127
    $msgid = Encode::encode_utf8($msgid);
128
117
    return _gettext(\&pgettext, [ $msgctxt, $msgid ]);
129
    return _gettext(\&pgettext, [ $msgctxt, $msgid ]);
118
}
130
}
119
131
120
sub __px {
132
sub __px {
121
    my ($msgctxt, $msgid, %vars) = @_;
133
    my ($msgctxt, $msgid, %vars) = @_;
122
134
135
    $msgctxt = Encode::encode_utf8($msgctxt);
136
    $msgid = Encode::encode_utf8($msgid);
137
123
    return _gettext(\&pgettext, [ $msgctxt, $msgid ], %vars);
138
    return _gettext(\&pgettext, [ $msgctxt, $msgid ], %vars);
124
}
139
}
125
140
126
sub __np {
141
sub __np {
127
    my ($msgctxt, $msgid, $msgid_plural, $count) = @_;
142
    my ($msgctxt, $msgid, $msgid_plural, $count) = @_;
128
143
144
    $msgctxt = Encode::encode_utf8($msgctxt);
145
    $msgid = Encode::encode_utf8($msgid);
146
    $msgid_plural = Encode::encode_utf8($msgid_plural);
147
129
    return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count ]);
148
    return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count ]);
130
}
149
}
131
150
132
sub __npx {
151
sub __npx {
133
    my ($msgctxt, $msgid, $msgid_plural, $count, %vars) = @_;
152
    my ($msgctxt, $msgid, $msgid_plural, $count, %vars) = @_;
134
153
154
    $msgctxt = Encode::encode_utf8($msgctxt);
155
    $msgid = Encode::encode_utf8($msgid);
156
    $msgid_plural = Encode::encode_utf8($msgid_plural);
157
135
    return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count], %vars);
158
    return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count], %vars);
136
}
159
}
137
160
138
- 

Return to bug 15395