Requested unknown parameter when using `language.url`
Requested unknown parameter when using `language.url`
Link to test case:
https://live.datatables.net/vagohuwi/1/edit
Debugger code (debug.datatables.net):
Your debug code is: adudoh (tested inside the live demo)
Error messages shown:
DataTables warning: table id=tabla-resultados - Requested unknown parameter '1' for row 0, column 1. For more information about this error, please see https://datatables.net/tn/4
Description of problem:
I'm testing/playing with the internationalization feature. I even created a custom JSON to reuse its values among many tables (instead of editing them manually on each page).
However, when testing the JSON, with the language.url property, it fails.
In the Live Code you can uncomment language.url to see the error (no alert, but the table doesn't load properly.
Given that only labels are being changed, I find it weird that it fails
PS: is _ENTRIES_ not expected to work on "emptyTable"?
This question has an accepted answers - jump to answer
Answers
Thanks for the test case!
This is in the
language.urldocs:Basically your test case is calling
table.draw()before initialization is complete causing the error. Move it intoinitCompleteorready()to execute after Datatables has fully initialized. Updated test case:https://live.datatables.net/vagohuwi/2/edit
The
language.emptyTabledocs don't state that string substitution is available. Howeverlanguage.infoEmptydoes have this:I would say this is expected behavior since string substitution not documented to be supported. Also
language.emptyTableis displayed when there are no records so the substitution values would all be zero. Do you have a use for needing to use string substitution withlanguage.emptyTable?Kevin
Awesome, thanks! I'm actually going to need both
initCompleteandready(). I think I missed that section of the docs because I started reading from https://datatables.net/manual/i18n#Ajax-loading-a-translation, and stopped there.I was trying to improve the message from "No data available in table" to "No entries available in table", but in spanish (where "entries" is defined at
language.entries["_"]).Basically, to make it work like my
infoEmptyexample: Switching from "Showing 0 to 0 of 0" (which doesn't really make sense) to "There are no entries to display". That way the message feels more "natural".You will need to set the
language.emptyTablestring like this:Updated test case:
https://live.datatables.net/vagohuwi/4/edit
@allan will need to comment on adding the ability to use the setting from
language.entries["_"].Kevin
Yes, I'm currently doing that as a workaround, changing "solicitudes" accordingly for each table I have. Thanks for the suggestion!.
Regarding the 2nd part, if it's decided to enhance the
emptyTablemessage, could I kindly ask ifzeroRecordsmight also be included?"Giancarlo
Hi,
Many thanks for this discussion. Having
emptyTableandzeroRecordschange based onentriescertainly would make sense. I'm not sure how easy that is going to be though, as I'm concerned it wouldn't make sense in all languages - or there might be nuances that are missed.For example, the default for
emptyTableis:If
entriesispeople, it wouldn't really be right to say "No people available in table". ThezeroRecordsflows better, but I don't know enough about other languages to be able to say how well that would work.What we really need is an expert in internationalisation to be able to tell us if this is viable. In the short term, I'd suggest setting
emptyTableandzeroRecordsas you currently need to, but it is something I will look out for as it could help improve things for both the develper and client.Allan
Hello, Allan
Thanks for your answer.
I'm not talking about changing the default message in any language. For a general purpose the current message is fine.
In Spanish, Italian, Portuguese and French your "people" example has the same issue. It might work with some tweaking, but I see your point.
However adding the ability to use placeholders (is that the right name?) in
emptyTableandzeroRecordswould be a nice addition (entries, entry, etc.) and it shouldn't break anything. That way any customization of both properties could reused the correct word that is already defined.