S
S
Svetlana Galenko2020-11-27 13:52:29
JavaScript
Svetlana Galenko, 2020-11-27 13:52:29

How to translate dataTables.js plugin phrases in yii2 via i18n?

Hello, how to translate dataTables.js plugin phrases in yii2 via i18n?

The translation was made only from English into Russian, but I still need to do it for a multilingual site, from Russian to another using the i18n construction . So I translated only from English. in Russian:<?= Yii::t('app', 'Перевод') ?>

$(document).ready(function() {
    $('#example').DataTable( {
        "language": {
            "lengthMenu": "Отображать _MENU_ записей на странице",
            "zeroRecords": "Извините, ничего не найдено",
            "info": "Показана страница _PAGE_ из _PAGES_",
            "infoEmpty": "Нет доступных записей",
            "infoFiltered": "(отфильтровано из _MAX_ общих записей)",
            "search": "Поиск",
            "oPaginate": {
                "sFirst":    "Первая",
                "sLast":    "Самая последняя",
                "sNext":    "Следующая",
                "sPrevious": "Предыдущая"
            },
        },
        "fnCreatedRow": function (row, data, index) {
            $('td', row).eq(0).html(index + 1);
        }
    } );
} );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question