如何基于输入文本语言自动设置文本方向? [英] How can I automatically set text direction based on input text language?
本文介绍了如何基于输入文本语言自动设置文本方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Google plus(以及许多其他地方),当我要发布内容时,当我以波斯语(即从右到左语言)输入时,文字方向会自动设为 rtl 和 text-alignment:right
,当我开始输入英语时,会自动更改为 ltr 和 text-alignment:left
。我如何有这样的功能?这是HTML5或Javascript的任何东西吗?
In Google plus (and a lot of other places), when I want to post something, when I type it in Persian, which is a right-to-left language, text direction is automatically set to rtl and text-alignment:right
, and when I start to type in English it changes automatically to ltr and text-alignment:left
. How can I have such functionality? Is this anything with HTML5 or Javascript? What clues should I follow?
提前感谢
推荐答案
- 列出左侧语言典型字符的权利
- 随时检测它们(通常的js事件)
或按此链接:
http://www.i18nguy.com/temp/rtl.html
这篇关于如何基于输入文本语言自动设置文本方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文