Bugzilla – Attachment 71596 Details for
Bug 20160
Sort translated languages by code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20160: Sort translated languages by code
0001-Bug-20160-Sort-translated-languages-by-code.patch (text/plain), 3.10 KB, created by
paxed
on 2018-02-14 06:17:43 UTC
(
hide
)
Description:
Bug 20160: Sort translated languages by code
Filename:
MIME Type:
Creator:
paxed
Created:
2018-02-14 06:17:43 UTC
Size:
3.10 KB
patch
obsolete
>From ed41d21b614fc5f0d09eed1819b4cfc57b36c328 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@joensuu.fi> >Date: Thu, 8 Feb 2018 10:09:43 +0200 >Subject: [PATCH] Bug 20160: Sort translated languages by code > >The language tabs in Change notices -page are in random order, and will >rearrange at every page reload. This is quite irritating. > >Make getTranslatedLanguages return the languages always in the same order, >sorted by the language code. This is better than returning them in >a random one. > >Test plan: > >1) Enable TranslateNotices >2) Install multiple languages, including multiple regional English languages >3) Go to Home -> Tools -> Notices & slips >4) Edit any notice >5) Reload the page multiple times. The language tabs will rearrange at random >6) Apply patch >7) Repeat 1-5. The language tabs should now always be in the same order, > sorted by the language code. > >Do the same test to Home -> Tools -> News -> Add News item >(Check the "Display location" dropdown) > >Check Home -> Patrons -> Add patron (the "Preferred language for notices" >dropdown) > >Check Home -> Administration -> System preferences -> i18n/l10n >(Note the order of languages listed for "language" and "opaclanguages") > >Check Home -> Administration -> System preferences -> Local use >(Create a new preference with variable type Languages, check the >language pref listed in the table) > >Check Home -> Administration -> Item types -> Add item type >(After the Description-field, there's "Translate into other languages", >click on that. In the pop-up that opens, check the language drop-down) > >Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi> >--- > C4/Languages.pm | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 5e4dabd14d..8b41c0d99b 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -313,6 +313,7 @@ sub _build_languages_arrayref { > $current_language //= ''; > my @translated_languages = @$translated_languages; > my @languages_loop; # the final reference to an array of hashrefs >+ my @languages_loop_sorted; > my @enabled_languages = @$enabled_languages; > # how many languages are enabled, if one, take note, some contexts won't need to display it > my %seen_languages; # the language tags we've seen >@@ -321,7 +322,7 @@ sub _build_languages_arrayref { > my $track_language_groups; > my $current_language_regex = regex_lang_subtags($current_language); > # Loop through the translated languages >- for my $translated_language (@translated_languages) { >+ for my $translated_language (sort @translated_languages) { > # separate the language string into its subtag types > my $language_subtags_hashref = regex_lang_subtags($translated_language); > >@@ -361,7 +362,8 @@ sub _build_languages_arrayref { > group_enabled => $enabled, > }; > } >- return \@languages_loop; >+ @languages_loop_sorted = sort{ $a->{language} cmp $b->{language} } @languages_loop; >+ return \@languages_loop_sorted; > } > > sub language_get_description { >-- >2.11.0 >
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 20160
:
71333
|
71596
|
71622