Hi there, Here’s an interesting question from Patrick Turcotte about translations:

What would be the best way to contribute them to you?

It’s even more interesting since we have a release candidate coming, which means new features, and hence new labels to translate. So today I’m going to tell you how the translations/labels are managed in Nuxeo.

The first thing to know: Nuxeo provides only English and French translations. All others have been contributed by our community. They are available from two different packages: nuxeo-platform-lang (en and fr) and nuxeo-platform-lang-ext. Here’s the complete list:

  • English (United States)
  • English (United Kingdom)
  • Français
  • Deutsch
  • Italiano
  • Greek (Greece)
  • Español
  • Português
  • Português (Brasil)
  • Polski
  • Català
  • Galego
  • Basque
  • Serbian - Cyrillic
  • русский
  • العربية
  • 中文
  • 日本語
  • Tiếng Việt

Some are up to date, some not so much. So this is a call to action. If you’re reading the blog and want to help, now is the perfect time. What you need to do is as follows:

  • Open a Jira ticket telling us you would like to contribute translations.
  • Compile those translations under one file, for instance messages_fr_CA.properties
  • Send us a GitHub pull request mentioning your Jira ticket with your changes on the following project: https://github.com/nuxeo/nuxeo-platform-lang-ext

In the Nuxeo source code, you might see _fr_ and _en_ translations in various bundles, while other languages that are not maintained by us are in a single file. As Julien said, this is the purpose of nuxeo-platform-lang-ext. We found it easier for everyone to gather all labels of a language at one place.

Here’s an example of a contribution to help you understand how Nuxeo handles message files. Let’s say I want to contribute the Swedish translation. I need to create a file called messages_sv_SE.properties containing my translated labels. I will put it under nuxeo-platform-lang-ext/src/main/resources/web/nuxeo.war/WEB-INF/classes/. This file will be copied into the server WAR because of what we have in deployment-fragment.xml, which is also responsible for our new language declaration:

<?xml version="1.0"?> <fragment version="1"> <!-- The require tag ensure we'll be deployed after nuxeo-platform-lang because we need some contribution declared in its deployment-fragment. --> <require>org.nuxeo.ecm.platform.lang</require>

<!-- We are using the following template to generate the EndResult when the server is starting. Template: nuxeo.ear/OSGI-INF/templates/faces-config.xml End Result: nuxeo.ear/META-INF/faces-config.xml --> <extension target="faces-config#APPLICATION_LOCALE"> <locale-config> <supported-locale>ar</supported-locale> <supported-locale>ca</supported-locale> <supported-locale>cn</supported-locale> <supported-locale>de</supported-locale> <supported-locale>el_GR</supported-locale> <supported-locale>es</supported-locale> <supported-locale>eu</supported-locale> <supported-locale>gl</supported-locale> <supported-locale>it</supported-locale> <supported-locale>ja</supported-locale> <supported-locale>pl</supported-locale> <supported-locale>pt</supported-locale> <supported-locale>pt_BR</supported-locale> <supported-locale>ru</supported-locale> <supported-locale>sr</supported-locale> <!-- Here I'm declaring my new messages_sv_SE.properties file. --> <supported-locale>sv_SE</supported-locale> <supported-locale>vn</supported-locale> </locale-config> </extension>

<install> <!-- Unzip the contents of our nuxeo.war into the real nuxeo.war on the server --> <unzip from="${bundle.fileName}" to="/" prefix="web"> <include>web/nuxeo.war/**</include> </unzip> </install>


I only need to add the supported locale tag because we already have some configuration in nuxeo-platform-lang deployment-fragment. That’s why it’s in the required tag. We want to be deployed after it.

This is a part of nuxeo-platform-lang deployment-fragment:

<extension target="faces-config#APPLICATION_LOCALE"> <locale-config> <default-locale>en</default-locale> <supported-locale>en_GB</supported-locale> <supported-locale>en_US</supported-locale> <supported-locale>fr</supported-locale> </locale-config> <message-bundle>messages</message-bundle> </extension> 

As you can see, we have the message-bundle tag that tells the server for files like messages_locale.properties.

And that’s all you need to know basically. Once we have our first release candidate, I will create a Jira ticket with the English reference file. See ya’ on Monday!