1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<!-- ############################################################################# -->
<!-- Localization
<!-- ############################################################################# -->
<div id="tp-localization">
<h2>Working with Localizations</h2>
<p>Timepicker comes with many translations and localizations, thanks to all the contributors. They can be found in the i18n folder in the git repo.</p>
<p>The quick and cheap way to use localizations is to pass in options to a timepicker instance:</p>
<pre>$('#example123').timepicker({
timeOnlyTitle: 'Выберите время',
timeText: 'Время',
hourText: 'Часы',
minuteText: 'Минуты',
secondText: 'Секунды',
currentText: 'Сейчас',
closeText: 'Закрыть'
});
</pre>
<p>However, if you plan to use timepicker extensively you will need to include (build your own) localization. It is simply assigning those same variables to an object.</p>
<p>As you see in the example below we maintain a separate object for timepicker. This way we aren't bound to any future changes within datepicker.</p>
<pre>$.datepicker.regional['ru'] = {
closeText: 'Закрыть',
prevText: '<Пред',
nextText: 'След>',
currentText: 'Сегодня',
monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
'Июл','Авг','Сен','Окт','Ноя','Дек'],
dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
weekHeader: 'Не',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['ru']);
$.timepicker.regional['ru'] = {
timeOnlyTitle: 'Выберите время',
timeText: 'Время',
hourText: 'Часы',
minuteText: 'Минуты',
secondText: 'Секунды',
millisecText: 'Миллисекунды',
timezoneText: 'Часовой пояс',
currentText: 'Сейчас',
closeText: 'Закрыть',
timeFormat: 'HH:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
};
$.timepicker.setDefaults($.timepicker.regional['ru']);
</pre>
<p>Now all you have to do is call timepicker and the Russian localization is used. Generally you only need to include the localization file, it will setDefaults() for you.</p>
<p>As of version 1.4.5 a combined file of all localizations available is included. This file DOES NOT call setDefaults(), so you will need to pass, or merge with your options.</p>
<pre>$('#example123').timepicker($.timepicker.regional['ru']);
</pre>
<p>Localization files for datepicker are typically available in your jQueryUI downloads.</p>
</div>
|