I have a value which is stored as an enum that I want to display in a Primefaces datatable with a different value displayed per locale.
This is what I currently have in the data table:
<p:dataTable id="DtSources" var="source" value="#{sourceView.sources}" selection="#{sourceView.selectedSource}" selectionMode="single" scrollable="true" resizableColumns="true" rowKey="#{source.id}">
<f:facet name="header">Sources</f:facet>
<p:column headerText="Type">
<h:outputText value="#{source.type}" /> <!-- This is what I'm trying to fix -->
</p:column>
</p:dataTable>
The problem is the value in #{source.type}. It should display as "Collection" or "Examples" in English and something like "Menge" or "Beispiele" in German and it currently just shows an ugly string representation of the enum like COLLECTION or EXAMPLES.
There has to be a nice way to do this, but I haven't figured it out yet. Also, I don't want to add the logic to the model for obvious reasons.