balazs-endresz / jquery-translate

Automatically exported from code.google.com/p/jquery-translate
5 stars 5 forks source link

Translation into or from a rtl script toggles the style="text-align" CSS property #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Translate into Arabic -- style="text-align: right;"
2. Translate into Hebrew -- style="text-align: left;"
3. Translate into Hebrew again -- style="text-align: right;"
or
1. Translate into Arabic -- style="text-align: right;"
2. Translate into Arabic again -- style="text-align: left;"
3. Translate into English -- style="text-align: right;"

What is the expected output? What do you see instead?
Each time the plugin translates to or from Arabic, Hebrew, or Persian the
style="text-align" property is swapped between right and left.

The style="text-align" property should always be style="text-align: right;"
for Arabic, Hebrew, and Persian.

What version of the product are you using? On what operating system?
1.3.8

Please provide any additional information below.
I'm using the jquery-translate plugin for a WordPress plugin here:
http://wordpress.org/extend/plugins/google-ajax-translation/

You can see the plugin in use here:
http://orrmarshall.com/wp/

Original issue reported on code.google.com by monodist...@gmail.com on 25 Jun 2009 at 8:50

GoogleCodeExporter commented 9 years ago
Hmm...I didn't think about that. It will be fixed today. BTW, it's made that 
way 
because you might have an LTR text with text-align:right so that should be 
swapped too. 

Original comment by balazs.endresz on 25 Jun 2009 at 9:31

GoogleCodeExporter commented 9 years ago
Ah, ok. I see what you mean.

It looks like the current logic is:
to rtl OR from rtl results in swap text-align

So the logic should be something like:
ltr to ltr OR rtl to rtl results in no swap
ltr to rlt OR rtl to ltr results in swap text-align

Original comment by monodist...@gmail.com on 25 Jun 2009 at 10:13

GoogleCodeExporter commented 9 years ago
Exactly! But there's another twist in it because if you use the `fromOriginal` 
option
the source language will be always the same, so the current language must be 
stored
in order to determine if it's ltr or rtl. Now I decided to use $.data for that 
as it
seems to be much faster than $.attr, so the "lang" attribute will be unchanged 
unless
you use the `setLangAttr` option.

Fixed in 1.3.9.

Original comment by balazs.endresz on 25 Jun 2009 at 5:25