Bugzilla – Attachment 105949 Details for
Bug 18911
Option to set preferred language in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18911: Add the ability to set the preferred lang for notice at the OPAC
Bug-18911-Add-the-ability-to-set-the-preferred-lan.patch (text/plain), 5.25 KB, created by
Marcel de Rooy
on 2020-06-17 11:54:31 UTC
(
hide
)
Description:
Bug 18911: Add the ability to set the preferred lang for notice at the OPAC
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-06-17 11:54:31 UTC
Size:
5.25 KB
patch
obsolete
>From 274e32c6cec6addf8dbca2f0589ded17271b7e9e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Jun 2020 12:20:36 +0200 >Subject: [PATCH] Bug 18911: Add the ability to set the preferred lang for > notice at the OPAC >Content-Type: text/plain; charset=utf-8 > >Patron should be allowed to modify this setting without asking a staff >member. > >The setting is not configurable and cannot be hidden via a syspref. > >Test plan: >- Turn the pref TranslateNotices on >- Install some languages >- Edit your messaging settings at the OPAC >=> Notice the "Preferred language for notices" dropdown list >- Select one >=> Confirm that the value is saved in DB > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../bootstrap/en/modules/opac-messaging.tt | 29 ++++++++++++++++++++++ > opac/opac-messaging.pl | 12 +++++++++ > 2 files changed, 41 insertions(+) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >index 7fd4786503..a387ed4c29 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -153,6 +153,35 @@ > <i>Please contact a library staff member if you are unsure of your mobile service provider, or you do not see your provider in this list.</i> > </li></ol> > [% END %] >+ >+ [% IF Koha.Preference('TranslateNotices') %] >+ <ol> >+ <li> >+ <label for="lang">Preferred language for notices: </label> >+ <select id="lang" name="lang"> >+ <option value="default">Default</option> >+ [% FOR language IN languages %] >+ [% FOR sublanguage IN language.sublanguages_loop %] >+ [% IF language.plural %] >+ [% IF sublanguage.rfc4646_subtag == patron_lang %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% ELSE %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% END %] >+ [% ELSE %] >+ [% IF sublanguage.rfc4646_subtag == patron_lang %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% ELSE %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% END %] >+ [% END # /IF language.plural %] >+ [% END # /FOR sublanguage %] >+ [% END #/FOR language %] >+ </select> <!-- /#lang --> >+ </li> >+ </ol> >+ [% END #/IF Koha.Preference('TranslateNotices') %] >+ > </fieldset> > > <fieldset class="action"> >diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl >index 210f9446c0..689ce94e09 100755 >--- a/opac/opac-messaging.pl >+++ b/opac/opac-messaging.pl >@@ -69,6 +69,10 @@ if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { > })->store; > > C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template); >+ >+ if ( C4::Context->preference('TranslateNotices') ) { >+ $patron->set({ lang => scalar $query->param('lang') })->store; >+ } > } > > C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $patron->borrowernumber }, $template); >@@ -91,4 +95,12 @@ $template->param( > }), > ); > >+if ( C4::Context->preference('TranslateNotices') ) { >+ my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') ); >+ $template->param( >+ languages => $translated_languages, >+ patron_lang => $patron->lang, >+ ); >+} >+ > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >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 18911
:
105940
|
105949
|
105950
|
105952
|
105953