AngularJS/Angular-ui-bootstrap 改变 datePicker 使用的语言 [英] AngularJS/Angular-ui-bootstrap Changing language used by the datePicker

查看:25
本文介绍了AngularJS/Angular-ui-bootstrap 改变 datePicker 使用的语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此处记录的 datePicker.

I use the datePicker documented here.

但是,没有直接选项允许更改语言,默认为英语.

However, no direct option allows to change the language, English by default.

我找到了一个没有提供 angular 指令的小部件的文档,它提供了一个很好的方法来实现它:

I find a the documentation of the widget provided without angular directive, and it provides a nice way to achieve it:

http://bootstrap-datepicker.readthedocs.org/en/latest/i18n.html

有没有一种简单的方法,避免调整原始指令的源代码,来改变它?

Is there an easy way, avoiding to tweak the original directive's source code, to change it?

推荐答案

如果您使用 DatePicker 表单 angular-ui,只需在页面标题中添加本地化的 js 文件.一个例子是:

If you are using the DatePicker form angular-ui simply add the localized js file in the header of your page. An example would be :

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<script src="http://code.angularjs.org/1.0.8/i18n/angular-locale_fr-fr.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>

您可以在此处

这篇关于AngularJS/Angular-ui-bootstrap 改变 datePicker 使用的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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