Change the Locale and Language of the Bootfaces Da

2019-05-27 08:56发布

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?

1条回答
你好瞎i
2楼-- · 2019-05-27 09:30

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.

查看更多
登录 后发表回答