Bugzilla – Attachment 73610 Details for
Bug 20115
Languages appear in a different order in the footer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20115: Set the languages order with the pref values
Bug-20115-Set-the-languages-order-with-the-pref-va.patch (text/plain), 1.72 KB, created by
Josef Moravec
on 2018-04-04 11:22:00 UTC
(
hide
)
Description:
Bug 20115: Set the languages order with the pref values
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-04-04 11:22:00 UTC
Size:
1.72 KB
patch
obsolete
>From 2cc6ba63cfbce339daf0e7d6f2a1c417f4f22b33 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 31 Jan 2018 13:47:37 -0300 >Subject: [PATCH] Bug 20115: Set the languages order with the pref values > >To avoid the languages to be ordered randomly, it is better to stick on >a default order. >Let's suppose that the order in the pref is correct. > >Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Languages.pm | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 5e4dabd..1958c91 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -342,8 +342,18 @@ sub _build_languages_arrayref { > push ( @{ $language_groups->{$language_subtags_hashref->{language}} }, $language_subtags_hashref ); > } > # $key is a language subtag like 'en' >- while( my ($key, $value) = each %$language_groups) { > >+ my %idx = map { $enabled_languages->[$_] => $_ } reverse 0 .. @$enabled_languages-1; >+ my @ordered_keys = sort { >+ my $aa = $language_groups->{$a}->[0]->{rfc4646_subtag}; >+ my $bb = $language_groups->{$b}->[0]->{rfc4646_subtag}; >+ ( exists $idx{$aa} and exists $idx{$bb} and ( $idx{$aa} cmp $idx{$bb} ) ) >+ || ( exists $idx{$aa} and exists $idx{$bb} ) >+ || exists $idx{$bb} >+ } keys %$language_groups; >+ >+ for my $key ( @ordered_keys ) { >+ my $value = $language_groups->{$key}; > # is this language group enabled? are any of the languages within it enabled? > my $enabled; > for my $enabled_language (@enabled_languages) { >-- >2.1.4
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 20115
:
71094
|
71095
|
71096
|
71661
|
73027
|
73028
|
73029
|
73030
|
73433
| 73610 |
73611
|
73612
|
73613
|
73614