Bugzilla – Attachment 27040 Details for
Bug 5052
Can't choose languages if all choices are sublanguages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 5052 - Can't choose languages if all choices are sublanguage
SIGNED-OFF-Bug-5052---Cant-choose-languages-if-all.patch (text/plain), 3.88 KB, created by
Owen Leonard
on 2014-04-11 18:20:41 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 5052 - Can't choose languages if all choices are sublanguage
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2014-04-11 18:20:41 UTC
Size:
3.88 KB
patch
obsolete
>From 101dbe0b6adae5516e445e4b63d01d84d84f493f Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Thu, 3 Apr 2014 22:37:09 -0300 >Subject: [PATCH] [SIGNED-OFF] Bug 5052 - Can't choose languages if all > choices are sublanguage >Content-Type: text/plain; charset="utf-8" > >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> >--- > C4/Templates.pm | 11 +++++++---- > .../prog/en/includes/intranet-bottom.inc | 2 +- > 2 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 2d2304f..0b49862 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -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; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >index ed1298c..442a7bb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >@@ -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 ) %] >-- >1.7.9.5
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 5052
:
26805
|
27040
|
27126