the language settings for the delete and create windows

the language settings for the delete and create windows

volnistii11volnistii11 Posts: 49Questions: 16Answers: 0

Hello, how do I apply the language settings for the delete and create windows in the table? This is how I set up everything else, and for popups I can't find anything in the documentation?

language: {
"processing": "Подождите...",
"search": "Поиск:",
"lengthMenu": "Показать MENU записей",
"info": "Записи с START до END из TOTAL записей",
"infoEmpty": "Записи с 0 до 0 из 0 записей",
"infoFiltered": "(отфильтровано из MAX записей)",
"infoPostFix": "",
"loadingRecords": "Загрузка записей...",
"zeroRecords": "Записи отсутствуют.",
"emptyTable": "В таблице отсутствуют данные",
"paginate": {
"first": "Первая",
"previous": "Предыдущая",
"next": "Следующая",
"last": "Последняя"
},
"aria": {
"sortAscending": ": активировать для сортировки столбца по возрастанию",
"sortDescending": ": активировать для сортировки столбца по убыванию"
},
"select": {
"rows": {
"_": "Выбрано записей: %d",
"0": "Кликните по записи для выбора",
"1": "Выбрана одна запись"
}
},
buttons:{
create : 'Создать',
remove : 'Удалить'
}
},

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416
    Answer ✓

    delete and create windows in the table

    Not sure what you mean. Do you mean the Editor popups?

    Let's assume you do. This is setting the Editor language defaults in case the user language is German (Germany) (otherwise I just keep the default English (UK) settings). Just overwrite this with your language and you're done.

    if (lang === 'de') {
        $.extend( true, $.fn.dataTable.Editor.defaults, {            
            i18n: {
                remove: {
                    button: "Löschen",
                    title:  "Eintrag löschen",
                    submit: "Endgültig Löschen",
                    confirm: {
                        _: 'Sind Sie sicher, dass Sie die %d ausgwählten Zeilen löschen wollen?',
                        1: 'Sind Sie sicher, dass Sie die ausgewählte Zeile löschen wollen?'
                    }
                },
                edit: {
                    button: "Bearbeiten",
                    title:  "Eintrag bearbeiten",
                    submit: "Änderungen speichern"
                },
                create: {
                    button: "Neuer Eintrag",
                    title:  "Neuen Eintrag anlegen",
                    submit: "Neuen Eintrag speichern"
                },
                datetime: {
                        previous: 'Zurück',
                        next:     'Weiter',
                        months:   [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
                        weekdays: [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ],
                        amPm:     [ 'am', 'pm' ],
                        hours:    'Stunde',
                        minutes:  'Minute',
                        seconds:  'Sekunde',
                        unknown:  '-'
                },
                error: {
                        system: "Ein Systemfehler ist aufgetreten (<a target=\"_blank\" href=\"//datatables.net/tn/12\">Für mehr Informationen</a>)."
                },
                multi: {
                        title: "Mehrere Werte",         
                        info: "Die ausgewählten Zeilen enthalten verschiedene Werte für dieses Feld. Um alle Zeilen auf den gleichen Wert zu setzen, \n\
                               klicken Sie bitte hier. Ansonsten werden die Zeilen ihren individuellen Wert für das Feld behalten.",
                        restore: "Änderungen rückgängig machen",
                        noMulti: "Dieses Feld kann einzeln bearbeitet werden, aber nicht als Teil einer Gruppe."
                }
            }      
        });
    }
    
  • volnistii11volnistii11 Posts: 49Questions: 16Answers: 0

    Thank you

  • volnistii11volnistii11 Posts: 49Questions: 16Answers: 0

    Hello, you helped me with the translation of the datatable text. But I can't correctly implement it in the full setup of the editor. Could you explain how to do this or show how you have done this, please?

  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416
    edited August 2020

    These are defaults for all data tables in your code. This code therefore needs to be executed before any data table initialization. You can also use i18n inside your Editor definitions. Just take a look at the docs. I don't do that because I have dozens of data tables with Editor and I don't want to repeat myself.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    There's an example of that here,

    Colin

This discussion has been closed.