• Resolved MrConn

    (@mrconn)


    Hi,
    When I use ‘j. F Y.’-date format the months are in English.
    Everything else is translated, but not the months.

    Iv’e changed Interface language and wordpress-locale, but no luck.
    I cant find some place to translate months in PO-files either…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hi mrconn,

    Thank you for your interest in wpDataTables.

    Yes, we are using the date function for formating those date values.
    What you can do is to use filter wpdatatables_filter_date_cell where you will format those months with function date_i18n like this

    /*
     * This filter is applied to the value of a date cell before it is returned to the front-end
     *
     * $formattedValue is the value of the cell.
     *
     * $tableId is the table identifier from the MySQL table (wp_wpdatatables).
    */
    function filter_date_values($dateValue, $tableID ) {
        // Like this it will filter all date columns in all tables
        // if you need for specific table you can use condition like
        // if ($tableID == 1) {
        //     if ($dateValue != ''){
        //        $timestamp = strtotime(str_replace('/', '-', $dateValue));
        //        $dateValue = date_i18n(get_option('wdtDateFormat'), $timestamp);
        //     }
        // }
        // instead of this
        if ($dateValue != ''){
            $timestamp = strtotime(str_replace('/', '-', $dateValue));
            $dateValue = date_i18n(get_option('wdtDateFormat'), $timestamp);
        }
    
        return $dateValue;
    }
    add_filter('wpdatatables_filter_date_cell', 'filter_date_values',10,2);

    This code you will insert in functions.php of your theme or child theme.

    Best regards.

    Thread Starter MrConn

    (@mrconn)

    Thanks! ??

    Plugin Author wpDataTables

    (@wpdatatables)

    Hi mrconn,

    You are welcome.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Months not translated’ is closed to new replies.