JSF UI Framework

Labels and Translations Management

Updated: July 17, 2023

The Framework supports resolution of translations using the standard Java Internationalisation mechanism.

Labels can be gathered in .properties files and translated in properties file with the corresponding language suffix. Because of the modularity of the Nuxeo Platform, a specific mechanism allows the Nuxeo Runtime to "build" the complete resources file before deploying it in the web application. You can read the Deployment Model of Nuxeo Platform documentation page for a better understanding. Your plugin must declare the translation resources to the Nuxeo Runtime so that they are taken into account.

  • Let your resources files somewhere in your plugin hierarchy, for instance OSGI-INF/l10n
  • Add an "append" instruction to the deployment-fragment.xml file of your plugin (and add this file if it is not added yet) for each translation file

     <append from="nuxeo.faceted.search.tmp/OSGI-INF/l10n/messages_fr.properties"
          to="nuxeo.war/WEB-INF/classes/messages_fr.properties" addNewLine="true" />
    

Then, you can reference your labels keys from the various context that are provided in the application:

  • on Facelet Templates: 

     <h:outputText value="#{messages['myLabelKey']}" />
    
  • From a Seam Component (TODO)

  • Using the Nuxeo Widgets: most of the Nuxeo widgets hold a "localize" boolean attribute. When set to true, the label attribute content is considered as a key and resolved at display time.

You may want more information about default labels of the Back Office.

You can also use Nuxeo Studio to upload label translations