Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/ILIAS/UICore/classes/class.ilGlobalTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ilGlobalTemplate implements ilGlobalTemplateInterface
protected string $left_content = '';
protected string $right_content = '';
protected string $login_target_par = '';
protected ?string $content_language = null;

/**
* @throws ilTemplateException|ilSystemStyleException
Expand Down Expand Up @@ -854,12 +855,28 @@ public function fillContentLanguage(): void
global $DIC;
$lng = $DIC->language();

if ($this->content_language !== null) {
$this->setVariable('META_CONTENT_LANGUAGE', $this->content_language);
$this->setVariable(
'LANGUAGE_DIRECTION',
in_array($this->content_language, ["ar", "fa", "ur", "he"], true)
? "rtl"
: "ltr"
);
return;
}

if (is_object($lng)) {
$this->setVariable('META_CONTENT_LANGUAGE', $lng->getContentLanguage());
$this->setVariable('LANGUAGE_DIRECTION', $lng->getTextDirection());
}
}

public function setContentLanguage(string $content_language): void
{
$this->content_language = $content_language;
}

public function fillWindowTitle(): void
{
global $DIC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,41 @@ public function getTemplateInjectors(): array
$page
);
$resource_injector = new COPage\ResourcesInjector($resource_collector);
$document_title = $this->getDocumentTitle();
$document_language = $this->getDocumentLanguage();

return [
function ($tpl) use ($resource_injector) {
function ($tpl) use ($resource_injector, $document_title, $document_language) {
$tpl->setHeaderPageTitle($document_title);
$tpl->setContentLanguage($document_language);
$resource_injector->inject($tpl);
}
];
}

private function getDocumentTitle(): string
{
if (count($this->selected_pages) !== 1) {
return $this->wiki->getTitle();
}

$page_title = \ilWikiPage::lookupTitle($this->selected_pages[0]);
return $page_title === null
? $this->wiki->getTitle()
: $this->wiki->getTitle() . " - " . $page_title;
}

private function getDocumentLanguage(): string
{
$language = $this->wiki->getObjectProperties()
->getPropertyTranslations()
->getBaseLanguage();

return $language !== ""
? $language
: $this->lng->getContentLanguage();
}

public function getPages(): array
{
$print_pages = [];
Expand Down
Loading