Monday, November 29, 2010

JQuery UI datepicker mn mongolia localization

jquery.ui.datepicker-mn.js файлыг ~/scripts/jquery/i18n/ мэт санд байршуулаад

jQuery(function($){
    $.datepicker.regional['mn'] = {
        closeText: 'Хаах',
        prevText: 'Өмнөх',
        nextText: 'Дараах',
        currentText: 'Өнөөдөр',
        monthNames: ['1-р сар','2-р сар','3-р сар','4-р сар','5-р сар','6-р сар',
        '7-р сар','8-р сар','9-р сар','10-р сар','11-р сар','12-р сар'],
        monthNamesShort: ['1 сар', '2 сар', '3 сар', '4 сар', '5 сар', '6 сар',
        '7 сар', '8 сар', '9 сар', '10 сар', '11 сар', '12 сар'],
        dayNames: ['Ням', 'Даваа', 'Мягмар', 'Лхагва', 'Пүрэв', 'Баасан', 'Бямба'],
        dayNamesShort: ['Ням', 'Дав', 'Мяг', 'Лха', 'Пүр', 'Баа', 'Бям'],
        dayNamesMin: ['Ня','Да','Мя','Лх','Пү','Ба','Бя'],
        weekHeader: '7 хоног',
        dateFormat: 'yy.mm.dd',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['mn']);
});

usage

$.datepicker.setDefaults($.datepicker.regional['mn']);
код нь өөрөө хэлний сонголтыг хийж бэлэн болгоно.

simple

<div class="right" style="width:300px;">
                <span class="right-line-items">                   
                    <a href="#" id="date-toggler">Он сар өдөр сонгох</a>
                    <script type="text/javascript">
                        $(function() {
                            $("#date-toggler").click(function(){
                                $("#date-selector").datepicker({
                                    buttonImageOnly: true,
                                    showOtherMonths: true,
                                    selectOtherMonths: true,
                                    showAnim: "slideDown",
                                    changeMonth: true,
                                    changeYear: true,
                                    onSelect:function(){
                                        var dateString = $(this).val();
                                        $(this).datepicker('destroy');
                                        _view(dateString);
                                    },
                                    dateFormat: DEFAULT_DATE_FORMAT//yy.mm.dd
                                });
                                $("#date-selector").css("font-size", "65%")
                                        .css("right", "90px").css("margin-top","26px");
                            });
                        });
                    </script>
                </span>
                <div id="date-selector" style="position:absolute;z-index:1000;"></div>
            </div>

No comments: