有没有办法本地化输入类型=“日期”在HTML5中 [英] Is there a way to localize input type="date" in HTML5

查看:110
本文介绍了有没有办法本地化输入类型=“日期”在HTML5中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在撰写本文时,Opera只支持一个浏览器界面

I know that at the time of this writing only Opera supports a browser UI for

<input type="date" name="mydate">

也许我试图本地化这个领域已经遇到了沮丧,因为像本地化这样的好处还没有包含在它们的实现中,但是我甚至没有在HTML5规范中提到它。有没有办法定位本地化?我应该在父元素上做lang =fr吗?

and maybe my attempts to localize this field have been met with frustration because niceties like localization have not yet been included in their implementation, but I don't even see mention of it in the HTML5 spec. Is there a way that localization should be specified? Should I do lang="fr" on a parent element?

有关该网站实施的一些注意事项:

Some notes on the implementation of the site in question:


  • 本地化(语言)由用户明确挑选,因为他们正在管理多种语言的数据,并且不太期望用户的浏览器chrome是使用正在查看的语言,浏览器正在提供所需的语言请求标头。

  • 我想确保如果该页面以法语呈现,则浏览器chrome提供的日期选择器会显示对法语有意义的选项。 / li>
  • 计划是回到不支持type =date的浏览器的jQueryUI,我将使用潜入HTML 5

  • Localization (language) is explicitly picked by the user because they are managing data in multiple languages and it is not reasonable to expect that the user's browser chrome is in the language being viewed or that the browser is providing desired language request headers.
  • I want to be sure that if the page is rendered in French that the date picker provided by browser chrome shows options that make sense for French language.
  • The plan is to fall back to jQueryUI for browsers that do not support type="date", I will use the detection mechanism provided in Dive into HTML 5

推荐答案

从我所知道的,我们在Opera中做的事情(充分披露:我为他们工作)背后的思考是日期选择器几乎是chrome的扩展,一个浏览器本机控件。因此,它将根据浏览器的语言进行本地化,而不是正在查看的页面的语言。

From what i know, the thinking behind what we do in Opera (full disclosure: I work for them) is that the date picker is almost an extension of the chrome, a browser-native control. As such, it will be localised according to the language of the browser, rather than the language of the page being viewed.

这篇关于有没有办法本地化输入类型=“日期”在HTML5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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