Add 'rtl' class to body for right-to-left language support#6617
Add 'rtl' class to body for right-to-left language support#6617valadas merged 3 commits intodnnsoftware:developfrom
Conversation
|
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 |
|
@valadas Hi Valadas, I would also be interested if DNN supported RTL, but I think we need a full PR that handles this feature. |
|
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. |
|
I see you added |
|
Such a helpful improvement—thanks so much! |
|
Thanks everyone! Adding right-to-left support is a great enhancement that helps accommodate all RTL languages such as Persian, Arabic, Hebrew, and more. |
Behnam-Emamian
left a comment
There was a problem hiding this comment.
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.
|
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