Flarum RTL support
This extension is for adding RTL support to Flarum. Unlike previous versions, you no longer need to write additional LESS/CSS for your forum. Instead, it seamlessly integrates with the existing framework, automatically adjusting the layout and styles to accommodate right-to-left languages. With just a simple installation, users can easily switch their forum's text direction, enhancing accessibility for Arabic, Hebrew, Persian, and other RTL languages.
This extension not only improves user experience for RTL language speakers but also ensures that your forum maintains a professional and polished appearance without any additional coding effort. Enjoy a more inclusive and versatile Flarum community with this essential enhancement!
Based on language
This extension also features the ability to enable RTL support based on the selected language of your forum. When a user chooses an RTL language, the extension automatically loads the appropriate RTL CSS files, ensuring that the forum displays correctly without any manual intervention. This dynamic approach not only streamlines the user experience but also enhances the visual consistency of your forum across different languages. By integrating this functionality, the extension provides a truly tailored experience for users, allowing them to navigate and interact with the forum in their preferred language while maintaining optimal layout and readability. This means that your community can enjoy a seamless transition between languages, making the forum accessible and engaging for all users, regardless of their language preferences.
This plugin adds an RTL version alongside all compiled CSS files. While using this method has many advantages, it can also come with some issues. If you encounter a serious problem while using this plugin, you can visit the issue
section.
Directives
This extension allows users to add directives to their custom CSS for enhanced control.
For example, using /* rtl:ignore */
lets the extension know to ignore specific CSS rules, ensuring they remain unaffected by RTL adjustments.
https://github.com/irmmr/rtl-css#directives
Install
Installation is like all flarum extensions.
composer require irmmr/flarum-ext-rtl
You can also use the latest changes.
composer require irmmr/flarum-ext-rtl:dev-main
Update
composer update irmmr/flarum-ext-rtl
Pure LESS for Stability
For users with forums that use a limited number of extensions, version 0.1.5
is available, featuring pure LESS code. This version helps prevent conflicts or errors, ensuring stability and simplicity. If you don’t need the latest features, this streamlined option provides essential RTL support while maintaining a smooth experience for those who prefer a minimalist setup.
composer require irmmr/flarum-ext-rtl:0.1.5
Potential errors
This extension automatically compiles your CSS to create an RTL version using the irmmr/rtl-css library. Users should note that the MyIntervals/PHP-CSS-Parser may have issues with certain new CSS properties, like linear-gradient
and some calc
and color
functions, which can lead to rendering errors. To address these challenges, I have added extra parsing methods to irmmr/rtl-css, along with encoding adjustments, to help fix some of these issues. While we aim for compatibility, being aware of these limitations can assist in ensuring a smoother experience when customizing your forum’s design. The file irmmr/rtl-cssblob/main/bugs.json contains tests where rtlcss fails to mirror the CSS input. Out of about 150 tests, it encounters issues in 8 cases. These issues are mostly due to parsing errors from the main library MyIntervals/PHP-CSS-Parser. I am trying to reduce the number of these failed mirrors in the future with additional methods.
Links