PrestaShop supports RTL (Right-to-left) themes natively.
There are two ways of customizing your theme for RTL: either by adding an override file that is only loaded for RTL languages, or by using completely different version of the theme’s stylesheets.
PrestaShop will try to load a css file named rtl.css
after your theme’s ones when displayed in an RTL language. You can use this file to place any style override you need for RTL.
When the shop is displayed in an RTL language, PrestaShop will automatically try and load RTL versions of the theme’s stylesheets if they are available, instead of the “normal” ones.
RTL versions are automatically “discovered” by PrestaShop using a simple convention: to obtain the RTL version name, you just need to add _rtl
to the end of the standard file name.
Example:
Original name | RTL version name |
---|---|
theme.css |
theme_rtl.css |
theme-custom.css |
theme-custom_rtl.css |
PrestaShop can also automagically generate an RTL version of your theme’s stylesheets based on the original CSS files.
Follow this steps to generate RTL stylesheets for your theme:
This process will generate _rtl.css
files for every .css
file in the theme.
Sometimes the automatic transformation won’t be enough to get your theme exactly how you want it.
You should never modify generated _rtl.css
files – they are generated automatically by PrestaShop.
If you need to add some specific css to fix your RTL transformed files, use .rtlfix
files. The content of those files is appended to the RTL version of that file after it’s transformed.
This is what PrestaShop does for each .css
file in the theme:
my-file.css
)my-file_rtl.css
exists, move on to the next file.my-file.css
to RTL and save its contents to my-file_rtl.css
my-file.rtlfix
exists, append its contents to my-file_rtl.css
.