有没有办法检测当前输入语言设置? [英] Is there a way to detect what the input language setting is currently?

查看:77
本文介绍了有没有办法检测当前输入语言设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上想知道系统的输入语言目前在哪里(对于设置了多种语言输入方法的用户)。这将确定< textarea> 的文本方向是否应该是 rtl 或不是。

I basically want to know what the system's input language is currently on (for users who have multiple language input methods set up). This will determine whether if the text-direction of a <textarea> should be rtl or not.

请记住,此设置可能会在页面加载后发生变化。

Please keep in mind that this setting can change after the page is loaded.

有没有简单的方法在JavaScript / jQuery中?

Is there a simple way of doing it in JavaScript/jQuery?

推荐答案

浏览器有 no 布局(输入语言)是。正如@kirilloid提到的,一种可能的解决方法是检查 keyup 上的键码并确定语言。

There is no way for the browser to tell what the current keyboard layout (input language) is. As @kirilloid mentioned, one possible workaround is to check the keycode on keyup and determine the language from that.

这篇关于有没有办法检测当前输入语言设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆