Bug 25553: Make date columns sortable on the edit items table
[koha.git] / Koha / Template / Plugin / Languages.pm
blob65534e50714289b26df04e4da7c219e5eef68b63
1 package Koha::Template::Plugin::Languages;
3 # Copyright 2012 ByWater Solutions
4 # Copyright 2013-2014 BibLibre
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 use Modern::Perl;
21 use Template::Plugin;
22 use base qw( Template::Plugin );
24 use C4::Koha;
25 use C4::Languages;
27 sub GetByISOCode {
28 my ( $self, $lang, $code ) = @_;
29 $lang = substr($lang,0,2); #Get db code from Koha lang value
30 my $rfc = C4::Languages::get_rfc4646_from_iso639( $code );
31 my $description = C4::Languages::language_get_description($rfc,$lang,'language');
32 return $description;
37 =head1 NAME
39 Koha::Template::Plugin::Languages - TT Plugin for languages
41 =head1 SYNOPSIS
43 [% USE Languages %]
45 [% Languages.GetByISOCode( 'LANG', 'ISO639CODE' ) %]
47 =head1 ROUTINES
49 =head2 GetByISOCode
51 In a template, you can get the description for an language value with
52 the following TT code: [% Languages.GetByISOCode( 'LANGUAGE', 'ISO639CODE' ) %]
55 =head1 AUTHOR
57 Nick Clemens <nick@bywatersolutions.com>
59 =cut