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.

Replies

  • allanallan Posts: 61,449Questions: 1Answers: 10,055 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

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

    Allan
This discussion has been closed.