0

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");
gadeynebram
  • 725
  • 2
  • 6
  • 22

2 Answers2

0

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

Giant2
  • 461
  • 1
  • 4
  • 15
  • Hi @Giant2, I've the way I use the messages bundles to my question. Please let me known if you need additional information. – gadeynebram May 31 '12 at 07:34
  • Seam detecting the locale is demanded to JSF (and many times I see it is bugged). (cap.15.2 of manual tell this). To debug try to detect the used locale each time it is used. If you see it is changed during the same session, probably depend from a timeout reaching. – Giant2 May 31 '12 at 09:22
  • I've removed the configuration in faces-config.xml and added configuration `` to components.xml. Maybe this will make it work more properly. – gadeynebram May 31 '12 at 11:04
0

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.

gadeynebram
  • 725
  • 2
  • 6
  • 22