Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-08-28 20:10:47 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2015-08-28 20:10:47 +0300
commit503abb36a23dc8bb0ae5c08ede44e31712b12e53 (patch)
tree9e10f6ca5ccc172fe864a557ccfa56ddab80cc57 /settings/personal.php
parentefeef958a3e707c06f25dc6e473d1b49edf88b07 (diff)
Sort languages with a name before those with language code only
Diffstat (limited to 'settings/personal.php')
-rw-r--r--settings/personal.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/settings/personal.php b/settings/personal.php
index bbbba3b5b8d..8a1a8af55c1 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -94,6 +94,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']);
});