Bugzilla – Attachment 86000 Details for
Bug 18213
Add language facets to Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18213: Add Template plugin and fix for C4/Languages
Bug-18213-Add-Template-plugin-and-fix-for-C4Langua.patch (text/plain), 3.02 KB, created by
Josef Moravec
on 2019-03-04 14:48:50 UTC
(
hide
)
Description:
Bug 18213: Add Template plugin and fix for C4/Languages
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-04 14:48:50 UTC
Size:
3.02 KB
patch
obsolete
>From 5dfce99ab2c4571a2567fdc3ffd9822d39169433 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 7 Jul 2017 10:44:57 +0000 >Subject: [PATCH] Bug 18213: Add Template plugin and fix for C4/Languages > >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> >Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Languages.pm | 8 ++++-- > Koha/Template/Plugin/Languages.pm | 59 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 65 insertions(+), 2 deletions(-) > create mode 100644 Koha/Template/Plugin/Languages.pm > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index b06e30310e..31d17ba73b 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -631,8 +631,12 @@ sub getlanguage { > sub get_rfc4646_from_iso639 { > > my $iso_code = shift; >- my $rfc_subtag = Koha::Database->new()->schema->resultset('LanguageRfc4646ToIso639')->find({iso639_2_code=>$iso_code})->rfc4646_subtag; >- return $rfc_subtag; >+ my $rfc_subtag = Koha::Database->new()->schema->resultset('LanguageRfc4646ToIso639')->find({iso639_2_code=>$iso_code}); >+ if ( $rfc_subtag ) { >+ return $rfc_subtag->rfc4646_subtag; >+ } else { >+ return; >+ } > > } > >diff --git a/Koha/Template/Plugin/Languages.pm b/Koha/Template/Plugin/Languages.pm >new file mode 100644 >index 0000000000..65534e5071 >--- /dev/null >+++ b/Koha/Template/Plugin/Languages.pm >@@ -0,0 +1,59 @@ >+package Koha::Template::Plugin::Languages; >+ >+# Copyright 2012 ByWater Solutions >+# Copyright 2013-2014 BibLibre >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Template::Plugin; >+use base qw( Template::Plugin ); >+ >+use C4::Koha; >+use C4::Languages; >+ >+sub GetByISOCode { >+ my ( $self, $lang, $code ) = @_; >+ $lang = substr($lang,0,2); #Get db code from Koha lang value >+ my $rfc = C4::Languages::get_rfc4646_from_iso639( $code ); >+ my $description = C4::Languages::language_get_description($rfc,$lang,'language'); >+ return $description; >+} >+ >+1; >+ >+=head1 NAME >+ >+Koha::Template::Plugin::Languages - TT Plugin for languages >+ >+=head1 SYNOPSIS >+ >+[% USE Languages %] >+ >+[% Languages.GetByISOCode( 'LANG', 'ISO639CODE' ) %] >+ >+=head1 ROUTINES >+ >+=head2 GetByISOCode >+ >+In a template, you can get the description for an language value with >+the following TT code: [% Languages.GetByISOCode( 'LANGUAGE', 'ISO639CODE' ) %] >+ >+ >+=head1 AUTHOR >+ >+Nick Clemens <nick@bywatersolutions.com> >+ >+=cut >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18213
:
64798
|
64841
|
64905
|
68944
|
68945
|
68946
|
72940
|
72941
|
72942
|
72943
|
73008
|
73009
|
73010
|
73011
|
75971
|
75972
|
75973
|
75974
|
85998
|
85999
| 86000 |
86001