diff --git a/pom.xml b/pom.xml
index 3e9168bc..d4e7ee6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,6 +250,11 @@
juniversalchardet
1.0.3
+
+ com.google.gwt
+ gwt-servlet
+ 2.4.0
+
com.google.oauth-client
diff --git a/src/main/java/com/commafeed/backend/feeds/FeedUtils.java b/src/main/java/com/commafeed/backend/feeds/FeedUtils.java
index dd9a10fd..23f23bc3 100644
--- a/src/main/java/com/commafeed/backend/feeds/FeedUtils.java
+++ b/src/main/java/com/commafeed/backend/feeds/FeedUtils.java
@@ -24,6 +24,8 @@ import org.slf4j.LoggerFactory;
import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry;
import com.google.api.client.util.Lists;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+import com.google.gwt.i18n.shared.BidiUtils;
public class FeedUtils {
@@ -120,6 +122,12 @@ public class FeedUtils {
return found;
}
+ public static boolean isRTL(FeedEntry entry) {
+ String content = entry.getContent().getContent();
+ Direction direction = BidiUtils.get().estimateDirection(content, true);
+ return direction == Direction.RTL;
+ }
+
public static String trimInvalidXmlCharacters(String xml) {
if (StringUtils.isBlank(xml)) {
return null;
diff --git a/src/main/java/com/commafeed/frontend/model/Entry.java b/src/main/java/com/commafeed/frontend/model/Entry.java
index 2f2ca2d1..9a5598bf 100644
--- a/src/main/java/com/commafeed/frontend/model/Entry.java
+++ b/src/main/java/com/commafeed/frontend/model/Entry.java
@@ -31,6 +31,7 @@ public class Entry implements Serializable {
entry.setGuid(feedEntry.getGuid());
entry.setTitle(feedEntry.getContent().getTitle());
entry.setContent(feedEntry.getContent().getContent());
+ entry.setRtl(FeedUtils.isRTL(feedEntry));
entry.setAuthor(feedEntry.getAuthor());
entry.setEnclosureUrl(status.getEntry().getContent().getEnclosureUrl());
entry.setEnclosureType(status.getEntry().getContent()
@@ -77,6 +78,9 @@ public class Entry implements Serializable {
@ApiProperty("entry content")
private String content;
+ @ApiProperty("wether entry content and title are rtl")
+ private boolean rtl;
+
@ApiProperty("entry author")
private String author;
@@ -241,4 +245,12 @@ public class Entry implements Serializable {
this.iconUrl = iconUrl;
}
+ public boolean isRtl() {
+ return rtl;
+ }
+
+ public void setRtl(boolean rtl) {
+ this.rtl = rtl;
+ }
+
}
diff --git a/src/main/webapp/sass/generic/_misc.scss b/src/main/webapp/sass/generic/_misc.scss
index ba5cb8f6..47f163c7 100644
--- a/src/main/webapp/sass/generic/_misc.scss
+++ b/src/main/webapp/sass/generic/_misc.scss
@@ -2,6 +2,10 @@
cursor: pointer;
}
+.rtl {
+ direction: rtl;
+}
+
.bs-fb ul {
margin-bottom: 0px;
}
diff --git a/src/main/webapp/templates/feeds.view.html b/src/main/webapp/templates/feeds.view.html
index 506c9b27..7a816615 100644
--- a/src/main/webapp/templates/feeds.view.html
+++ b/src/main/webapp/templates/feeds.view.html
@@ -27,10 +27,11 @@
{{entry.feedName}}
{{entry.date | entryDate}}
-
+
-