rtl-right-to-left-i18n-cursorrules — Cursor rule for RTL layouts
A Cursor rule that pushes the agent toward logical CSS and Tailwind utilities instead of left/right. Useful when the app has to run in Arabic, Hebrew, Persian or Urdu.
.cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdcWhat rtl-right-to-left-i18n-cursorrules-prompt-file does
The rule lays out eight areas. Logical CSS properties replace physical ones: margin-inline-start over margin-left, inset-inline-start over left. Tailwind gets the same treatment — ms-4, me-4, ps-4, pe-4, start-0, end-0. React Native has its own list: paddingStart instead of paddingLeft.
Then come bidirectional text and icons. Mixed-script strings should sit inside <bdi>, and directional icons — arrows, chevrons, back buttons — flip in RTL. Home, settings and search stay put. Strings should not be hardcoded; numbers and dates go through Intl.NumberFormat and Intl.DateTimeFormat, with dir="auto" or dir="rtl" on the root. Carousels, sliders, progress bars and swipe gestures reverse direction.
For auditing the rule points at rtlify-ai: npx rtlify-ai init installs the rules, npx rtlify-ai check finds violations, npx rtlify-ai fix repairs them. Testing advice is blunt — use real RTL content, not a mirrored LTR page, or bidirectional bugs stay hidden. The file lives at .cursor/rules/ with an .mdc extension, so outside Cursor it does nothing.
What it helps with
- convert physical CSS properties to logical ones without editing every file by hand
- catch Tailwind
ml-andpr-classes that break an RTL layout - wrap user names in
<bdi>so mixed-script text stops jumping - reverse carousels, sliders and swipe gestures when the direction flips
- flip arrows and chevrons while leaving search and settings icons alone
Example prompts for the agent
- Audit this component for RTL and swap physical properties for logical ones
- Fix the Tailwind classes in
src/components/Card.tsxfor RTL - Run
npx rtlify-ai checkand fix what it reports
How to install rtl-right-to-left-i18n-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/rtl-right-to-left-i18n-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about rtl-right-to-left-i18n-cursorrules-prompt-file
How do I install rtl-right-to-left-i18n-cursorrules in Cursor?
Create .cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdc and paste the rule contents into it. Cursor picks up rules from the .cursor/rules/ folder.
What does this rule do?
It gives the agent a checklist for RTL work: logical CSS properties, logical Tailwind utilities, <bdi> around mixed-script text, flipped directional icons, and auditing through rtlify-ai.
Do I need rtlify-ai for the rule to work?
No. It is a separate tool for detecting and auto-fixing violations. The rule works without it, but then you check RTL by hand.
Source text
rtl-right-to-left-i18n-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for RTL development with logical CSS properties, Tailwind logical classes, bidirectional text, and automated auditing via rtlify-ai."
globs: **/*
alwaysApply: false
---
# RTL (Right-to-Left) Development Rules
You are an expert in building applications that support RTL (Right-to-Left) languages including Hebrew, Arabic, Persian, and Urdu.
## Core Rules
### 1. Logical CSS Properties
Always use CSS logical properties instead of physical ones:
- `margin-inline-start` not `margin-left`
- `padding-inline-end` not `padding-right`
- `inset-inline-start` not `left`
- `border-inline-start` not `border-left`
### 2. Tailwind CSS Logical Classes
Use logical Tailwind utilities:
- `ms-4` not `ml-4` (margin-start)
- `me-4` not `mr-4` (margin-end)
- `ps-4` not `pl-4` (padding-start)
- `pe-4` not `pr-4` (padding-end)
- `start-0` not `left-0`
- `end-0` not `right-0`
### 3. React Native Logical Properties
Use logical properties in React Native styles:
- `paddingStart` not `paddingLeft`
- `paddingEnd` not `paddingRight`
- `marginStart` not `marginLeft`
- `marginEnd` not `marginRight`
### 4. Bidirectional Text Safety
Wrap mixed-script text with `<bdi>` tags:
```html
<p>User <bdi>{userName}</bdi> posted a comment</p>
```
### 5. Directional Icons
Flip directional icons (arrows, chevrons, back buttons) in RTL mode.
Non-directional icons (home, settings, search) should NOT be flipped.
### 6. Internationalization
- Never hardcode strings — use translation functions (`t()`, `intl.formatMessage()`)
- Use `Intl.NumberFormat` for numbers and currency
- Use `Intl.DateTimeFormat` for dates
- Set `dir="auto"` or `dir="rtl"` on root elements
### 7. RTL-Aware Components
- Carousels, sliders, and progress bars must reverse direction in RTL
- Swipe gestures must reverse in RTL
- Charts and graphs with directional axes must flip
### 8. Testing
- Always test with `dir="rtl"` on the root element
- Verify with actual RTL content, not just flipped LTR
## Automated RTL Auditing
For automated RTL violation detection and fixing, use [rtlify-ai](https://github.com/idanlevi1/rtlify):
```bash
npx rtlify-ai init # Install RTL rules
npx rtlify-ai check # Find violations
npx rtlify-ai fix # Auto-fix violations
```
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules