Support

Account

Home Forums ACF PRO Time picker localization

Helping

Time picker localization

  • Hi.
    I am using ACF PRO in a custom build plugin (it’s just for 1 client – it’s not going to be public). The plugin is in Slovak language. I was able to localize date picker using following script:

    
    function my_admin_enqueue_scripts() {
    	echo '<script>
    	function extend(destination, source) {
    		for (var property in source)
    			destination[property] = source[property];
    		return destination;
    	}
    
    	// see https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/
    	acf.add_filter(\'date_picker_args\', function( args, $field ){
    		var custom_args = {
    		  minDate:	0,
    		  regional: "sk"
    		};
    		args = extend(args, custom_args)
    		return args;
    	});
    	</script>';
    }
    
    add_action('admin_footer', 'my_admin_enqueue_scripts');
    

    I have tried similar approaches to datetimepicker, but with no luck.

  • I found a solution (kind of) using CSS. It is not very elegant, but it is all I have now:

    .ui_tpicker_time_label,
    .ui-datepicker-current,
    .ui-datepicker-close,
    .ui-datepicker-title{
    	color: transparent !important;
    }
    
    .ui_tpicker_time_label:before{
    	content: "Čas";
    	color: black;
    }
    
    .ui-datepicker-current,
    .ui-datepicker-close{
    	width: 58px !important;
    }
    
    .ui-datepicker-current:before{
    	content: "Teraz";
    	color: black;
    }
    
    .ui-datepicker-close:before{
    	content: "Uložiť";
    	color: black;
    }
    
    .ui-datepicker-title{
    	font-size: 1px;
    	padding-top: 17px;
    }
    
    .ui-datepicker-title:before{
    	content: "Zvoľte čas" !important;
    	color: black !important;
    	font-size: 14px;
    }
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Time picker localization’ is closed to new replies.