multi language problem..

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
pba
Forum Newbie
Posts: 2
Joined: Mon May 24, 2010 11:40 pm

multi language problem..

Post by pba »

what i need is to use 2 different char set in a form..

some fields in the form r needed to be filled in nepali language and some in english. i am using utf-8, cakephp.

previously i was using
textarea {font-family:nepali} in css. now i want to migrate to utf-8..
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: multi language problem..

Post by Apollo »

pba wrote:2 different char set in a form..
No can do. Just use UTF-8, it contains both English and Nepali characters (and any other language for that matter, including Klingon).

Include the [text]<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>[/text] header in yout HTML and you should be fine.
pba
Forum Newbie
Posts: 2
Joined: Mon May 24, 2010 11:40 pm

Re: multi language problem..

Post by pba »

thanks Applo...but my problem is.. i need to restrict users to input in a particular language. at present users can input in any language as their wish.

example:- a input field meant to be filled in nepali language can be filled in nepali or any other language.
what i need:- a input field meant to be filled in nepali can not be filled in any other language....
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: multi language problem..

Post by Apollo »

How would you detect if some text is in a particular language or not?
For example, wluod you cnsoider tihs a viald Elginsh secnente?

You could take the entered text apart character by character, and for each character verify if they're in the language's unicode range. This might work for languages that use characers unique for that language alone (such as Klingon, and Nepali too I guess, although I dunno of there exist some Birmese or Bhutanese dialect or native language of inner Mongolia which uses the same character set). Won't work for languages sharing the same alphabet, such as most western languages.
Another possibility would be dictionary heuristics, which seem quite an overkill for a simple restriction like this.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: multi language problem..

Post by Weirdan »

Apollo wrote:This might work for languages that use characers unique for that language alone (such as Klingon, and Nepali too I guess, although I dunno of there exist some Birmese or Bhutanese dialect or native language of inner Mongolia which uses the same character set).
Nepali is usually written in Devanagari, which is also used for other Indic languages.
Post Reply