Hey Guys,
What text format do you need to use in HTML to properly display right to left text based languages like arabic and hebrew?
i copy and pasted arabic text from One hour translation and try and copy and paste it into Sublime or my HTML editor and it becomes unreadable and disjointed....
This is what i use and it works fine. Not sure it makes everything 100% correct but it converts fine so fuck it!
In your landing page, change <body> to <body dir="rtl">
leave </body> as normal
Thats it!
i should have clarified, im doing this in a javascript popup type landing page.... So, the whole page is just a JS pop... I've been trying to figure this out for 2 hrs now...
Im using utf- 8
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
i changed the <body dir="rtl">
still the writing is disjointed...
Any more ideas?
Here you go
<script>
function init() {
alert(('arabic text line 1' +
'arabic text line 2')) ;
window.location.href='http://meatspin.com';
}
window.onload = init;
</script>
thanks,
but this doesnt do anything different
i was already doing this
<script type="text/javascript">
alert("<?php echo $p1; ?> \n\n<?php echo $p2; ?>\n\n");
window.location="blah.com";
</script>
In addition to the rtl CSS, we also used this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ar">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Here is my entire page
<?php
switch(x){
default:
$headline = "\u20ﺪﺪﻳﻭﺭﺪﻧﻷا ﻡﺎﻈﻧ ﻦﻣ ﺔﻟﺎﺳﺭ ﺔ";
$p1 = "!ﺔﺤﻴﺤﺻ ﺔﻘﻳﺮﻄﺑ ﺔﻳﺭﺎﻄﺒﻟا ﻦﺤﺷ ﻢﺘﻳ ﻻ ***ﺮﻳﺬﺤﺗ***";
$p2="!ﺎﻬﺑ ﺢﺼﻨﻳ ﻲﺘﻟا ﺪﻳﻭﺭﺪﻧﻷا ﺓﺰﻬﺟﺃ ﺕﺎﻳﺭﺎﻄﺑ ﺔﻳﺎﻤﺣ ﺕﺎﻘﻴﺒﻄﺗ ﺙﺪﺣﺃ ﻞﻳﺰﻨﺘﺑ ﻢﻗﻭ 'ﻖﻓاﻮﻣ'' ﻂﻐﺿا ،ﻒﻠﺘﻠﻟ ﺔﻳﺭﺎﻄﺒﻟا ﺽﺮﻌﺗ ﺐﻨﺠﺘﻟ ";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body dir="rtl">
<script type="text/javascript">
//alert("<?php echo $headline; ?>");
alert("<?php echo $p1; ?> \n\n<?php echo $p2; ?>\n\n");
window.location="http://blah.com";
</script>
</body>
</html>
Even posting the arabic here doesnt work...
I found this old post from 2006
http://www.webdeveloper.com/forum/sh...ript-alert-box
it talks about \u202b but i cant figure out how to use that...
I just pasted:
https://www.dropbox.com/s/9ns9wizhi7...2010.26.53.png
and checked in the browser:
https://www.dropbox.com/s/infw1sjak9...2010.26.34.png
Should it look different than that?
yeah, what is showing in the pop is the 2nd and 3rd line
look at your 2nd and 3rd lines of arabic txt in the first screenshot and then look at the 2nd screenshot...
pay attention to the ***wording*** in the first screenshot the wording is on the right, in the second its on the left...\
in sublime its correct in the pop its not..
you want it like this?
https://www.dropbox.com/s/z2aql20dhz...2010.42.12.png
haha, no, its not about moving the individual text around...
Its gotta be written exactly like the first screenshot in sublime otherwise its just jumbled letters...
hmmm I'm not sure... when OHT did ours, they did it in left to right, and we copied and pasted it exactly into our page... and then added the dir="rtl"
So I'd ask the translator to post it how it would be written in left to right, and do that.
i speak arabic, so i know what its supposed to look like...
The translation is fine. Its getting it to display properly in HTML thats a bitch...
Try applying dir="rtl" to the html tag, not the body tag.
In some browsers this will alter the UI substantially.
A better solution would be moving to an HTML dialog/jQuery pop instead of alert(), which is less browser/locale dependent.
What worked for us is how I mentioned above... Other than that tho I have no idea