Supporting Multiple Languages
The static texts displayed by the
Widget Framework are
stored in an application resource file called
ApplicationResources.properties
. Each publication has
its own copy of ApplicationResources.properties
,
located in the following folder:
publication-path/WEB-INF/classes/com/escenic/framework/
The contents of ApplicationResources.properties
are
the same in all publications.
You can add support for a languages other than US English as follows:
-
Make a copy of
ApplicationResources.properties
(download it from one of your publications on the server). -
Translate the contents to the required language.
-
Rename the translated file to
ApplicationResources_
locale.properties
, where locale is a locale code supported by Java (see http://www.oracle.com/technetwork/java/javase/java8locales-2095355.html). A German application resource file, for example, could be calledApplicationResources_de_DE.properties
orApplicationResources_de_AT.properties
(for Austrian German). -
Upload the translated file back to publication-path
/WEB-INF/classes/com/escenic/framework/
. If you have several publications, then upload it to all of them.
Now all you need to do to switch a publication to the new language is to
set the locale
section parameter in your
publication's home section to the correct locale code
(de_DE
, for example). If there is no
locale
section parameter in the publication home
section, then add it. To switch the publication back to US English, set
locale
to en_US
.
It is not necessary to restart the Content Engine when you add a new application resource file. However, you do need to restart the Content Engine if you change the contents of an existing application resource file. You can avoid having to restart the Content Engine in this case by:
-
Renaming the modified application resource file (from
ApplicationResources_de_DE.properties
toApplicationStrings_de_DE.properties
, for example) -
Modifying the
javax.servlet.jsp.jstl.fmt.localizationContext
property in yourweb.xml
accordingly. By default it is set tocom.escenic.framework.ApplicationResources
, so in this case you would want to change it tocom.escenic.framework.ApplicationStrings
.