Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#64193 new enhancement

Proposal: Add official support for ltr.css in RTL-based multilingual sites

Reported by: asadister's profile asadister Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch needs-testing needs-dev-note has-unit-tests
Focuses: css, rtl Cc:

Description

WordPress automatically loads rtl.css when the site language is right-to-left (RTL), which is helpful for RTL-based sites. However, in multilingual websites where the base language is RTL and the secondary language is LTR (e.g., English), there is no built-in mechanism to load a dedicated ltr.css file.

This creates a gap in styling support, as developers must manually detect the language and enqueue LTR-specific styles. While this can be solved with a few lines of code, the lack of official support reflects a design bias toward LTR-first sites.

Suggested enhancement:
Introduce a standardized way to load ltr.css when the current language is LTR, especially in RTL-based multilingual sites. This could mirror the rtl.css behavior or be exposed via a filter/hook.

Benefits:

  • Improved developer experience
  • Better styling consistency across languages
  • Greater inclusivity for RTL-first global sites

Change History (5)

This ticket was mentioned in PR #10458 on WordPress/wordpress-develop by @asadister.


5 weeks ago
#1

  • Keywords has-patch added

### Summary
Adds support for loading ltr.css in RTL-based multilingual WordPress sites, mirroring the existing rtl.css behavior.

### Details

  • Introduces wp_style_add_data( $handle, 'ltr', 'replace' ) and 'suffix' modes
  • Uses extra['ltr'] and _css_href() for consistent file resolution
  • Applies style_loader_tag filter for extensibility
  • Ensures compatibility with single-file enqueue behavior in WordPress Core

Trac ticket: https://core.trac.wordpress.org/ticket/64193

#2 @asadister
5 weeks ago

  • Focuses administration multisite coding-standards added
  • Keywords needs-testing needs-dev-note added
  • Version set to trunk

Tested successfully on a fresh install and multiple upgrade paths:
– 4.9.21 → 6.9-Beta3
– 6.8.3 → 6.9-Beta3
– Fresh install with and without wp-config.php
– Single site and multisite (subdirectory and subdomain)

No issues found.
All checks passed.
PR is ready for review. ✅

Props asadister.

#3 @sabernhardt
5 weeks ago

  • Focuses administration template multisite coding-standards removed
  • Keywords rtl ltr multilingual css theme removed
  • Version trunk deleted

This ticket was mentioned in PR #10476 on WordPress/wordpress-develop by @asadister.


5 weeks ago
#4

  • Keywords has-unit-tests added

This PR adds official support for ltr.css files in RTL-based multilingual sites.

It enables WordPress to automatically detect and load an ltr.css file when available,
ensuring proper layout and direction handling for languages with left-to-right text
within otherwise RTL environments.

Includes:

  • Core logic to detect and enqueue LTR variants of stylesheets.
  • Unit tests covering both metadata registration (wp_style_add_data) and HTML output rendering.

Props @asadister.

Trac ticket: https://core.trac.wordpress.org/ticket/64193

@asadister commented on PR #10458:


5 weeks ago
#5

Closing in favor of #10476, which includes updated unit tests and resolves coding standards issues.
Thanks for the initial feedback!

Note: See TracTickets for help on using tickets.