Translation issue of "sInfo" text while the data is being loaded
Translation issue of "sInfo" text while the data is being loaded
flarpy
Posts: 47Questions: 0Answers: 0
Hi,
We came across an issue in regards to translation of "sInfo" text in one of our projects. "sInfo" refers to "Showing 0 to 0 of 0 entries" text.
We a load quite a lot of data via Ajax. Once the data is loaded properly "sInfo" text does get translated as it should. However, while the data is being loaded (which takes a while) it displays the default English text. We use Zend Framework translation component.
Is there a way we could display the translated "sInfo" text before the page is rendered?
Many thanks in advance for your help.
Regards,
flarpy
We came across an issue in regards to translation of "sInfo" text in one of our projects. "sInfo" refers to "Showing 0 to 0 of 0 entries" text.
We a load quite a lot of data via Ajax. Once the data is loaded properly "sInfo" text does get translated as it should. However, while the data is being loaded (which takes a while) it displays the default English text. We use Zend Framework translation component.
Is there a way we could display the translated "sInfo" text before the page is rendered?
Many thanks in advance for your help.
Regards,
flarpy
This discussion has been closed.
Replies
Am I able to reproduce that in the example you linked me to before? When I load the page up I can see the following in the code:
> "sInfo": 'Showing _START_ to _END_ of _TOTAL_ entries'
Which is what is shown on the page. I presume that part is generated by the Zend framework translation?
Thanks,
Allan
Yes, you should be able to reproduce that from that link.
"sInfo": 'Showing _START_ to _END_ of _TOTAL_ entries' - is generated by Zend framework translation.
If you have a look at the source code again, you will notice that we invoke the dataTable() method
not inside the header tag but within the body. Also datatable() method is called when the document is ready.
Please consider the following:
$(document).ready(function() {
$('#someTable').datatable();
});
This is how we call the method. Could this be one of the possible reasons why sInfo translated message only shows when the entire data is loaded?
Hope this helps.
Let me know if you need further information.
Many thanks once again.
Regards,
flarpy.
No - its not that - since you've wrapped it up in `$(document).ready()` it will be absolutely fine.
How can I get it to show something other than the default text?
Allan
Thanks for your prompt reply.
To show something other than the default text assign any value to the sInfo property. After the page has been loaded completely you will see that text but not before the page is loaded. Not sure if that's what you meant.
I just removed all PHP/Zend translation from the sInfo and assigned some hard-coded string (Not PHP). For instance:
[code] "sInfo": 'My string showing _START_ to _END_ of _TOTAL_ entries' [/code]
Upon refresh, I don't see the above text, instead I see the default "Showing 0 to 0 of 0 entries" which I suspect is hard-coded in the plugin. Once everything is loaded, sInfo shows my custom text.
As mentioned above we are loading the data via Ajax call.
Let us know if you need more info on this.
Many thanks,
flarpy
We've got a solution for this issue.
The only way we can get around this is by using the [code]"sInfoEmpty"[/code] Whatever value is assigned to this property, gets displayed while the page is being loaded.
[code] "sInfoEmpty": 'Text displaying while page is being loaded',
"sInfo": 'Text displaying one the page is loaded'
[/code]
Hope it helps someone.
Thanks for your time.
flarpy
Perhaps I should introduce a new option of `sInfoLoading` to go alongside sLoadingRecords . I'll have a think about this and might introduce it in 1.10.
Thanks for bringing this up.
Regards,
Allan