Question

I'm using seam 2.2.2.Final with Richfaces 3.3.3.Final on JBoss AS 6.

My application is translated into 2 languages (dutch and english).

Sometimes (varying from hours to days) the web application looses the translations. It then only displays the key's as labels and not the translations.

Would anyone know what causes this?

First I thought it could be caused by the character set used in dutch. I then converted the files to ascii with native2ascii.exe but this did not solve the problem.

I'm using the default messages.properties files from seam. In my case these are messages_nl.properties and messages_en.properties. In JSF I use the EL-tags #{messages['key']}. after a few hours or days it seems like the application can't find the files anymore.

My faces-config.xml file contains these settings:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
        <locale-config>
           <default-locale>nl</default-locale>
           <supported-locale>nl</supported-locale>
           <supported-locale>en</supported-locale>
        </locale-config>
    </application>
 </faces-config>

In JSF I use it like this:

<h:outputText value="#{messages['admin.scheduling.title']}" />

In Code I use

Messages.instance().get("admin.scheduling.title");
Was it helpful?

Solution 2

I've ultimately solved this by creating an own implementation of the messages component.

It seems like an internal cache in seam gets cleared (probably after deserialisation of something). If the cache is (almost) empty I read the bundles again.

OTHER TIPS

What are you using for translation? A converter?
The getAsString method must return the translated string.
Could you post the code?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top