Internationalisation in DataTable Plugin

Internationalisation in DataTable Plugin

iviewclear2iviewclear2 Posts: 3Questions: 0Answers: 0
edited January 2011 in Plug-ins
Hy all,

Why it's not correct to write this :

[code]
$('.sortable').each(function(i){
// DataTable config
var table = $(this),
oTable = table.dataTable({
"oLanguage": {
"oPaginate": {
"sNext": "Page Suivante"
}
},
"oLanguage": {
"oPaginate": {
"sPrevious": "Page Pr

Replies

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    Because it is the same as this:

    [code]
    var i = 0;
    i = 1;
    [/code]
    And expecting i to be 0. You've got two declarations of 'oLanguage' - you just need to combine them:

    [code]
    $('.sortable').each(function(i){
    // DataTable config
    var table = $(this),
    oTable = table.dataTable({
    "oLanguage": {
    "oPaginate": {
    "sNext": "Page Suivante",
    "sPrevious": "Page Pr
  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    Btw - there is a full translation available here: http://datatables.net/plug-ins/i18n#French :-)

    Allan
  • iviewclear2iviewclear2 Posts: 3Questions: 0Answers: 0
    Thanks for your answer
    It works
  • artart Posts: 19Questions: 0Answers: 0
    edited March 2012
    I haven't had success so far combining the translation with other elements. What's wrong in here?

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "fnServerData": fnDataTablesPipeline,
    "sAjaxSource": "scripts/server_processing.php",
    "oLanguage": {
    {
    "sProcessing": "Hetkinen...",
    "sLengthMenu": "Näytä kerralla _MENU_ riviä",
    "oPaginate": {
    "sFirst": "Ensimmäinen",
    "sPrevious": "Edellinen",
    "sNext": "Seuraava",
    "sLast": "Viimeinen"
    }
    }
    } );
    } );
    [/code]
  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    The syntax error isn't going to help :-). You've got an extra opening brace for oLanguage. Does it now throw a Javascript syntax error on the web-browser's console?

    Allan
  • artart Posts: 19Questions: 0Answers: 0
    That did it Allan, removed the extra opening bracket and it's working. It didn't throw any syntax errors, it just didn't load. But it works now.

    Only issue at the moment is that it pushes the pagination to a second line due to not enough space. I hope that's an easy fix. See screenshot: http://screencast.com/t/TL57T2AF
  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    It is - just alter the width of the dataTable_paginate class in the CSS. Firebug will help you out with this one.

    Allan
  • artart Posts: 19Questions: 0Answers: 0
    I added width to the dataTable_paginate class because it wasn't there. But no matter how wide I put it (either in pixels or %), it keeps a portion of the buttons on the 2nd line as in the screenshot in my previous post :(
  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    And what is the dataTables_info width set to? In theory they should need widths if they fit together (which from your screenshot they do). Again Firebug will help here. Or a link would be useful :-)

    Allan
  • artart Posts: 19Questions: 0Answers: 0
    Solved Allan, thanks a lot!

    The problem was that I was editing all the time the demo_table.css file. But I had to edit the demo_table_jui.css. They both contain the dataTables_info and paginate classes.
This discussion has been closed.