Internalization of DataTable

Internalization of DataTable

anjibmananjibman Posts: 115Questions: 10Answers: 0
edited September 2010 in Plug-ins
How can I change the language in the table according to the web page language?

Right now my webpage is displayed according to the language select by the user at the beginning (English/Spanish). If I try to initialized the table with oLanguage for Spanish it work but table have Spanish version all the time even when page itself in English version. How can I solve this problem?

Thanks in advance.


  • allanallan Posts: 61,611Questions: 1Answers: 10,089 Site admin
    There are a couple of ways, but the basic principle is that depending on the language, you need to tell DataTables to use different information. So

    if ( page_lang == "es_ES" )
    lang = { ... Spanish options };
    lang = { ... whatever };
    $('#tableId').dataTable({ "oLanguage": lang });
    You can also use the same technique to feed it different language file URLs.

This discussion has been closed.