简体   繁体   English

获取非英语的用户输入

[英]Get user input in other than English language

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...我正在使用 PHP(Yii 框架)...以下是 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;
}

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.关于文本框中的文本,您唯一可以更改的是颜色、位置、大小以及使用 javascript 的 funk 想法。

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.我唯一的建议是打开一个字符映射表并有选择地一个一个地选择字形,从而构建预期的字符串……有点麻烦。

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:) Edit2:另一个例子,将 .js 文件复制到您的项目并将其用于您的文本输入应该很容易:)

Edit3: http://allanguages.info/#layouts= is the webpage of the js library used for virtual keyboard, easy to use and good documentation:D Edit3: http ://alllanguages.info/#layouts= 是用于虚拟键盘的 js 库的网页,易于使用和良好的文档:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM