Bug 5052: make it possible to pick a language if all choices are sublanguage
This was tricky to catch. In current implementation, Bug 6755 introduced in C4/Templates.pm as condition to send the array of hashrefs of languages that (@$languages_loop<2), but with one language group that condition is false, there is only one element in that array. This patch changes that condition to have more than one language selected, grouped or not. Also send $bidi value always, that was only sent if there is more than one group language. To test: 1. Translate to en-GB and en-NZ, or simply do mkdirs on intranet-tmpl/prog and opac-tmpl/bootstrap 2. Go to Administration > System preferences > I18N enable those languages on staff/opac 3. Check that language chooser is nowhere to be found 4. Apply the patch 5. Reload staff/opac, now you can see language chooser NOTE: I made little changes on staff, but can't replicate bootstrap colors for selected/unselected language. Someone need to touch css files to make it happen. But that is current behavior. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Good catch! Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
95056d17b7
commit
c212b9328e
2 changed files with 8 additions and 5 deletions
|
@ -253,10 +253,13 @@ sub gettemplate {
|
|||
# lang => $lang
|
||||
# );
|
||||
|
||||
# Bidirectionality
|
||||
# Bidirectionality, must be sent even if is the only language
|
||||
my $current_lang = regex_lang_subtags($lang);
|
||||
my $bidi;
|
||||
$bidi = get_bidi($current_lang->{script}) if $current_lang->{script};
|
||||
$template->param(
|
||||
bidi => $bidi,
|
||||
);
|
||||
# Languages
|
||||
my $languages_loop = getTranslatedLanguages($interface,$theme,$lang);
|
||||
my $num_languages_enabled = 0;
|
||||
|
@ -265,11 +268,11 @@ sub gettemplate {
|
|||
$num_languages_enabled++ if $sublang->{enabled};
|
||||
}
|
||||
}
|
||||
my $one_language_enabled = ($num_languages_enabled <= 1) ? 1 : 0; # deal with zero enabled langs as well
|
||||
$template->param(
|
||||
languages_loop => $languages_loop,
|
||||
bidi => $bidi,
|
||||
one_language_enabled => ($num_languages_enabled <= 1) ? 1 : 0, # deal with zero enabled langs as well
|
||||
) unless @$languages_loop<2;
|
||||
one_language_enabled => $one_language_enabled,
|
||||
) unless $one_language_enabled;
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
[% IF ( languages_loo.group_enabled ) %]
|
||||
[% IF ( languages_loo.plural ) %]
|
||||
<li class="dropdown"><a class="dropdown-toggle dropup" data-toggle="dropdown" id="show[% languages_loo.rfc4646_subtag %]" href="#">[% languages_loo.native_description %] ([% languages_loo.rfc4646_subtag %]) <span class="caret"></span></a>
|
||||
<li class="dropdown"><a class="dropdown-toggle dropup" data-toggle="dropdown" id="show[% languages_loo.rfc4646_subtag %]" href="#">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %] <span class="caret"></span></a>
|
||||
<ul id="sub[% languages_loo.rfc4646_subtag %]" class="dropdown-menu">
|
||||
[% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
|
||||
[% IF ( sublanguages_loo.enabled ) %]
|
||||
|
|
Loading…
Reference in a new issue