cancel
Showing results for 
Search instead for 
Did you mean: 

Custom action and message resource file XXX_fr_BE not found

m_enfin
Champ in-the-making
Champ in-the-making
hi,

I'm using alfresco 2.0, with jdk 1.6.01.

I'm developing a custom action, that requiered a mandatory argument.

To deploy the action, everything is packaged as a jar and placed in the webapps/alfresco/WEB-INF/lib.

Here's the jar content:
root 
   |alfresco      
   |   |extension
   |       |export-context.xml
   |myCompany
       | ExportActionExecuter.class
       | export-messages.properties
       | export-messages_fr_FR.properties
       | export-messages_fr_BE.properties


To develop the action I'm using the sdk, and test it with JUnit.

When I launch the test I get the following exception at startup:


13:28:58,446 ERROR [web.context.ContextLoader] Context initialization failed
java.util.MissingResourceException: Can't find bundle for base name
                                        myCompany.export-messages.properties
                                , locale fr_BE

But the file export-messages_fr_BE.properties is well there at the same place as the export-messages.properties.

Here's the context definitions extract:


   <!– Export Action Bean –>
   <bean id="export"
      class="myCompany.ExportActionExecuter"
      parent="action-executer">
      <property name="nodeService">
         <ref bean="nodeService" />
      </property>
      <property name="contentService">
         <ref bean="contentService" />
      </property>
   </bean>

   <!– Load the Export Action Messages –>
   <bean id="export-messages"
      class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>
               myCompany.export-messages.properties
            </value>
         </list>
      </property>
   </bean>

Is it the right place for the messages? If yes, why is Alfresco not finding the bundle?

Another question: How avoid having to define a _fr_BE? I would like to take care of the language (the fr) and not the country (the BE).

cheers
1 REPLY 1

janv
Employee
Employee
I believe it should be the bundle base name (ie. without .properties) for example:


<property name="resourceBundles">
   <list>
      <value>
         myCompany.export-messages
       </value>
   </list>
</property>

This should then load the locale specific resources, such as:


export-messages_fr_BE.properties

If this does not exist, then it should find:


export-messages_fr.properties

See also:

http://java.sun.com/javase/6/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String,%20ja...

(cut-and-paste the link into another browser tab/window)

Thanks,
Jan