Skip to content

Commit ea28f57

Browse files
committed
Tweaks
1 parent d3c45d9 commit ea28f57

File tree

5 files changed

+6
-26
lines changed

5 files changed

+6
-26
lines changed

assets/styles/_rtl.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
direction: rtl;
343343
text-align: right;
344344
}
345-
345+
346346
.rtl .d-print-none {
347347
display: none !important;
348348
}
@@ -399,9 +399,9 @@
399399
margin-right: 0;
400400
margin-left: 0;
401401
}
402-
402+
403403
.rtl .dropdown-menu {
404404
right: auto;
405405
left: 0;
406406
}
407-
}
407+
}

assets/styles/app.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,5 +609,3 @@ body#blog_search .post-metadata {
609609
padding-bottom: 0;
610610
padding-top: 0;
611611
}
612-
613-

src/Twig/AppExtension.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function getFunctions(): array
4343
return [
4444
new TwigFunction('locales', [$this, 'getLocales']),
4545
new TwigFunction('is_rtl', [$this, 'isRtl']),
46-
new TwigFunction('rtl_class', [$this, 'getRtlClass']),
47-
new TwigFunction('rtl_dir', [$this, 'getRtlDir']),
4846
];
4947
}
5048

@@ -79,20 +77,4 @@ public function isRtl(?string $locale = null): bool
7977

8078
return \in_array($locale, ['ar', 'fa', 'he', 'ur', 'ps', 'sd'], true);
8179
}
82-
83-
/**
84-
* Get RTL class if the locale is RTL.
85-
*/
86-
public function getRtlClass(?string $locale = null): string
87-
{
88-
return $this->isRtl($locale) ? 'rtl' : '';
89-
}
90-
91-
/**
92-
* Get direction attribute value for RTL support.
93-
*/
94-
public function getRtlDir(?string $locale = null): string
95-
{
96-
return $this->isRtl($locale) ? 'rtl' : 'ltr';
97-
}
9880
}

templates/base.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
See https://symfony.com/doc/current/templates.html#template-inheritance-and-layouts
55
#}
66
<!DOCTYPE html>
7-
<html lang="{{ app.locale }}" dir="{{ rtl_dir(app.locale) }}">
7+
<html lang="{{ app.locale }}" dir="{{ is_rtl() ? 'rtl' : 'ltr' }}">
88
<head>
99
<meta charset="UTF-8" />
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
@@ -23,7 +23,7 @@
2323
<link rel="shortcut icon" type="image/svg+xml" href="{{ asset('favicon.svg') }}">
2424
</head>
2525

26-
<body id="{% block body_id %}{% endblock %}" class="{{ rtl_class(app.locale) }}">
26+
<body id="{% block body_id %}{% endblock %}" class="{{ is_rtl(app.locale) ? 'rtl' }}">
2727

2828
{% block header %}
2929
{% set _route = app.current_route %}

templates/default/_language_selector.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ul class="locales">
2626
{% for locale in locales() %}
2727
{% set is_active = app.locale == locale.code %}
28-
<li class="{{ is_active ? 'active' }} {{ rtl_class(locale.code) }}" translate="no">
28+
<li class="{{ is_active ? 'active' }} {{ is_rtl(locale.code) ? 'rtl' }}" translate="no">
2929
<a class="stretched-link" lang="{{ locale.code }}" hreflang="{{ locale.code }}" href="{{ path(app.current_route ?? 'blog_index', app.current_route_parameters|merge({_locale: locale.code})) }}">
3030
{{ locale.name|capitalize }}
3131
<small>{{ locale.code }}</small>

0 commit comments

Comments
 (0)