Configure Liferay for Canada

(pour la version francophone, cliquer ici)

A small blog entry to summarize how to prepare a Liferay installation for a canadian portal.

Liferay natively supports a lot of languages, including French and English, the two official languages in Canada. However, the included translations are fr_FR (French from France) and en_US (English from USA). In most of the cases, this would be perfectly fine because it mostly affects editors and administrators who are accessing the user interface to manage contents. However, some organizations might be punctilious (specially in Québec) on the language ("courriel" rather than "email", "télécopieur" rather than "fax", etc.) and on some visual details (en_US rather than en_CA, US flag rather than Canadian one). This is the reason why I actively worked, with the help of Liferay, on facilitating the installation and configuration of Liferay in Canada.

You'll notice in the following instructions that it's very easy to enable fr_CA (French Canadian) and en_CA (English Canadian) languages.

1) Enable the languages fr_CA and en_CA

It consists in adding a few lines of configuration in portal-ext.properties and system-ext.properties. A reminder: those two files must be located at the root of your Liferay installation (liferay-portal...) or in the classpath.

system-ext.properties

user.country=CA
user.language=en
user.timezone=America/Montreal

portal-ext.properties

company.default.locale=en_CA
company.default.time.zone=America/Montreal
locales=en_CA,fr_CA 

2) Install the translations hook

The configurations in the previous section enable and limit the languages to fr_CA and en_CA. However, no specific translation is included in Liferay by default (yet). The portal will then automatically switch to basic French and English translations.

  • Download this hook (Marketplace)
  • Install it by droping it into the /deploy folder

The hook includes the last  French Canadian translations, flags and translated templates.

3) Add language into Liferay web.xml file

In order to make the language portlet work with the newly introduced language, you'll have to add one entry into the web.xml file (ROOT/WEB-INF/web.xml typically in TOMCAT_HOME/webapps).

<servlet-mapping>
  <servlet-name>I18n Servlet</servlet-name>
  <url-pattern>/fr_CA/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>I18n Servlet</servlet-name>
  <url-pattern>/en_CA/*</url-pattern>
</servlet-mapping>

 

------------------------------------------------------------------------------------------------------------------------------

Un petit billet de blogue pour résumer les étapes nécessaires à la préparation d'une installation de Liferay pour un portail 100% canadien.

Nativement, Liferay supporte de nombreuses langues dont le français et l'anglais, les deux langues officielles au Canada. Cependant, la version francophone incluse est fr_FR (français de France) et en_US (anglais des États). Dans la plupart des cas, cela ne posera pas de problème puisque cela concerne surtout les administrateurs qui utilisent l'interface de gestion des contenus. Mais, certaines organisations sont plus pointilleuses sur des éléments linguistiques ("courriel" plutôt que "email", "télécopieur" plutôt que "fax", etc.) et sur les détails visuels (fr_FR plutôt que fr_CA, drapeau Français plutôt que Canadien). C'est la raison pour laquelle je travaille, avec l'aide de Liferay, à faciliter une installation et configuration 100% canadienne. 

Vous verrez dans les quelques instructions qui suivent qu'il est extrêmement simple d'activer les langues fr_CA (français Canadien) et en_CA (anglais Canadien)

1) Activer les langues fr_CA et en_CA

Il s'agit d'ajouter quelques configurations dans portal-ext.properties et system-ext.properties. Pour rappel, ces deux fichiers doivent être situés à la racine d'une installation (liferay-portal...) ou dans le classpath.

system-ext.properties

user.country=CA
user.language=fr
user.timezone=America/Montreal

portal-ext.properties

company.default.locale=fr_CA
company.default.time.zone=America/Montreal
locales=en_CA,fr_CA

2) Installer le hook des traductions

Les configurations de la section précédente ont pour effet d'activer et restreindre les langues au français et l'anglais du Canada. Cependant, aucune traduction spécifique n'est incluse dans Liferay par défaut. Le portail basculera donc automatiquement sur les traductions françaises et anglaises de base.

  • Téléchargez ce hook (Marketplace)
  • Installez-le en le déposant dans le répertoire de scrutation /deploy

Le hook inclut les dernières traductions francophones canadiennes, les drapeaux ainsi que des gabarits traduits (courriels).

 

3) Ajouter les langues dans le fichier web.xml de Liferay

Afin de rendre le portlet "Langues" fonctionnel avec les nouvelles langues, vous devrez effectuer un dernier changement dans le fichier web.xml (ROOT/WEB-INF/web.xml typiquement dans TOMCAT_HOME/webapps).

 

<servlet-mapping>
   <servlet-name>I18n Servlet</servlet-name>
   <url-pattern>/fr_CA/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
   <servlet-name>I18n Servlet</servlet-name>
   <url-pattern>/en_CA/*</url-pattern>
</servlet-mapping>

 

Blogues
Hallo Sven, auch wenn ich kein bilingue liferay betreibe, war sehr interessant. Wünsche Deiner Familie und Dir alles Gute im neuen Jahr. Heinz
Hallo Heinz,

Danke!
Was für eine Überraschung! Schön, von Dir zu hören. Benützt Credit Suisse Liferay? Wünche Dir auch alles Gute!
Salut ! Hi! Grüß Gott!

I am using Liferay 6.1.20 EE with bundled Liferay Developer Studio 1.6.1, and I just installed your hook, on some places I cannot see the Canadian flag...

On the log I see:

21:12:21,525 INFO [com.liferay.portal.plugin.PluginPackageUtil][PluginPackageUtil:1465] Finished checking for available updates in 1 ms
21:13:46,748 WARN [http-bio-8080-exec-6][404_jsp:109] /html/themes/control_panel/images/language/en_CA.png

Actually I got this log when I go to: Go To > Control Panel > Web Content > Add > Change the default language to French (Canada).

Although the Canadian flag is visible at this path:
[http-server-url]/html/themes/classic/images/language

Merci beaucoup ! Thanks a lot! Danke vielmals.
Kevin