Using oLanguage with If Else statement

Using oLanguage with If Else statement

sjwsjw Posts: 24Questions: 6Answers: 0
edited November 2015 in Free community support

Hello I am trying to update the olanguage on a table based on the language of the page. I can test the page for it's language and then i was thinking of an 'if else' statement to update the oLanguage with the corresponding language. Here is an example of my code:

var ariaFilterFr = "Filtre de recherche";
        var ariaFilter = "filter";
 $(document).ready(function() {
         var x = $("div.masthead a:first").attr('href');
              $('#form1\\:RidingList').DataTable({
           "paging":   false,   
  if (x == 'en')  {
"oLanguage": {
  "sSearch": ariaFilter,
    }
}
else{
"oLanguage": {
  "sSearch": ariaFilterFr,
    }   
}
  } );       
    $("table.display tbody tr:nth-child(even)").addClass("even");
    
  });
This discussion has been closed.