Skip to content

Commit

Permalink
Change lang to language
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Bergen committed Sep 7, 2017
1 parent f54650e commit d98187e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions controller/contactcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ public function searchAttendee($search) {
$r['EMAIL'] = [$r['EMAIL']];
}

$lang = $this->getPreferredLanguageFromUidOrDefault($r['UID'], $defaultLang);
$language = $this->getPreferredLanguageFromUidOrDefault($r['UID'], $defaultLang);
$isLocalUser = isset($r['isLocalSystemBook']) && $r['isLocalSystemBook'];

$contacts[] = [
'email' => $r['EMAIL'],
'name' => $name,
'lang' => $lang
'lang' => $language
];
}

Expand Down Expand Up @@ -153,6 +153,6 @@ private function getNameFromContact(array $r) {
* @return string
*/
private function getPreferredLanguageFromUidOrDefault($uid, $default) {
return $this->config->getUserValue($uid, 'core', 'lang', $default);
return $this->config->getUserValue($uid, 'core', 'language', $default);
}
}
22 changes: 11 additions & 11 deletions controller/viewcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,30 +133,30 @@ public function index() {
return [];
}

$userLang = $this->config->getUserValue($userId, 'core', 'lang', $this->l10nFactory->findLanguage());
$userLang = $this->config->getUserValue($userId, 'core', 'language', $this->l10nFactory->findLanguage());
$languageCodes = $this->l10nFactory->findAvailableLanguages();

$commonLanguages = [];
$languages = [];

foreach($languageCodes as $lang) {
$l = \OC::$server->getL10N('settings', $lang);
foreach($languageCodes as $language) {
$l = \OC::$server->getL10N('settings', $language);
// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
$potentialName = (string) $l->t('__language_name__');
if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
$ln = array('code' => $lang, 'name' => $potentialName);
} elseif ($lang === 'en') {
$ln = ['code' => $lang, 'name' => 'English (US)'];
if($l->getLanguageCode() === $language && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
$ln = array('code' => $language, 'name' => $potentialName);
} elseif ($language === 'en') {
$ln = ['code' => $language, 'name' => 'English (US)'];
}else{//fallback to language code
$ln=array('code'=>$lang, 'name'=>$lang);
$ln=array('code'=>$language, 'name'=>$language);
}

// put appropriate languages into appropriate arrays, to print them sorted
// used language -> common languages -> divider -> other languages
if ($lang === $userLang) {
if ($language === $userLang) {
$userLang = $ln;
} elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) {
$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln;
} elseif (in_array($language, self::COMMON_LANGUAGE_CODES)) {
$commonLanguages[array_search($language, self::COMMON_LANGUAGE_CODES)]=$ln;
} else {
$languages[]=$ln;
}
Expand Down
6 changes: 3 additions & 3 deletions js/app/controllers/attendeecontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ app.controller('AttendeeController', function($scope, AutoCompletionService) {
'rsvp': 'TRUE',
'partstat': 'NEEDS-ACTION',
'cutype': 'INDIVIDUAL',
'lang': OC.getLocale() // Use current user's timezone as a default value
'language': OC.getLocale() // Use current user's timezone as a default value
}
});
}
Expand Down Expand Up @@ -98,7 +98,7 @@ app.controller('AttendeeController', function($scope, AutoCompletionService) {
displayname: displayname,
email: email,
name: attendee.name,
lang: attendee.lang
language: attendee.language
});
});
});
Expand All @@ -117,7 +117,7 @@ app.controller('AttendeeController', function($scope, AutoCompletionService) {
rsvp: 'TRUE',
partstat: 'NEEDS-ACTION',
cutype: 'INDIVIDUAL',
lang: item.lang
language: item.language
}
});
$scope.nameofattendee = '';
Expand Down
2 changes: 1 addition & 1 deletion js/app/models/simpleEventModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ app.factory('SimpleEvent', function () {
'cn',
'delegated-from',
'delegated-to',
'lang'
'language'
];

const organizerParameters = [
Expand Down

0 comments on commit d98187e

Please sign in to comment.