Skip to content

Add 'rtl' class to body for right-to-left language support#6617

Merged
valadas merged 3 commits intodnnsoftware:developfrom
mnouraei:class-rtl
Jul 9, 2025
Merged

Add 'rtl' class to body for right-to-left language support#6617
valadas merged 3 commits intodnnsoftware:developfrom
mnouraei:class-rtl

Conversation

@mnouraei
Copy link
Copy Markdown
Contributor

@mnouraei mnouraei commented Jul 8, 2025

This PR adds basic RTL language support by updating the tag classes when the current UI culture is right-to-left:

Checks if the current UI culture is RTL.

If the <body> tag has no existing class, it adds "rtl".

If it already has classes but not "rtl", it appends "rtl" to ensure proper RTL layout rendering.

These changes improve layout direction handling for RTL languages such as Persian (fa-IR).

Notes1:
Tested with Persian culture to confirm that the RTL class is applied correctly for proper layout rendering.

Notes2:
Considering the changes in PR #6616, this update has been adjusted
accordingly.

@microsoft-github-policy-service agree

@valadas
Copy link
Copy Markdown
Contributor

valadas commented Jul 8, 2025

Also (I am no expert on rtl languages) but it looks like the standard would be to add the dir attribute to the html element... Maybe we could stick to that?

@mnouraei
Copy link
Copy Markdown
Contributor Author

mnouraei commented Jul 8, 2025

Also (I am no expert on rtl languages) but it looks like the standard would be to add the dir attribute to the html element... Maybe we could stick to that?

I have been localizing this repository for Persian users for the past 6 years in a fork based on this project. During these years, I have gained extensive experience with DNN, and I intend to gradually contribute these experiences to the core repository with the approval of the DNN team.

The approach I used in this PR is very reliable and has been tested with over 5,000 downloads.

You can find my fork here: Persian-DnnSoftware/Dnn.Platform

@Mostafa-Moafi
Copy link
Copy Markdown
Contributor

@valadas Hi Valadas, I would also be interested if DNN supported RTL, but I think we need a full PR that handles this feature.
What do you think?

@mnouraei
Copy link
Copy Markdown
Contributor Author

mnouraei commented Jul 8, 2025

Thanks, @Mostafa-Moafi . As a first step, I just wanted to enable this feature in DNN so that we can apply CSS changes and other adjustments in the next phases. Making too many changes at once might not get initial approval.

@bdukes
Copy link
Copy Markdown
Contributor

bdukes commented Jul 8, 2025

I see you added @microsoft-github-policy-service agree to the issue description, I believe the CLA bot needs that as a comment, rather than in the description.

@azarbara
Copy link
Copy Markdown

azarbara commented Jul 8, 2025

Such a helpful improvement—thanks so much!

Copy link
Copy Markdown
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@valadas valadas added this to the 10.0.2 milestone Jul 8, 2025
@Behnam-Emamian
Copy link
Copy Markdown
Contributor

Thanks everyone! Adding right-to-left support is a great enhancement that helps accommodate all RTL languages such as Persian, Arabic, Hebrew, and more.

Copy link
Copy Markdown
Contributor

@Behnam-Emamian Behnam-Emamian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach has been thoroughly tested over the years within the Persian developer community, and the implementation demonstrates solid, reliable code for enabling RTL support.

@mnouraei
Copy link
Copy Markdown
Contributor Author

mnouraei commented Jul 9, 2025

@microsoft-github-policy-service agree

@valadas valadas merged commit 92e25f4 into dnnsoftware:develop Jul 9, 2025
3 checks passed
@valadas valadas modified the milestones: 10.0.2, 10.1.0 Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants