(This patch applies to CK Forms 1.3.2 build 3)
We simply have to modify the CK Forms template. So, edit components/com_ckforms/views/ckforms/tmpl/default.php. After line 190 add this line:
- Code: Select all
<script type="text/javascript" src="<?php echo JURI::root(true).'/components/com_ckforms/js/ui/ui.datepicker-'.$_GET['lang'].'.js'; ?>"></script>
Then in line 195 replace
- Code: Select all
"en"
- Code: Select all
"<?php echo $_GET['lang']; ?>"
So the resulting code (and some of its surrounding code) should look like this:
- Code: Select all
<input type="text" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired ckCSSinputnormal <?php if ($field->custominfo != "") {echo "ckCSSTip";} else {echo "ckCSSnoTip";} ?> <?php echo $field->fieldCSSclass; ?>" maxlength="<?php echo $field->t_maxchar; ?>" <?php if ($field->readonly == "1") {echo ' readonly="true"';} ?> />
<?php
break;
case 'date':
?>
<script type="text/javascript" src="<?php echo JURI::root(true).'/components/com_ckforms/js/ui/ui.datepicker-'.$_GET['lang'].'.js'; ?>"></script>
<script type="text/javascript">
<!--
JNC_jQuery(function() {
JNC_jQuery("#<?php echo $field->name; ?>").datepicker(JNC_jQuery.extend({}, JNC_jQuery.datepicker.regional["<?php echo $_GET['lang']; ?>"], {
dateFormat: "dd/mm/yy",
showOn: "both",
buttonImage: "<?php echo JURI::root(true).'/components/com_ckforms/' ?>img/calendar.gif",
buttonImageOnly: true,
yearRange: '-100:+5',
changeYear: true,
currentText: 'Now'
}));
});
// -->
</script>
Now you must create/adapt the corresponding translations in components/com_ckforms/js/ui/ui.datepicker-XX.js (where XX stands for the language code, i.e. "en" for english, "es" for spanish, "ca" for catalan, "fr" for french, ...) for every language that your Joomle site supports.
Comment: You can change the first day of the week to monday instead of sunday on each datepicker translation by setting firstDay:1 (instead of the default firstDay:0).
NOTE: If the corresponding ui.datepicker-XX.js does not exist CK Forms will default to the builtin english.