Make WordPress Core

Opened 17 years ago

Last modified 2 years ago

#6425 assigned enhancement

Support for RTL in feeds

Reported by: ranyanivhartstein's profile RanYanivHartstein Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Feeds Keywords: needs-refresh close
Focuses: rtl Cc:

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

Download all attachments as: .zip

Change History (20)

@RanYanivHartstein
17 years ago

Patch to enforce RTL in feed templates

#1 @RanYanivHartstein
17 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)

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

@RanYanivHartstein
17 years ago

Better patch for setting directionality in feeds

#2 @matt
16 years ago

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

#3 @Denis-de-Bernardy
16 years ago

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

#4 @ramiy
15 years ago

  • Cc ramiy added

#5 @nbachiyski
15 years ago

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

#6 @tomer
15 years ago

  • Cc tomer added

#7 @ramiy
14 years ago

you can replace:

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

with:

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

#8 @nacin
13 years ago

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

#9 in reply to: ↑ description @nacin
13 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.

#10 @nacin
13 years ago

  • Keywords rtl-feedback added

#11 @nacin
13 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.

#12 @ocean90
11 years ago

  • Cc yoavf rasheed added

@RTL guys, is this safe to close?

#13 @nbachiyski
11 years ago

  • Owner nbachiyski deleted

#14 @nacin
11 years ago

  • Component changed from I18N to Feeds
  • Focuses rtl added

#15 @nacin
11 years ago

  • Keywords rtl-feedback removed

#16 @SergeyBiryukov
11 years ago

#27172 was marked as a duplicate.

#17 @stevenkword
10 years ago

  • Keywords needs-refresh added; close removed

Patch no longer applies cleanly and Feedly does not appear to be parsing language or RTL characters.

Do we want to continue to pursue this ticket? If so, the patch needs an update and we should aggregate a list of feed readers that support this functionality.

#18 @Mte90
2 years ago

  • Keywords close added

It isn't clear if today is still a problem.
There is an old plugin with 30+ with the latest release 8 years ago https://wordpress.org/plugins/rtl-rss-feed-fixer/ that implement the same thing proposed in the ticket, adding the text direction value and some CSS for that with HTML parsing to any paragraph.
The code it is also on github https://github.com/barzik/rtl-feed-fixer but updated since 2015.

Maybe we can ask the WordPress communities with RTL languages to understand is still a real problem?

Note: See TracTickets for help on using tickets.