ShahiTranslate

RTL (Right-to-Left) Language Support

Overview

ShahiTranslate Pro provides comprehensive support for RTL (Right-to-Left) languages like Arabic, Hebrew, Persian, and Urdu. This includes automatic layout mirroring, text direction handling, and visual adjustments.

What is RTL?

RTL vs LTR

LTR (Left-to-Right):

    1. English, Spanish, French, German, most European languages
    2. Text flows left to right
    3. UI elements align left
    4. RTL (Right-to-Left):

    5. Arabic, Hebrew, Persian, Urdu, Yiddish
    6. Text flows right to left
    7. UI elements align right
    8. Entire layout mirrors
    9. RTL Languages Supported

      ShahiTranslate Pro automatically detects and handles:

      | Language | Code | Native Name | Script |
      |———-|——|————-|——–|
      | Arabic | ar | العربية | Arabic |
      | Hebrew | he | עברית | Hebrew |
      | Persian | fa | فارسی | Persian |
      | Urdu | ur | اردو | Arabic |
      | Yiddish | yi | ייִדיש | Hebrew |
      | Pashto | ps | پښتو | Arabic |
      | Sindhi | sd | سنڌي | Arabic |
      | Kurdish | ku | کوردی | Arabic |
      | Uyghur | ug | ئۇيغۇرچە | Arabic |

      Automatic RTL Detection

      How It Works

      Plugin automatically:

    10. Detects RTL language selection
    11. Adds dir="rtl" attribute to HTML
    12. Loads RTL-specific CSS
    13. Mirrors layout appropriately
    14. Adjusts text alignment
    15. No Manual Configuration Required

      HTML Changes

      LTR Language (English):
      `html





      `

      RTL Language (Arabic):
      `html





      `

      CSS Loading

      Automatic CSS Injection:

    16. Plugin loads assets/css/rtl.css for RTL languages
    17. Provides layout mirroring
    18. Adjusts text alignment
    19. Fixes common RTL issues
    20. Enabling RTL Support

      Basic Setup

      Location: ShahiTranslate Pro → Settings → Languages → RTL Settings

      `
      ✅ Enable RTL Support
      RTL Languages: Automatically detected (ar, he, fa, ur)
      ✅ Auto-detect RTL direction
      ✅ Load RTL stylesheet
      Save Changes
      `

      Manual RTL Configuration

      If Auto-detection Doesn’t Work:

      `
      Settings → Languages → RTL Settings
      Manual RTL Languages:
      ✅ Arabic (ar)
      ✅ Hebrew (he)
      ✅ Persian (fa)
      ✅ Urdu (ur)
      Add custom: [language code]
      `

      What Gets Mirrored

      Layout Elements

      Automatically Mirrored:

    21. ✅ Text alignment (left → right)
    22. ✅ Padding (left → right, right → left)
    23. ✅ Margin (left → right, right → left)
    24. ✅ Float (left → right, right → left)
    25. ✅ Navigation menus
    26. ✅ Sidebars
    27. ✅ Form fields
    28. ✅ Buttons
    29. ✅ Icons with directional meaning
    30. Not Mirrored:

    31. ⬜ Images (unless explicitly mirrored)
    32. ⬜ Videos
    33. ⬜ Logos (usually kept as-is)
    34. ⬜ Maps
    35. ⬜ Graphs and charts
    36. Text Direction

      Text Alignment:
      `css
      / LTR /
      text-align: left;

      / RTL (automatically converted) /
      text-align: right;
      `

      Reading Direction:
      `css
      / LTR /
      direction: ltr;

      / RTL /
      direction: rtl;
      `

      Navigation

      Menu Structure:

      LTR Menu:
      `
      [Home] [About] [Services] [Contact]
      `

      RTL Menu (mirrored):
      `
      [Contact] [Services] [About] [Home]
      `

      Implementation: Automatic, no changes needed

      Sidebar Position

      LTR Layout:
      `
      +—————-+—–+
      | | |
      | Content | Bar |
      | | |
      +—————-+—–+
      `

      RTL Layout (mirrored):
      `
      +—–+—————-+
      | | |
      | Bar | Content |
      | | |
      +—–+—————-+
      `

      RTL CSS

      Built-in RTL Styles

      Plugin includes comprehensive RTL CSS (assets/css/rtl.css):

      Example Styles:
      `css
      / Body direction /
      body.rtl {
      direction: rtl;
      text-align: right;
      }

      / Float reversal /
      .rtl .float-start {
      float: right !important;
      }

      .rtl .float-end {
      float: left !important;
      }

      / Text alignment /
      .rtl .text-start {
      text-align: right !important;
      }

      .rtl .text-end {
      text-align: left !important;
      }

      / Margin and padding /
      .rtl .ms-auto {
      margin-right: auto !important;
      margin-left: 0 !important;
      }

      .rtl .me-auto {
      margin-left: auto !important;
      margin-right: 0 !important;
      }
      `

      Custom RTL CSS

      Adding Your Own RTL Styles:

      Location: ShahiTranslate Pro → Settings → Advanced → Custom RTL CSS

      `css
      / Example: Fix header alignment /
      .rtl #header .logo {
      float: right;
      margin-left: 20px;
      margin-right: 0;
      }

      / Example: Reverse icon direction /
      .rtl .icon-arrow-right::before {
      content: “←”;
      }

      .rtl .icon-arrow-left::before {
      content: “→”;
      }

      / Example: Breadcrumb separators /
      .rtl .breadcrumb-separator::after {
      content: “←”;
      }
      `

      Theme-Specific RTL

      If Theme Doesn’t Support RTL:

      Many themes lack RTL support. Add fixes:

      `css
      / Container adjustments /
      .rtl .container {
      direction: rtl;
      }

      / Grid system fixes /
      .rtl .row {
      direction: rtl;
      }

      .rtl [class*=”col-“] {
      float: right;
      }

      / Navigation menu /
      .rtl .menu {
      text-align: right;
      }

      .rtl .menu-item {
      float: right;
      }

      / Forms /
      .rtl input,
      .rtl textarea,
      .rtl select {
      text-align: right;
      }

      / Buttons /
      .rtl .button-with-icon {
      padding-right: 30px;
      padding-left: 15px;
      }

      .rtl .button-with-icon .icon {
      right: auto;
      left: 10px;
      }
      `

      Mixed Content Handling

      LTR Text in RTL Context

      The Problem:

    37. English words in Arabic sentences
    38. Numbers in RTL text
    39. URLs and emails
    40. Solution: Unicode Bidirectional Algorithm

      Automatic Handling:
      Plugin uses Unicode BiDi to correctly display mixed content:

      Example:
      `
      Arabic text: مرحبا بكم في WordPress
      Renders correctly with “WordPress” LTR within RTL text
      `

      Numbers and Dates

      Numbers:

    41. Arabic numerals (0-9) maintain LTR direction
    42. Arabic-Indic numerals (٠-٩) flow RTL
    43. Plugin preserves number direction
    44. Dates:
      `
      LTR: January 15, 2024
      RTL: ١٥ يناير ٢٠٢٤
      `

      Implementation:
      `php
      // Automatic date localization
      Settings → Languages → Date Format
      ✅ Use localized date format
      ✅ Use native numerals for RTL languages
      `

      Quotes and Punctuation

      English Quotes (LTR):

    45. Opening: ”
    46. Closing: ”
    47. Arabic Quotes (RTL):

    48. Opening: «
    49. Closing: »
    50. Plugin Handling:
      `
      Settings → Languages → RTL → Punctuation
      ✅ Localize quote marks
      ✅ Adjust punctuation spacing
      `

      Language Switcher in RTL

      Switcher Position

      RTL Considerations:

    51. Default “top-right” becomes “top-left” in RTL
    52. Plugin automatically adjusts
    53. Can override if needed
    54. Configuration:
      `
      Settings → Switcher → Position
      LTR Position: Top-right
      RTL Position: Automatic mirror (top-left)
      Or: Manual override → Top-right (if want same corner)
      `

      Flag Direction

      Flags Don’t Mirror:

    55. Flag images remain as-is
    56. Don’t flip flag graphics
    57. Position adjusts, image doesn’t
    58. Dropdown Direction

      Dropdown Opening:

    59. LTR: Opens downward-right
    60. RTL: Opens downward-left (automatic)
    61. Form Handling

      Form Fields

      Automatic Adjustments:
      `html



      `

      Labels

      Label Position:

    62. LTR: Label left of field
    63. RTL: Label right of field
    64. Automatic Alignment

      Placeholders

      Placeholder Text:
      `html



      `

      Text aligns automatically based on language

      Checkboxes and Radio Buttons

      Position Reversal:
      `
      LTR:
      ☐ Option 1
      ☐ Option 2

      RTL:
      Option 1 ☐
      Option 2 ☐
      `

      CSS:
      `css
      .rtl input[type=”checkbox”],
      .rtl input[type=”radio”] {
      float: right;
      margin-left: 10px;
      margin-right: 0;
      }
      `

      WooCommerce RTL

      Product Pages

      Automatic Adjustments:

    65. Product image gallery (left → right)
    66. Product info sidebar
    67. Add to Cart button
    68. Price alignment
    69. CSS Provided:
      `css
      .rtl .woocommerce-product-gallery {
      float: right;
      }

      .rtl .summary {
      float: left;
      }

      .rtl .price {
      text-align: right;
      }
      `

      Cart and Checkout

      Table Alignment:
      `
      LTR:
      Product | Price | Quantity | Total

      RTL:
      Total | Quantity | Price | Product
      `

      Currency Symbol:

    70. LTR: $100
    71. RTL (varies by locale): 100 ریال or ريال 100
    72. Configuration:
      `
      WooCommerce → Settings → General → Currency Options
      Currency Position: Right (for RTL) or Left (for LTR)
      Plugin adjusts automatically per language
      `

      Page Builder Support

      Elementor

      RTL Support:

    73. Elementor has built-in RTL support
    74. Plugin works seamlessly with Elementor
    75. Columns reverse automatically
    76. Text widgets align properly
    77. Manual Adjustments:
      `
      Elementor → Section Settings → Advanced → Custom CSS
      Add RTL-specific styles if needed
      `

      Beaver Builder

      RTL Support:

    78. Good built-in RTL support
    79. Minor adjustments may be needed
    80. Custom Module CSS:
      `
      Settings → Advanced → Custom RTL CSS for modules
      `

      Divi

      RTL Support:

    81. Divi has RTL support
    82. May need theme RTL stylesheet
    83. Configuration:
      `
      Divi → Theme Options → General → Enable Right to Left Language Support
      ✅ Enable
      `

      WPBakery

      RTL Support:

    84. Limited built-in RTL support
    85. Requires custom CSS
    86. Solution:
      `css
      / WPBakery RTL fixes /
      .rtl .vc_row {
      direction: rtl;
      }

      .rtl .vccolumncontainer {
      float: right;
      }

      .rtl .wpb_wrapper {
      text-align: right;
      }
      `

      Testing RTL Layout

      Visual Inspection

      Checklist:

    87. ✅ Text aligns right
    88. ✅ Layout mirrors correctly
    89. ✅ Navigation menu reversed
    90. ✅ Sidebar on correct side
    91. ✅ Forms align properly
    92. ✅ Buttons positioned correctly
    93. ✅ Images don’t overlap text
    94. ✅ Icons face correct direction
    95. Browser DevTools

      Testing in Chrome:

    96. Open DevTools (F12)
    97. Go to Elements tab
    98. Find tag
    99. Verify dir="rtl" attribute
    100. Check applied CSS rules
    101. Force RTL for Testing:
      `javascript
      // In browser console
      document.documentElement.setAttribute(‘dir’, ‘rtl’);
      document.body.classList.add(‘rtl’);
      `

      Real Device Testing

      Important:

    102. Test on actual devices if possible
    103. Phones may render differently
    104. Tablets have unique considerations
    105. Check on various screen sizes
    106. Test Devices:

    107. iOS (Safari)
    108. Android (Chrome)
    109. Desktop browsers (Chrome, Firefox, Safari, Edge)
    110. Common RTL Issues

      Issue: Layout Doesn’t Mirror

      Symptom: RTL language selected but layout stays LTR

      Causes:

    111. RTL support not enabled
    112. Theme forces LTR direction
    113. Conflicting CSS
    114. Solutions:
      `

    115. Enable RTL in settings
    116. Check theme supports RTL:
    117. – Look for rtl.css in theme
      – May need to create one

    118. Add to functions.php:
    119. addthemesupport(‘rtl’);

    120. Clear all caches
    121. `

      Issue: Text Aligns Left

      Symptom: Text in RTL language aligns left instead of right

      Causes:

    122. Theme CSS has high specificity
    123. Inline styles overriding
    124. Solutions:
      `css
      / Force text alignment /
      .rtl * {
      text-align: right !important;
      }

      / Or more specific /
      .rtl p,
      .rtl li,
      .rtl div {
      text-align: right !important;
      }
      `

      Issue: Sidebar Wrong Side

      Symptom: Sidebar stays on right in RTL layout

      Causes:

    125. Theme hardcodes sidebar position
    126. Flexbox/Grid not mirroring
    127. Solutions:
      `css
      / Float-based layouts /
      .rtl #sidebar {
      float: left;
      }

      .rtl #content {
      float: right;
      }

      / Flexbox layouts /
      .rtl .container {
      flex-direction: row-reverse;
      }

      / Grid layouts /
      .rtl .grid-container {
      direction: rtl;
      }
      `

      Issue: Icons Wrong Direction

      Symptom: Arrows and directional icons don’t flip

      Causes:

    128. Icons are images (don’t auto-flip)
    129. Font icons need manual reversal
    130. Solutions:
      `css
      / Flip directional icons /
      .rtl .icon-arrow-right {
      transform: scaleX(-1);
      }

      / Or use different icon /
      .rtl .icon-arrow-right::before {
      content: “\f053”; / fa-arrow-left /
      }
      `

      Issue: Numbers Display Incorrectly

      Symptom: Phone numbers, dates show reversed

      Causes:

    131. BiDi algorithm confusion
    132. Formatting issues
    133. Solutions:
      `html

      +1-555-1234

      `

      Advanced RTL Features

      Logical Properties

      Modern CSS (works automatically):
      `css
      / Instead of /
      margin-left: 10px;
      margin-right: 20px;

      / Use logical properties /
      margin-inline-start: 10px;
      margin-inline-end: 20px;
      / Automatically adjusts for RTL /
      `

      Browser Support: Modern browsers (IE11 not supported)

      BiDi Override

      When Needed:

    134. Code snippets in RTL page
    135. Technical content
    136. URLs and emails
    137. Implementation:
      `html

      هذا نص عربي

      code@example.com

      نص عربي يستمر

      `

      Custom Fonts for RTL

      Arabic Font Recommendations:

    138. Amiri
    139. Cairo
    140. Tajawal
    141. Almarai
    142. Noto Sans Arabic
    143. Loading Fonts:
      `css
      @import url(‘https://fonts.googleapis.com/css2?family=Tajawal&display=swap’);

      .rtl body {
      font-family: ‘Tajawal’, sans-serif;
      }
      `

      Configuration:
      `
      Settings → Languages → RTL → Typography
      Custom Font Family: Tajawal
      Load Google Font: ✅ Yes
      `

      Best Practices

      1. Test Early and Often

    144. Don’t wait until launch to test RTL
    145. Test with actual RTL speakers
    146. Check on multiple devices
    147. 2. Use Logical CSS Properties

    148. Prefer start/end over left/right
    149. Use modern CSS when possible
    150. Plan for future RTL support
    151. 3. Don’t Over-Mirror

    152. Not everything should flip
    153. Logos stay as-is
    154. Photos don’t mirror
    155. Data visualizations may not mirror
    156. 4. Consider Typography

    157. Use appropriate fonts for RTL
    158. Ensure good readability
    159. Test font sizes
    160. 5. Cultural Localization

    161. Don’t just mirror layout
    162. Adapt content culturally
    163. Use local examples
    164. Respect cultural norms
    165. RTL Resources

      Tools

    166. RTL Tester: Browser extensions to force RTL
    167. BiDi Checker: Validate BiDi implementation
    168. CSS Analyzer: Check RTL-ready CSS
    169. Documentation

    170. W3C BiDi Guidelines
    171. Unicode Bidirectional Algorithm
    172. CSS Writing Modes Specification
    173. Communities

    174. RTL.CSS on GitHub
    175. Stack Overflow RTL tag
    176. WordPress RTL Forum
    177. Next Steps

    178. Language Switcher Options
    179. Translation Methods
    180. Custom CSS Styling
    181. Theme Compatibility

Share this article

Was this article helpful?

Help us improve our documentation

Still need help?

Our support team is ready to assist you with personalized guidance for your workspace.

Submit a support ticket