Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Set language globally without external file #650

@Misiu

Description

@Misiu

Hi, first of all thank You for building this awesome piece of code 😄

Now here is problem I'm facing:
I'd like to translate all instances of DataTables, using instructions I found in API section I'm doing this:

.run([
    "DTDefaultOptions", function(DTDefaultOptions) {

//this works fine
        DTDefaultOptions.setLanguage({
            sUrl: "../Content/pl.js"
        });

//this doesn't works
        DTDefaultOptions.setLanguage({
            "processing": "Przetwarzanie...",
            "search": "Szukaj:",
            "lengthMenu": "Pokaż _MENU_ pozycji",
            "info": "Pozycje od _START_ do _END_ z _TOTAL_ łącznie",
            "infoEmpty": "Pozycji 0 z 0 dostępnych",
            "infoFiltered": "(filtrowanie spośród _MAX_ dostępnych pozycji)"
        });
    }
])

First option works fine, but this involves one extra request to server for each instance.
I'd like to avoid it and set language single time, inline.

In run I'm setting language configuration and then inside controller I'm setting configuration for specific instance:

self.dtOptions = DTOptionsBuilder.newOptions().withButtons(["print"]);

I have datatables inside div that is shown using ng-if, but this can't be an issue.
Thanks for advice!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions