0
我正在開發Web服務。但我不知道如何使用Angularjs設置bs-datepicker的語言。這是英文版,但我想將其更改爲'kr'。我該怎麼辦?如何更改bs-datepicker的語言
<input type="text" class="form-control
text-center"data-date-format="yyyy-MM-dd" bs-datepicker>
我正在開發Web服務。但我不知道如何使用Angularjs設置bs-datepicker的語言。這是英文版,但我想將其更改爲'kr'。我該怎麼辦?如何更改bs-datepicker的語言
<input type="text" class="form-control
text-center"data-date-format="yyyy-MM-dd" bs-datepicker>
而且@Matheno評論,你可以通過創建 「語言」 對象做到這一點。
喜歡的東西:
$.fn.datepicker.dates['en'] = {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
today: "Today",
clear: "Clear",
format: "mm/dd/yyyy",
titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
weekStart: 0
};
具體,爲kr
您可以使用下面的腳本。
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/locales/bootstrap-datepicker.kr.min.js
$('.datepicker').datepicker({
language: 'kr'
});
角
對於具體指令bs-datepicker
您可以添加在.config
節這個選項。
像這樣:
angular.module('myApp')
.config(function($datepickerProvider) {
angular.extend($datepickerProvider.defaults, {
language: 'kr'
});
})
這是所有在[文檔]解釋(http://bootstrap-datepicker.readthedocs.org/en/latest/i18n.html) – Matheno