Make WordPress Core

Opened 7 years ago

Last modified 12 months ago

#6425 assigned enhancement

Support for RTL in feeds

Reported by: RanYanivHartstein Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Feeds Keywords: close
Focuses: rtl Cc:


In the current state of most Feed readers, the only surefire way to make RTL content display properly is to have directionality enforced inside the content - that is, either with {{<div dir="rtl">}}} tags inside CDATA or with Unicode directionality characters (for e.g., RLE and PDF, or &#8235; and &#8236;, or U+202B and U+202C.) for excerpts or titles.

While we currently have pretty good support for RTL languages, there is no support for RTL in feeds - all is left up up to the feed reader.

I suggest adding a mechanism to automatically insert these tags/characters for blogs that have text_direction set to RTL - much in the same way RTL css style sheets are loaded for these blogs.

I have attached a patch that modifies the feed templates to insert these tags/characters. Note that there is no checking of blog directionality here - this is just an example of how to enforce RTL in feeds, not how to enforce it conditionally.

This relate to a previous ticket I submitted (#5517), regarding adding an option to set the feed language - which currently just defaults to EN. Certain feed readers know to display RTL text in proper directionality according to feed language (for e.g., feeds that have their feed language set to HE (Hebrew), will get displayed from Right to Left). While setting feed language is not a comprehensive solution, it is a step in the right direction.

Attachments (2)

rtl-feeds.patch (12.4 KB) - added by RanYanivHartstein 7 years ago.
Patch to enforce RTL in feed templates
better-rtl-feeds.patch (17.5 KB) - added by RanYanivHartstein 7 years ago.
Better patch for setting directionality in feeds

Download all attachments as: .zip

Change History (18)

@RanYanivHartstein7 years ago

Patch to enforce RTL in feed templates

comment:1 @RanYanivHartstein7 years ago

  • Keywords has-patch 2nd-opinion added
  • Summary changed from Support for RTL in fees to Support for RTL in feeds

I'm enclosing a better patch to address the feed directionality issue. It adds directionality characters where needed according to the text_direction option.

However. it is not a very efficient approach at solving this problem, and improvements are welcome.

A better approach might be and individual check of the prominent script used in every post, comment and title - directionality can be set according to that script.

For e.g., while many Israeli bloggers write most of their posts in Hebrew or Arabic which are RTL scripts, we should be able to identify the occasional English post or title and set it to LTR.

This is also true for comments - some visitors may be fluent Hebrew or Arabic readers, but are more comfortable commenting in English. Their comments should be displayed properly, from left to right.

Such behavior can be based on work done in Comment Directionality Plugin by Tom Sella (it currently supports only Arabic, English and Hebrew)


@RanYanivHartstein7 years ago

Better patch for setting directionality in feeds

comment:2 @matt6 years ago

  • Milestone changed from 2.7 to 2.9
  • Owner changed from anonymous to nikolay

comment:3 @Denis-de-Bernardy6 years ago

  • Keywords needs-patch added; has-patch 2nd-opinion removed
  • Milestone changed from 2.9 to Future Release

comment:4 @ramiy5 years ago

  • Cc ramiy added

comment:5 @nbachiyski5 years ago

  • Owner changed from nikolay to nbachiyski
  • Status changed from new to assigned

comment:6 @tomer5 years ago

  • Cc tomer added

comment:7 @ramiy4 years ago

you can replace:

<?php if ( get_bloginfo('text_direction') == 'rtl' ) { echo ('&#8235;'); }?>


<?php if ( is_rtl() ) { echo '&#8235;'; } ?>

comment:8 @nacin3 years ago

  • Milestone changed from Future Release to 3.4
  • Type changed from enhancement to task (blessed)

comment:9 in reply to: ↑ description @nacin3 years ago

Replying to RanYanivHartstein:

In the current state of most Feed readers, the only surefire way to make RTL content display properly is to have directionality enforced inside the content...

This ticket was opened four years ago. Can we have an update on the current state of more modern feed readers?

Cursory research suggests that feed readers can/do use the feed language to figure out whether content should be displayed RTL. If this is true, #13440 would fix this.

comment:10 @nacin3 years ago

  • Keywords rtl-feedback added

comment:11 @nacin3 years ago

  • Keywords close added; needs-patch removed
  • Milestone changed from 3.4 to Awaiting Review
  • Type changed from task (blessed) to enhancement

Pulling this off the 3.4 milestone, as I have doubts.

Feedback requested here as well: http://wppolyglots.wordpress.com/2012/02/07/need-some-rtl-feedback-here-http-core-trac/. A comment there indicates what I had learned — that Google and IE readers both detected.

comment:12 @ocean9019 months ago

  • Cc yoavf rasheed added

@RTL guys, is this safe to close?

comment:13 @nbachiyski15 months ago

  • Owner nbachiyski deleted

comment:14 @nacin13 months ago

  • Component changed from I18N to Feeds
  • Focuses rtl added

comment:15 @nacin13 months ago

  • Keywords rtl-feedback removed

comment:16 @SergeyBiryukov12 months ago

#27172 was marked as a duplicate.

Note: See TracTickets for help on using tickets.