Background of the issue:
I am trying to resolve an issue with the translated language direction (rtl) on my website. I previously submitted another ticket and received assistance from Kor, who was exceptionally helpful. He provided me with the following code to adjust the language direction: *:lang(sy-s) { direction: rtl!important; }. The issue can be seen on this page: hidden link.
Symptoms:
The rtl direction works correctly on pages but there are widgets i am using still reading the wrong direction. When using Firefox, the direction is entirely incorrect. I have cleared caches and tested on different devices, but the issue persists.
Questions:
Could you please conduct a further investigation?
Welcome to WPML support. Please add the code below to the end of the functions.php file of your theme:
function add_rtl_direction_attribute($output) {
// Check if the language attribute contains 'sy-s'
if (strpos($output, 'lang="sy-s"') !== false) {
// Add the dir="rtl" attribute to the HTML tag
$output = str_replace('lang="sy-s"', 'lang="sy-s" dir="rtl"', $output);
}
return $output;
}
// Hook into the 'language_attributes' filter to modify the HTML tag attributes
add_filter('language_attributes', 'add_rtl_direction_attribute');
The code above will force the dire="rtl" attribute when the sy-s language is shown.
That is an HTML directive to tell your theme to consider the language a right to left one.
The rest will be on your theme's hand how to handle the situation of the RTl language styling.
The snippet above should also work on Firefox.
Thanks.
The topic ‘[Closed] RTL direction’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.