This project is not covered by Drupal’s security advisory policy.

This module provides a twig function called is_laguage_rtl which can be used by theme developer in html.twig files.
Before Drupal 8, theme developers simply would put STYLE-rtl.css files in their style directory and Drupal would handle of adding styles to page whenever site language was RTL but this feature was removed from drupal 8 above as Drupal stopped dealing with styles and scripts and started to deal with Libraries instead.

So the main propose of this module is to attach RTL libraries when the current language of site is RTL , Like Persian, Arabic or ...

As you can simply attach library inside twig files (which I think is a better practice than adding them using hook_preprocess function) this module gives you the ability to detect if site current language is RTL or not so you can add rtl libraries based on language direction.

that is a simple code:

{{ attach_library('my_theme/front') }}
{% if is_language_rtl() %}
  {{ attach_library('my_theme/front_rtl') }}
{% endif %}

Caution: this module does not attach RTL styles automatically and it's up to theme developers to attach desired libraries.

Project information

Releases