1

I have installed fonts of Urdu on server... It is ok for the contents of the website... But there is a problem in getting a user input... it displays English when type in the textbox... So, how will achieve to enable language (Urdu) in textbox...

I am using PHP (Yii framework)... Following is the css...

@font-face {
    font-family: nafees;
    src: url('font/trado.ttf');
}

.urdu{
    font: normal 20pt nafees;
    margin-right: 10px;
    text-align: center;
    direction: rtl;
    unicode-bidi: embed;
}
4
  • Does it works if you copy/paste اردو in your form ?
    – rap-2-h
    Jun 21, 2012 at 10:02
  • @rap-2-h No.. what about typing in...? Jun 21, 2012 at 10:04
  • The only thing you can do, if the user doesn't have an urdu keyboard layout, is transliteration. Convert every latin character to its urdu counterpart.
    – adamors
    Jun 21, 2012 at 10:20
  • @Örs that would be a very tedious job... Jun 21, 2012 at 10:26

3 Answers 3

2

Input to a textbox is defined by the keyboard, not the website. Make sure your keyboard is set to Urdu on your computer, and try again.

The only things you can change about text in a textbox is colour, location, size, as well as funk thinks with javascript.

2
  • then it is not possible to type in Urdu on client side if he/she doesn't have Urdu keyboard installed... there must be some way... Jun 21, 2012 at 10:08
  • 3
    You can't change keyboard layout on the web-side. You have to do this through windows - you don't actually need the urdu keyboard, but you need to change your layout to write in urdu. The only other way you could tackle it is have a massive js script that somehow manages to figure out your current keyboard layout, and then changes the input one by one to urdu - in pseudo: "if user presses a, replace with -"
    – darioml
    Jun 21, 2012 at 10:11
2

What is wrong is your input method, client-side, not your code.

This is an OS-specific setting, that the user must set in order to type in another alphabet (and it's sistem-wide, it does not affect only websites).

If the client has not an Urdu keyboard, as you state in a comment, how is he supposed to type in Urdu characters? My only advice would be to open a Character map and selectively choose the glyphs one-by-one, thereby constructing the intended string... somewhat cumbersome.

2

If the user doesn't have Urde keyboard layout, you can provide two alternative ways to input text in Urdu:

  1. Show a virtual keyboard with Urdu layout.

  2. Use some kind of transliteration service to translate what user inputs to Urdu keyboard layout on the fly.

Edit: here you've an example.

Edit2: another example, it should be easy to copy the .js file to your project and use it for your text inputs :)

Edit3: http://allanguages.info/#layouts= is the webpage of the js library used for virtual keyboard, easy to use and good documentation :D

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.