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 d7c1161949..e23499cc42 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 @@
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.
[% END %]
+
+ [% IF Koha.Preference('TranslateNotices') %]
+
+
+ Preferred language for notices:
+
+ Default
+ [% FOR language IN languages %]
+ [% FOR sublanguage IN language.sublanguages_loop %]
+ [% IF language.plural %]
+ [% IF sublanguage.rfc4646_subtag == patron_lang %]
+ [% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])
+ [% ELSE %]
+ [% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])
+ [% END %]
+ [% ELSE %]
+ [% IF sublanguage.rfc4646_subtag == patron_lang %]
+ [% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])
+ [% ELSE %]
+ [% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])
+ [% END %]
+ [% END # /IF language.plural %]
+ [% END # /FOR sublanguage %]
+ [% END #/FOR language %]
+
+
+
+ [% END #/IF Koha.Preference('TranslateNotices') %]
+
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 };