• Edwin Siebel

    (@edwin-at-studiojoyocom)


    In the files: date.php, datetime.php & time.php, located ./inc/fields, a check is done to include the i18n file of either time or date.

    // Load localized scripts
    $locale = str_replace( '_', '-', get_locale() );
    $file_path = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . $locale . '.js';

    However, the get_locale() function retrieves the either the WPLANG or sets it to en_US. So, if, in our case, we use nl_NL, $locale would become nl-NL, and the file to include would become: jqueryui/datepicker-i18n/jquery.ui.datepicker-nl-NL.js.
    Unfortunately, in the ./js/jqueryui/datepicker-i18n/ and /timepicker-i18n/ folder, a lot (but not all) files are coded as e.g. ‘jquery.ui.datepicker-nl.js’. And thus, would the internalization not function properly.

    A solution would be renaming the files to ‘jquery.ui.datepicker-nl-NL.js’. There are files which are already renamed like that: e.g. ‘jquery-ui-timepicker-pt-BR.js’.

    Besides, jquery.ui.datepicket-nl.js is the only file with still uses an object-like notation, instead of an array-like notation. A patch:

    Index: htdocs/wp-content/plugins/meta-box/js/jqueryui/datepicker-i18n/jquery.ui.datepicker-nl.js
    ===================================================================
    --- htdocs/wp-content/plugins/meta-box/js/jqueryui/datepicker-i18n/jquery.ui.datepicker-nl.js	(revision 851182)
    +++ htdocs/wp-content/plugins/meta-box/js/jqueryui/datepicker-i18n/jquery.ui.datepicker-nl.js	(working copy)
    @@ -1,7 +1,7 @@
     /* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
     /* Written by Mathias Bynens <http://mathiasbynens.be/> */
     jQuery(function($){
    -	$.datepicker.regional.nl = {
    +	$.datepicker.regional['nl'] = {
     		closeText: 'Sluiten',
     		prevText: '←',
    		nextText: '→',
    @@ -19,5 +19,5 @@
     		isRTL: false,
     		showMonthAfterYear: false,
     		yearSuffix: ''};
    -	$.datepicker.setDefaults($.datepicker.regional.nl);
    +	$.datepicker.setDefaults($.datepicker.regional['nl']);
     });

    https://ww.wp.xz.cn/plugins/meta-box/

The topic ‘Internalization timepicker & datepicker inconsequent’ is closed to new replies.