diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-08-28 20:06:31 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-08-28 20:06:31 +0200 |
commit | dc04b618bcd9ed795a81b7a88bc2a97725c629a8 (patch) | |
tree | 9002ce1070e0067b13ddea47c320e9a09d482a3b /settings/personal.php | |
parent | 84bb9be4b73c2378f69c30745a4b4ebef34257e5 (diff) | |
parent | 503abb36a23dc8bb0ae5c08ede44e31712b12e53 (diff) | |
download | nextcloud-server-dc04b618bcd9ed795a81b7a88bc2a97725c629a8.tar.gz nextcloud-server-dc04b618bcd9ed795a81b7a88bc2a97725c629a8.zip |
Merge pull request #18638 from owncloud/issue-18141-sort-languages-with-names-before-code-only
Sort languages with a name before those with language code only
Diffstat (limited to 'settings/personal.php')
-rw-r--r-- | settings/personal.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/settings/personal.php b/settings/personal.php index 32944de7200..0cfdc9ed371 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -95,6 +95,15 @@ ksort($commonlanguages); // sort now by displayed language not the iso-code usort( $languages, function ($a, $b) { + if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { + // If a doesn't have a name, but b does, list b before a + return 1; + } + if ($a['code'] !== $a['name'] && $b['code'] === $b['name']) { + // If a does have a name, but b doesn't, list a before b + return -1; + } + // Otherwise compare the names return strcmp($a['name'], $b['name']); }); |