Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is trying to add the

dir="rtl"

attribute to pages translated into Dari on their website. While pages in Arabic correctly have this attribute, the Dari pages do not.
Solution:
First, ensure that Dari is recognized as an RTL language in your WordPress setup. Since Dari is not a built-in language in WPML or WordPress, you need to manually configure it. You can map Dari to Arabic in WPML to inherit the RTL attributes. This can be done under WPML -> Languages -> Site Languages -> Edit languages. For more details, visit Editing WPML's Languages Table.

Additionally, check your theme's compatibility with RTL languages and ensure it supports RTL styling. For guidance on building RTL WordPress themes, refer to Building RTL WordPress Themes and the WordPress Codex at Right-to-Left Language Support.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 0 voices.

Last updated by Bobby 4 weeks, 1 day ago.

Assisted by: Bobby.

Author Posts
July 2, 2025 at 3:38 pm #17194070

metroW

Background of the issue:
I am trying to add the dir="rtl" attribute to pages on our site that have been translated into Dari. Currently, pages translated into Arabic have this attribute, but pages translated into Dari do not.

I have provided lines of code from our site for reference:
<html dir="rtl" lang="ar" id="html" class="" itemtype="hidden link" itemscope="" style="--scrollbar-offset: 15px;">

<html lang="prs" id="html" class="" itemtype="hidden link" itemscope="" style="--scrollbar-offset: 15px;">.

The site I need help with is hidden link.

Symptoms:
Pages translated into Dari do not include the dir="rtl" attribute.

Questions:
Is there a way to apply the dir="rtl" attribute to pages we translate into Dari?

July 2, 2025 at 7:08 pm #17194616

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Thank you for contacting WPML support. While you wait for one of my colleagues to take this ticket and work on it, let me provide you with the first debugging steps or see if I can help with the issue quickly.

I assume you created a custom language for Dari. I say this because WPML does not include Dari as a built-in language. One approach to resolving this issue is to map it to Arabic. You can do it in WPML -> Languages -> Site Languages -> Edit languages (link). Please read more about this here.

https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/

Please share your site's Debug information if you need further help with this issue. You can read about it here: http://wpml.org/faq/provide-debug-information-faster-support/

Regards,
Itamar.

July 2, 2025 at 9:24 pm #17194883

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

WPML is fully compatible with RTL languages. While WPML allows you to translate into RTL or use RTL, the handling of RTL content is dependent on the theme's CSS as well as the language being registered as an RTL language.

Currently Dari is not officially supported by WordPress, therefore when adding it, there is nothing letting WordPress know that it's a RTL language.

Please review the following documentation along with the WP Codex on how you can configure the language to be RTL.

https://wpml.org/documentation/theme-compatibility/build-rtl-wordpress-themes/

https://codex.wordpress.org/Right-to-Left_Language_Support