Opened 5 years ago

Last modified 16 months ago

#6425 assigned enhancement

Support for RTL in feeds

Reported by: RanYanivHartstein Owned by: nbachiyski
Priority: normal Milestone: Awaiting Review
Component: I18N Version:
Severity: normal Keywords: rtl-feedback close
Cc: ramiy, tomer

Description

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 5 years ago.
Patch to enforce RTL in feed templates
better-rtl-feeds.patch (17.5 KB) - added by RanYanivHartstein 5 years ago.
Better patch for setting directionality in feeds

Download all attachments as: .zip

Change History (13)

Patch to enforce RTL in feed templates

  • 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)

http://www.dontsmile.info/downloads/comment_direction-1.2.zip

Better patch for setting directionality in feeds

comment:2   matt5 years ago

  • Milestone changed from 2.7 to 2.9
  • Owner changed from anonymous to nikolay
  • Keywords needs-patch added; has-patch 2nd-opinion removed
  • Milestone changed from 2.9 to Future Release
  • Cc ramiy added
  • Owner changed from nikolay to nbachiyski
  • Status changed from new to assigned
  • Cc tomer added

you can replace:

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

with:

<?php if ( is_rtl() ) { echo '&#8235;'; } ?>
  • Milestone changed from Future Release to 3.4
  • Type changed from enhancement to task (blessed)

comment:9 in reply to: ↑ description   nacin16 months 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.

  • Keywords rtl-feedback added
  • 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.

Note: See TracTickets for help on using tickets.