mirror of
https://github.com/friendica/friendica
synced 2025-04-24 21:10:10 +00:00
New functions for the language library
This commit is contained in:
parent
64c8c2afdf
commit
595508a91f
4 changed files with 41 additions and 14 deletions
|
@ -144,8 +144,8 @@ class Channel extends BaseModule
|
|||
'accesskey' => 'h'
|
||||
];
|
||||
|
||||
$language = User::getLanguageCode($this->session->getLocalUserId(), false);
|
||||
$languages = $this->l10n->getAvailableLanguages();
|
||||
$language = User::getLanguageCode($this->session->getLocalUserId());
|
||||
$languages = $this->l10n->getAvailableLanguages(true);
|
||||
|
||||
$tabs[] = [
|
||||
'label' => $languages[$language],
|
||||
|
@ -344,7 +344,7 @@ class Channel extends BaseModule
|
|||
} elseif (self::$content == self::AUDIO) {
|
||||
$condition = ["`media-type` & ?", 4];
|
||||
} elseif (self::$content == self::LANGUAGE) {
|
||||
$condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", User::getLanguageCode($this->session->getLocalUserId(), true)];
|
||||
$condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", $this->l10n->convertCodeForLanguageDetection(User::getLanguageCode($this->session->getLocalUserId()))];
|
||||
}
|
||||
|
||||
if (self::$content != self::LANGUAGE) {
|
||||
|
@ -404,10 +404,11 @@ class Channel extends BaseModule
|
|||
private function addLanguageCondition(array $condition): array
|
||||
{
|
||||
$conditions = [];
|
||||
$languages = $this->pConfig->get($this->session->getLocalUserId(), 'channel', 'languages', [User::getLanguageCode($this->session->getLocalUserId(), false)]);
|
||||
$languages = $this->pConfig->get($this->session->getLocalUserId(), 'channel', 'languages', [User::getLanguageCode($this->session->getLocalUserId())]);
|
||||
$languages = $this->l10n->convertForLanguageDetection($languages);
|
||||
foreach ($languages as $language) {
|
||||
$conditions[] = "JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?";
|
||||
$condition[] = substr($language, 0, 2);
|
||||
$condition[] = $language;
|
||||
}
|
||||
if (!empty($conditions)) {
|
||||
$condition[0] .= " AND (`language` IS NULL OR " . implode(' OR ', $conditions) . ")";
|
||||
|
|
|
@ -218,7 +218,7 @@ class Display extends BaseSettings
|
|||
BBCode::PREVIEW_LARGE => $this->t('Large Image'),
|
||||
];
|
||||
|
||||
$channel_languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid, false)]);
|
||||
$channel_languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid)]);
|
||||
$languages = $this->l10n->getAvailableLanguages(true);
|
||||
|
||||
$first_day_of_week = $this->pConfig->get($uid, 'calendar', 'first_day_of_week', 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue