diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-08-14 00:16:31 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2021-08-27 05:06:12 +0000 |
commit | cc5815dcd0342a521be400f35cbc8a666b83046d (patch) | |
tree | c632864b41e8bc0f991ff866e143423e2d20ec27 | |
parent | 3b2be23fee0cef9edde5443bfa892ca6407d06ff (diff) | |
download | nextcloud-server-cc5815dcd0342a521be400f35cbc8a666b83046d.tar.gz nextcloud-server-cc5815dcd0342a521be400f35cbc8a666b83046d.zip |
Provide initial state
- camelCase language strings
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-rw-r--r-- | apps/settings/lib/Settings/Personal/PersonalInfo.php | 13 | ||||
-rw-r--r-- | apps/settings/src/components/UserList.vue | 6 | ||||
-rw-r--r-- | lib/private/L10N/Factory.php | 14 |
3 files changed, 17 insertions, 16 deletions
diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index d69d4b33b4c..0a84f20f513 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -148,6 +148,7 @@ class PersonalInfo implements ISettings { $personalInfoParameters = [ 'displayNames' => $this->getDisplayNames($account), 'emails' => $this->getEmails($account), + 'languages' => $this->getLanguages($user), ]; $accountParameters = [ @@ -256,7 +257,7 @@ class PersonalInfo implements ISettings { } /** - * returns the user language, common language and other languages in an + * returns the user's active language, common languages, and other languages in an * associative array * * @param IUser $user @@ -274,12 +275,12 @@ class PersonalInfo implements ISettings { $languages = $this->l10nFactory->getLanguages(); // associate the user language with the proper array - $userLangIndex = array_search($userConfLang, array_column($languages['commonlanguages'], 'code')); - $userLang = $languages['commonlanguages'][$userLangIndex]; + $userLangIndex = array_search($userConfLang, array_column($languages['commonLanguages'], 'code')); + $userLang = $languages['commonLanguages'][$userLangIndex]; // search in the other languages if ($userLangIndex === false) { - $userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code')); - $userLang = $languages['languages'][$userLangIndex]; + $userLangIndex = array_search($userConfLang, array_column($languages['otherLanguages'], 'code')); + $userLang = $languages['otherLanguages'][$userLangIndex]; } // if user language is not available but set somehow: show the actual code as name if (!is_array($userLang)) { @@ -290,7 +291,7 @@ class PersonalInfo implements ISettings { } return array_merge( - ['activelanguage' => $userLang], + ['activeLanguage' => $userLang], $languages ); } diff --git a/apps/settings/src/components/UserList.vue b/apps/settings/src/components/UserList.vue index 5459a04398e..afbc1de76f8 100644 --- a/apps/settings/src/components/UserList.vue +++ b/apps/settings/src/components/UserList.vue @@ -369,11 +369,11 @@ export default { return [ { label: t('settings', 'Common languages'), - languages: this.settings.languages.commonlanguages, + languages: this.settings.languages.commonLanguages, }, { - label: t('settings', 'All languages'), - languages: this.settings.languages.languages, + label: t('settings', 'Other languages'), + languages: this.settings.languages.otherLanguages, }, ] }, diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 37599c21d8f..caa26d81cc4 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -619,18 +619,18 @@ class Factory implements IFactory { $potentialName = $l->t('__language_name__'); return [ - 'commonlanguages' => [[ + 'commonLanguages' => [[ 'code' => $forceLanguage, 'name' => $potentialName, ]], - 'languages' => [], + 'otherLanguages' => [], ]; } $languageCodes = $this->findAvailableLanguages(); $commonLanguages = []; - $languages = []; + $otherLanguages = []; foreach ($languageCodes as $lang) { $l = $this->get('lib', $lang); @@ -658,14 +658,14 @@ class Factory implements IFactory { if (in_array($lang, self::COMMON_LANGUAGE_CODES)) { $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)] = $ln; } else { - $languages[] = $ln; + $otherLanguages[] = $ln; } } ksort($commonLanguages); // sort now by displayed language not the iso-code - usort($languages, function ($a, $b) { + usort($otherLanguages, 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; @@ -680,8 +680,8 @@ class Factory implements IFactory { return [ // reset indexes - 'commonlanguages' => array_values($commonLanguages), - 'languages' => $languages + 'commonLanguages' => array_values($commonLanguages), + 'otherLanguages' => $otherLanguages ]; } } |