diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-10-14 08:05:17 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2021-10-19 04:44:40 +0000 |
commit | 7215148a242815a5064ce5d00a387c634dc936f3 (patch) | |
tree | 4edf67253bd8c3bbe3ea2f1fba17e21b221e9282 /lib/private/L10N | |
parent | 382ba66ab5e1a675347e86d93593eb228da253bb (diff) | |
download | nextcloud-server-7215148a242815a5064ce5d00a387c634dc936f3.tar.gz nextcloud-server-7215148a242815a5064ce5d00a387c634dc936f3.zip |
Add new account properties
- New properties
- Organisation
- Role
- Headline
- Biography
- Profile Enabled property
- Fix errors with building default account properties
- Fix L10N factory method `getLanguage` not public error
- Update tests
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/L10N')
-rw-r--r-- | lib/private/L10N/Factory.php | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 8aa09ab87bc..a3ff7bf70e2 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -37,6 +37,7 @@ declare(strict_types=1); * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + namespace OC\L10N; use OCP\IConfig; @@ -104,10 +105,12 @@ class Factory implements IFactory { * @param IUserSession $userSession * @param string $serverRoot */ - public function __construct(IConfig $config, - IRequest $request, - IUserSession $userSession, - $serverRoot) { + public function __construct( + IConfig $config, + IRequest $request, + IUserSession $userSession, + $serverRoot + ) { $this->config = $config; $this->request = $request; $this->userSession = $userSession; @@ -149,7 +152,10 @@ class Factory implements IFactory { if (!isset($this->instances[$lang][$app])) { $this->instances[$lang][$app] = new L10N( - $this, $app, $lang, $locale, + $this, + $app, + $lang, + $locale, $this->getL10nFilesForApp($app, $lang) ); } @@ -391,7 +397,7 @@ class Factory implements IFactory { * @return bool */ public function languageExists($app, $lang) { - if ($lang === 'en') {//english is always available + if ($lang === 'en') { //english is always available return true; } @@ -493,7 +499,8 @@ class Factory implements IFactory { // use formal version of german ("Sie" instead of "Du") if the default // language is set to 'de_DE' if possible - if (is_string($defaultLanguage) && + if ( + is_string($defaultLanguage) && strtolower($lang) === 'de' && strtolower($defaultLanguage) === 'de_de' && $this->languageExists($app, 'de_DE') @@ -542,9 +549,9 @@ class Factory implements IFactory { if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') || $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') - || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') - ) - && file_exists($transFile)) { + || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')) + && file_exists($transFile) + ) { // load the translations file $languageFiles[] = $transFile; } @@ -599,9 +606,9 @@ class Factory implements IFactory { $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); $body = str_replace( - [ 'plural', 'n', '$n$plurals', ], - [ '$plural', '$n', '$nplurals', ], - 'nplurals='. $nplurals . '; plural=' . $plural + ['plural', 'n', '$n$plurals',], + ['$plural', '$n', '$nplurals',], + 'nplurals=' . $nplurals . '; plural=' . $plural ); // add parents @@ -645,12 +652,9 @@ class Factory implements IFactory { } /** - * returns the common language and other languages in an - * associative array - * - * @return array + * @inheritDoc */ - public function getLanguages() { + public function getLanguages(): array { $forceLanguage = $this->config->getSystemValue('force_language', false); if ($forceLanguage !== false) { $l = $this->get('lib', $forceLanguage); @@ -674,7 +678,7 @@ class Factory implements IFactory { $l = $this->get('lib', $lang); // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version $potentialName = $l->t('__language_name__'); - if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') {//first check if the language name is in the translation file + if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') { //first check if the language name is in the translation file $ln = [ 'code' => $lang, 'name' => $potentialName @@ -684,7 +688,7 @@ class Factory implements IFactory { 'code' => $lang, 'name' => 'English (US)' ]; - } else {//fallback to language code + } else { //fallback to language code $ln = [ 'code' => $lang, 'name' => $lang |