Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility patch #4644

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 17 additions & 1 deletion lib/Handler/FooterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ class FooterHandler {
private const MIN_QRCODE_SIZE = 100;
private const POINT_TO_MILIMETER = 0.3527777778;
private array $templateVars = [];
public const RTL_LANGUAGES = [
'ar', // Arabic
'fa', // Persian
'he', // Hebrew
'ps', // Pashto,
'ug', // 'Uyghurche / Uyghur
'ur_PK', // Urdu
];

public function __construct(
private IAppConfig $appConfig,
Expand Down Expand Up @@ -138,7 +146,7 @@ public function setTemplateVar(string $name, mixed $value): self {
private function getTemplateVars(): array {
$this->templateVars['signedBy'] = $this->appConfig->getValueString(Application::APP_ID, 'footer_signed_by', $this->l10n->t('Digital signed by LibreSign.'));

$this->templateVars['direction'] = $this->l10nFactory->getLanguageDirection($this->l10n->getLanguageCode());
$this->templateVars['direction'] = $this->getLanguageDirection($this->l10n->getLanguageCode());

$this->templateVars['linkToSite'] = $this->appConfig->getValueString(Application::APP_ID, 'footer_link_to_site', 'https://libresign.coop');

Expand Down Expand Up @@ -167,6 +175,14 @@ private function getTemplateVars(): array {
return $this->templateVars;
}

private function getLanguageDirection(string $language): string {
if (in_array($language, self::RTL_LANGUAGES, true)) {
return 'rtl';
}

return 'ltr';
}

private function getTemplateFile(): string {
$footerTemplate = $this->appConfig->getValueString(Application::APP_ID, 'footer_template', '');
if ($footerTemplate) {
Expand Down
Loading