05-31-2020, 08:13 AM | #1 |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
RTL Arabic Text is Brutal
I'm not sure what Category this should be in but I use Sigil. I'm having an issue trying to figure out RTL (Right to Left) text, exclusively Arabic. I'd like to keep this formatting of the content below because if not the only way would be to split it into 3 paragraphs:
1. Chapter number 2. Arabic text 3. English text I was wondering how I'd be able to make just the Arabic text RTL by using CSS or some other means that would work in an epub because no one seems to have covered this exact topic or an exact solution. Code:
<p>2:25<br/> وَبَشِّرِ الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ أَنَّ لَهُمْ جَنَّاتٍ تَجْرِي مِن تَحْتِهَا الْأَنْهَارُ ۖ كُلَّمَا رُزِقُوا مِنْهَا مِن ثَمَرَةٍ رِّزْقًا ۙ قَالُوا هَٰذَا الَّذِي رُزِقْنَا مِن قَبْلُ ۖ وَأُتُوا بِهِ مُتَشَابِهًا ۖ وَلَهُمْ فِيهَا أَزْوَاجٌ مُّطَهَّرَةٌ ۖ وَهُمْ فِيهَا خَالِدُونَ <br/>And give good tidings to those who believe and do righteous deeds that they will have gardens [in Paradise] beneath which rivers flow. Whenever they are provided with a provision of fruit therefrom, they will say, "This is what we were provided with before." And it is given to them in likeness. And they will have therein purified spouses, and they will abide therein eternally.</p> |
05-31-2020, 11:00 AM | #2 |
Sigil Developer
Posts: 7,763
Karma: 5446592
Join Date: Nov 2009
Device: many
|
Have you tried simply adding the dir="rtl" on either the p tag or wrap the rtl text in a span and add the dir="rtl" on the span?
|
05-31-2020, 12:07 PM | #3 | |
Grand Sorcerer
Posts: 5,612
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Since you can't assign dir="rtl" attributes to control the alignment inline tags such as <span>, you'll have to use <p> tags (or other block level tags). For example: Code:
<h3>2:25</h3> <p dir="rtl">وَبَشِّرِ الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ أَنَّ لَهُمْ جَنَّاتٍ تَجْرِي مِن تَحْتِهَا الْأَنْهَارُ ۖ كُلَّمَا رُزِقُوا مِنْهَا مِن ثَمَرَةٍ رِّزْقًا ۙ قَالُوا هَٰذَا الَّذِي رُزِقْنَا مِن قَبْلُ ۖ وَأُتُوا بِهِ مُتَشَابِهًا ۖ وَلَهُمْ فِيهَا أَزْوَاجٌ مُّطَهَّرَةٌ ۖ وَهُمْ فِيهَا خَالِدُونَ</p> <p>And give good tidings to those who believe and do righteous deeds that they will have gardens [in Paradise] beneath which rivers flow. Whenever they are provided with a provision of fruit therefrom, they will say, "This is what we were provided with before." And it is given to them in likeness. And they will have therein purified spouses, and they will abide therein eternally.</p> Note also that very few epub3 readers/apps actually support RTL text. (AFAIK, there's isn't a single epub2 app that supports RTL text.) I.e., you might want to create an epub3 book or convert your book to an epub3 book once you're done. Last edited by Doitsu; 05-31-2020 at 01:03 PM. Reason: Deleted claim that span tags can't have dir attributes |
|
05-31-2020, 12:41 PM | #4 |
Sigil Developer
Posts: 7,763
Karma: 5446592
Join Date: Nov 2009
Device: many
|
According to W3c you can use a dir attribute on a span in html5.
See here: https://www.w3.org/TR/WCAG20-TECHS/H56.html Does this not work in epub3? |
05-31-2020, 01:04 PM | #5 | |
Grand Sorcerer
Posts: 5,612
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
<p><span style="text-align: right;" dir="rtl">وَبَشِّرِ الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ أَنَّ لَهُمْ جَنَّاتٍ تَجْرِي مِن تَحْتِهَا الْأَنْهَارُ ۖ كُلَّمَا رُزِقُوا مِنْهَا مِن ثَمَرَةٍ رِّزْقًا ۙ قَالُوا هَٰذَا الَّذِي رُزِقْنَا مِن قَبْلُ ۖ وَأُتُوا بِهِ مُتَشَابِهًا ۖ وَلَهُمْ فِيهَا أَزْوَاجٌ مُّطَهَّرَةٌ ۖ وَهُمْ فِيهَا خَالِدُونَ</span><br/> And give good tidings to those who believe and do righteous deeds that they will have gardens [in Paradise] eath which rivers flow. Whenever they are provided with a provision of fruit therefrom, they will say, "This is what we were provided with before." And it is given to them in likeness. And they will have therein purified spouses, and they will abide therein eternally.</p> |
|
05-31-2020, 03:39 PM | #6 |
Sigil Developer
Posts: 7,763
Karma: 5446592
Join Date: Nov 2009
Device: many
|
Good to know. Thanks for the explanation.
|
06-01-2020, 11:55 AM | #7 | |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Quote:
|
|
06-01-2020, 12:28 PM | #8 | |
Enthusiast
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
Quote:
Lithium and Moon+ Reader seem to do epub3 RTL fine. I don't have an iOS anything so I'm not that sure. It does suck that you have to do it with individual paragraphs but it does look far better. |
|
06-01-2020, 03:43 PM | #9 | |
Grand Sorcerer
Posts: 5,612
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
|
|
Tags |
arabic, css, epub, rtl |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
KOBO Aura H2O supports RTL (Arabic)? | RTL | Kobo Reader | 5 | 07-25-2015 11:12 AM |
RTL (Arabic/Hebrew) support? | Doitsu | PocketBook | 16 | 06-07-2015 04:08 PM |
Problems with RTL texts (Arabic, Hebrew) | Doitsu | Kindle Formats | 9 | 07-11-2012 09:26 PM |
Arabic and RTL Language support | mdmuddin | iRiver Story | 10 | 01-19-2012 07:51 PM |
Android eReader with Hebrew or Arabic (RTL) support? | tobassam | Which one should I buy? | 0 | 11-16-2010 05:05 AM |