-
Notifications
You must be signed in to change notification settings - Fork 490
Set language globally without external file #650
Comments
For now I'm using this:
inside my controller, but I'd like to set those options once and have them globally. |
Can you try using the old keys: {
"sProcessing": "Przetwarzanie...",
"sSearch": "Szukaj:",
"sLengthMenu": "Pokaż _MENU_ pozycji",
"sInfo": "Pozycje od _START_ do _END_ z _TOTAL_ łącznie",
"oButtons": {
"sPrint": "Drukuj"
}
} |
This is odd, using old keys helped, but only partially. Could You take a look why new keys don't work when setting localization using JSON object but they work when using sUrl. |
@l-lin thank You for fixing this so quickly. |
Mmh indeed. It's quite confusing. I read somewhere that from v1.10+, we need to use the capital D. So I assumed it wass the same when setting the default settings... |
Maybe Allan (@DataTables) could confirm which option ot use. On his site I've seen that when creating datatable we should use capital D, but all settings are set with lowercase d. |
The Sometimes it can be useful to have a jQuery instance referring to the table (a lot of jQuery plug-ins to that - probably most of them in fact), and sometimes you want the DataTables specific API. The legacy DataTables API modified the jQuery object and that was the wrong thing to do (legacy software... :-) ). The legacy API will be removed in the next major version (although a backwards compatibility file will be available). |
Allan (@DataTables) thanks for clarification.
Am I right? |
Not fully :-). You'll find that As I say, the only difference is in the return from the constructor. Otherwise the two objects should be identical. |
@l-lin I've tried both versions:
and
and they both work, so I was able to set language using DTDefaultOptions.setLanguage |
DTDefaultOptions.setLanguage({
|
globally old way without necessary requesting like |
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:
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:
I have datatables inside div that is shown using ng-if, but this can't be an issue.
Thanks for advice!
The text was updated successfully, but these errors were encountered: