Editor: Date-inputs with other language

Editor: Date-inputs with other language

horst_bhorst_b Posts: 1Questions: 0Answers: 0
edited June 2012 in Editor
Hi,
I want to use the Editor-plug-in (BTW: very cool stuff!) to edit tables. One field has to be a date-field. But - as it is for german users - it should start with monday and also has german day- and month-names.

So the question is: How can I manage to have something like this in Editor?

$( "#datepicker" ).datepicker({
rangeSelect: true,
firstDay: 1,
dateFormat: 'dd.mm.yy',
dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']
....

All I found was that it is possible to use dateFormat.

Any ideas on this?
Do I have to use custom field type plug-ins instead of the date field?

Thanks in advance,
Horst

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi Horst,

    Great to hear that you are liking the look of Editor.

    In order to do what you are looking for with the jQuery UI date component you can use that component's ability to set defaults - so you would set your translated strings as defaults just before you initialise Editor. For example:

    [code]
    $.datepicker.setDefaults( {
    dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
    monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']
    } );

    editor = new $.fn.dataTable.Editor( {
    "ajaxUrl": "php/dates.php",
    "domTable": "#example",
    "fields": [ {
    "label": "Registered date:",
    "name": "registered_date",
    "type": "date",
    "dateFormat": "dd.mm.yy"
    }
    ]
    } );
    [/code]

    dateFormat is the only field that has a "shortcut" method of doing this as it is typically the most common variable to change - but the ability to set defaults makes the rest quite possible.

    On the wider topic of internationalisation, how are you finding that to go for you in Editor? All of the text is fully changeable but it isn't directly documented as such. I'm planning on writing a proper i18n tutorial for Editor in the near future. If you have any feedback about i18n for Editor, please do let me know - it is something that I'd like to make sure Editor is particularly strong at!

    Regards,
    Allan
This discussion has been closed.