Android Question Detect English from Persian or Arabic [SOLVED]

marab

Member
Licensed User
Longtime User
Hi guys
i have an edittext box that my users only using 2 languages(English and Persian)
the English is Left2Right And Persian is Right2Left
now i want to detect language of typed text in the edit textbox and after that change the gravity?
can i do it?
how?!
Thanks for reading...
 

ivan.tellez

Active Member
Licensed User
Longtime User
Change the Gravity while the user is typing its not a very good idea.

Could be frustrating to the user. Its better if you ask them what languaje they preffer before starting to use the app. As simple as a MsgBox.
 
Upvote 0

marab

Member
Licensed User
Longtime User
but i need it in a dictionary and i should detect language for viewing translates better because some of them are english and some of them is persian!
 
Upvote 0

marab

Member
Licensed User
Longtime User
OK now i found way of this by myself!
and i want to share my idea!
my solution:
you know the english have big and small letters like A and a
but persian and arabic have not big and small ع and ع
:D
now we have simple way
code:
B4X:
    Dim word As String 'word that we want to detect
    If word.ToLowerCase =word.ToUpperCase Then
    'Its Persian or Arabic
    Else
    'Its English
    End If
i hope it be usefull for persian and arabic and people that their language havent big and small letters!!
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks for sharing..
Are you going to do this for each word in a string? how about a mixed language in one document?

BTW: Persian and Arabic have 4 عs: "ع" - "عـ" - "ـعـ" - "ـع" .. cheers!
 
Last edited:
Upvote 0

marab

Member
Licensed User
Longtime User
Thanks for sharing..
Are you going to do this for each word in a string? how about a mixed language in one document?

BTW: Persian and Arabic have 4 عs: "ع" - "عـ" - "ـعـ" - "ـع" .. cheers!
hi those 4 letters are not big and small
persian fonts are smart and when 2letters are near togheter they will be blended like:
عععع
And there is no diffrence between their characters!
Yeah you can use this for each word of an string!
For mixed languagr texts u can check each word in a seprated do!
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
hi those 4 letters are not big and small
persian fonts are smart and when 2letters are near togheter they will be blended like:
عععع
And there is no diffrence between their characters!
Yeah you can use this for each word of an string!
For mixed languagr texts u can check each word in a seprated do!

The smart is MS Word that recognizes the position of the letter in the word and draws it accordingly (adaptive)
In handwriting in Arabic and Persian it is a matter of writing rules, not smartness.
Arabic, Persian and Urdu all three languages write the letters like ععع
 
Upvote 0

marab

Member
Licensed User
Longtime User
The smart is MS Word that recognizes the position of the letter in the word and draws it accordingly (adaptive)
In handwriting in Arabic and Persian it is a matter of writing rules, not smartness.
Arabic, Persian and Urdu all three languages write the letters like ععع
Offcurce ! I am persian! And i'm living in iran!
It is a rule in the handwriting and in the camputer operation system will blend The persian strings!
so there is a difference between persian and english i called it smartness!
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
I don't know what you are talking about.. English also have the same.. discrete and scripting.. r r r and R R R, this is discrete letters like ع ع ع.. and they also have
the same letter connected together and hand writing or computer script.. example Brush Script MT.. and the editor is smart it can recognize when to hook the
letter to the next one.. for example it detects it is (if both connectable and no space between them) ....etc. MS Word is so smart that can perform reverse processing
depending on current situation.. for example if you are writing in Arabic or Urdu or Persian and the last letter is عـ it will print it عـ but if this is the last letter in the word
and you made a space then MS Word will know this was the last later and should be written differently and goes back and change it to ـع - completely transparent to you.
This is the smartness.. but the letters shape themselves are language rules and not smartness.. and all, Arabic, English, Persian and Urdo are the same in having different shapes for a single letter.
 
Upvote 0

marab

Member
Licensed User
Longtime User
I don't know what you are talking about.. English also have the same.. discrete and scripting.. r r r and R R R, this is discrete letters like ع ع ع.. and they also have
the same letter connected together and hand writing or computer script.. example Brush Script MT.. and the editor is smart it can recognize when to hook the
letter to the next one.. for example it detects it is (if both connectable and no space between them) ....etc. MS Word is so smart that can perform reverse processing
depending on current situation.. for example if you are writing in Arabic or Urdu or Persian and the last letter is عـ it will print it عـ but if this is the last letter in the word
and you made a space then MS Word will know this was the last later and should be written differently and goes back and change it to ع - completely transparent to you.
This is the smartness.. but the letters shape themselves are language rules and not smartness.. and all, Arabic, English, Persian and Urdo are the same in having different shapes for a single letter.
I agree with you! The shapes are different but the characters are not different!
ععععع
For example above word has 3 different shapes of ع but character of those are same!
So in the programing you can detect them with their character and my way(big and small letters...) is using this feature....
 
Upvote 0
Top