2

I want to change the language of the elements of the BootsFaces b:dataTable.

(ex: entries => entradas, next=>siguiente),

Does anyone know how to do this?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
goero_ag
  • 99
  • 1
  • 6
  • You should start learning about JSF internationalization. A good start is in [here](http://www.mkyong.com/jsf2/jsf-2-internationalization-example/) – Bonifacio Feb 03 '16 at 17:35
  • Are you talking about the JSF framework called BootsFaces? Because BootsFaces is language-agnostic. And it's popular in the Spanish speaking world. For instance, to change the caption of the "next" button, you simply write ``. Does this answer your question? – Stephan Rauh Feb 03 '16 at 19:57
  • 1
    @StephanRauh As you indicate is Bootsfaces , the problem is with the DataTable that the pager automatically generated and has the input search terms in English and that I can not set with value... – goero_ag Feb 04 '16 at 18:11
  • 1
    @goero_ag That's because BootsFaces's datatable is still in experimental phase (not fully developed), and you can't change the default text generated by it. Until the next version (probably 1.0), your best choice is using another framework like PrimeFaces for datatable OR develop your own table using JSF's templates. – Bonifacio Feb 05 '16 at 19:17

1 Answers1

3

As Bonifacio mentioned, the DataTable widget of BootsFaces 0.8.x is still in its infancy. Currently, we're working hard to bring you all the features you need - internationalization included. Maybe you want to watch the discussion on our bug tracker (https://github.com/TheCoder4eu/BootsFaces-OSP/issues/301).

By the way, it's surprisingly simple to replace the BootsFaces dataTable by standard JSF 2.x code and a few lines of JavaScript:

<h:dataTable value="{{carPool.carPool}}" var="car" id="carPool" styleClass="table table-striped table-bordered"
  style="width:100%">
  <h:column>
    <f:facet name="header">
      <h:outputText value="Brand" />
    </f:facet>
    <h:outputText value="#{car.brand}" />
  </h:column>
  <h:column>
    <f:facet name="header">
      <h:outputText value="Type" />
    </f:facet>
    <h:inputText value="#{car.type}" />
  </h:column>
</h:dataTable>
<script>
$(document).ready(function() {
$('#carPool').DataTable({
   "language": {
       "url": "//cdn.datatables.net/plug-ins/1.10.10/i18n/Spanish.json"
   }
 });
} );
</script>

I did this in the most examples of http://www.bootsfaces.net/forms/DataTable.jsf. You'll find the source code here: pure HTML and JSF 2.x. As a third alternative, you can construct the HTML code using ui:repeat.

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37