Change the language

Change the language

reyurreyur Posts: 3Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
Hello.

I'm a newbie and I want to change the datatable language.

I have this function :
[code]
$(document).ready(function() {
$('#example').dataTable( {
"oLanguage": {
"oPaginate": {
"sFirst": "Première page",
"sLast": "Dernière page",
"sNext": "Page suivante",
"sPrevious": "Page précédente"
}
}
} );
} );
[/code]

But, how to use it ?

Thank you.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Looks about right to me. Does that not work for you? There are other options as well: http://datatables.net/usage/i18n

    Allan
  • reyurreyur Posts: 3Questions: 0Answers: 0
    edited August 2013
    Hello.

    I tried that, but I have an error message :

    [quote]DataTables warning (table id = 'personsdt'): Cannot reinitialise DataTable.

    To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster)[/quote]

    Can you help me please.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Sounds like you are trying to initialise the table multiple times. You can mix the parameters into a single object (indeed you should only initialise a table only once with a single object!).

    It would be very helpful if you could link me to a test page showing the issue so I can say exactly what is going wrong: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
  • reyurreyur Posts: 3Questions: 0Answers: 0
    Hello.

    I found the solution !
    I changed the version of Tapestry5-jquery 3.3.0 to 3.3.6 and the language is French by default!

    Thank you.
  • reyurreyur Posts: 3Questions: 0Answers: 0
    It works in the DataTables live site ! (http://live.datatables.net/alepaq/6/edit#javascript,html)

    This is my code :

    .tml
    [code]


    JQuery DataTables


    ${message:javascript_required}








    [/code]

    .java
    [code]
    /**
    * Start page of application test.
    */
    @Import(stylesheet = { "context:css/jquerydatatables.css" }, library={"context:js/language.js"})
    public class Index
    {
    @Inject
    private Messages messages;

    @Property
    @Persist
    private List persons;

    @Property
    @Persist
    Person person;

    @OnEvent(value = EventConstants.ACTIVATE)
    void init() {
    persons = new ArrayList();

    Person person1 = new Person();
    person1.setNom("aa");
    person1.setPrenom("aa");

    Person person2 = new Person();
    person2.setNom("bb");
    person2.setPrenom("bb");

    persons.add(person1);
    persons.add(person2);
    }

    public JSONObject getOptions() {
    JSONObject options = new JSONObject();
    options.put("bJQueryUI", "true");
    return options;
    }
    }
    [/code]

    I don't understand...

    Thank you for your help.

    Reyur.
This discussion has been closed.