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

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

问题描述

我知道在撰写本文时只有 Opera 支持浏览器 UI

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 提供的日期选择器会显示对法语有意义的选项.
  • 计划是为不支持 type="date" 的浏览器回退到 jQueryUI,我将使用 深入 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天全站免登陆