Re: How to detect languages from (=> LTR vs RTL)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-02-07 at 09:37 +0100, Michelle Konzack wrote:

> Hi colleges and gurus,
> 
> I coding a whole "web office" and one of my problems is "LTR vs RTL".
> If I have for exanple an E-Mail I use a
> 
>     <div style="direction:$DIRECTION">
>       $SOME_TEXT
>     </div>
> 
> but HOW can I detect the type of $SOME_TEXT  from  within  PHP,  to  set
> $DIRECTION? (RTL or LTR) correctly?
> 
> And how can I do this with mixed Text (by  line  or  entired  paragraph)
> like:
> 
>    german       <- must be LTR
>    persian      <------------------- must be RTL
>    english      <- must be LTR
>    arabic       <------------------- must be RTL
>    french       <- must be LTR
>    jidisch      <------------------- must be RTL
> 
> Ayn Iranian (Moxhtar?), Arabs (Jasin?) or Jews (Dotan?) here  which  can
> help me please?
> 
> Thanks, Greetings and nice Day/Evening
>     Michelle Konzack
> 


If I understand you correctly, you want to detect the language of a
string, or is it a substring within a string?

I'm not sure how easy that would be, given that some shorter sentences
might be common across languages, but I would hazard a guess that they
would also share the direction, so that shouldn't be a major issue.

I don't know of any way to do that, but could you possibly look for
certain characters in the string that would hint at the language? It
wouldn't work too well with mixed-language strings, but it might be
enough for what you want here?

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux