Bug 17762: Add the lang attribute to the patron form

Not the opac because we do not want the patron to modify it, they won't
be necessary translated.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-12-08 10:52:30 +00:00 committed by Kyle M Hall
parent 2b35e37d7f
commit 40cd76882e
4 changed files with 45 additions and 0 deletions

View File

@ -720,6 +720,31 @@ $(document).ready(function() {
</select>
</li>
[% END %]
[% IF Koha.Preference('TranslateNotices') %]
<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 == lang %]
<option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>
[% ELSE %]
<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>
[% END %]
[% ELSE %]
[% IF sublanguage.rfc4646_subtag == lang %]
<option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>
[% ELSE %]
<option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>
[% END %]
[% END %]
[% END %]
[% END %]
</select>
</li>
[% END %]
</ol>
</fieldset>
[% UNLESS nodateenrolled && noopacnote && noborrowernotes %]

View File

@ -459,6 +459,12 @@ function validate1(date) {
Inherited
[% END %]
</li>
[% END %]
[% IF Koha.Preference('TranslateNotices') %]
<li>
<span class="label">Preferred language for notices: </span>
[% translated_language %]
</li>
[% END %]
</ol>
</div>

View File

@ -265,6 +265,8 @@ $newdata{'city'} = $input->param('city') if defined($input->param('city'))
$newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode'));
$newdata{'country'} = $input->param('country') if defined($input->param('country'));
$newdata{'lang'} = $input->param('lang') if defined($input->param('lang'));
# builds default userid
# userid input text may be empty or missing because of syspref BorrowerUnwantedField
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ ) {
@ -772,6 +774,11 @@ if ( defined $min ) {
);
}
if ( C4::Context->preference('TranslateNotices') ) {
my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') );
$template->param( languages => $translated_languages );
}
output_html_with_http_headers $input, $cookie, $template->output;
sub parse_extended_patron_attributes {

View File

@ -331,8 +331,15 @@ if ( C4::Context->preference("ExportCircHistory") ) {
# in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children)
$template->param( $data->{'categorycode'} => 1 );
# Display the language description instead of the code
# Note that this is certainly wrong
my ( $subtag, $region ) = split '-', $patron->lang;
my $translated_language = C4::Languages::language_get_description( $subtag, $subtag, 'language' );
$template->param(
patron => $patron,
translated_language => $translated_language,
detailview => 1,
borrowernumber => $borrowernumber,
othernames => $data->{'othernames'},