cancel
Showing results for 
Search instead for 
Did you mean: 

Internationalization template strings

ribz33
Champ on-the-rise
Champ on-the-rise
hi,

how i can make a freemarker template multilingual ?

Im using template for dashlet and i want to internationalize it how i can do it ?

i had trieed this :
 ${message(product_name)}
for instance but its not working.
14 REPLIES 14

zummy
Champ in-the-making
Champ in-the-making
Merci ribz for the time you spend answering my question.

I've tried that but still does not work.

Actually I want to add a custom action in the "More Actions" menu so in the web-client-config-custom.xml I have added the following:

   <config>
      <actions>
         <action id="my_details_space">
               <label-id>generate_odj</label-id>
            <image>/images/icons/View_details.gif</image>
            <action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>

         <action-group id="browse_actions_menu">
            <action idref="my_details_space" />
         </action-group>
      </actions>

   </config>

But the label appears as follow on the UI:
$$generate_odj$$

ribz33
Champ on-the-rise
Champ on-the-rise
Ok that is different !

In your case you try to internationalize webclient and not core or special jsp.
In this case i don't know how we can define well string in an extension ressource bundle.

For webclient, me i code label directly in webclient.properties

I'm sorry i don't know how we can do it like extension.

You need help of alfresco engineers now to do that like you want.

And be careful if you add webclient.properties and webclient.properties_en_US i dont know why but for me alfresco don't overwrite well it. So i write it directly in WAR.

I know its not best way but its the only that i had found at the moment which is working  Smiley Surprisedops:

gavinc
Champ in-the-making
Champ in-the-making
Hi,

To add a custom label in this way requires a "webclient.properties" to be placed in the alfresco.extension package.

If you are using JBoss this file should go in the directory mentioned by ribz33 i.e. in C:\alfresco\jboss\server\default\conf\alfresco\extension

The following wiki page explains the process: http://wiki.alfresco.com/wiki/Adding_Custom_I18N_Strings

robain
Champ in-the-making
Champ in-the-making
after setting the values in webclient.properties file, are they available on the freemarker templates as well ??
${message("product_name")}

dominique
Champ in-the-making
Champ in-the-making
Hi guys,

It IS possible (at least in Alfresco Labs 3C) to create differente message properties files, not using default webclient.properties.
And so making it easier to develop in larger teams and not interfere with translations.

After digging into the source code, I found out how:

You basically have 2 different beans dealing with messages:

1) the default Alfresco one:

This one uses:

org.alfresco.i18n.ResourceBundleBootstrapComponent

as defined and configured inside:

WEB-INF/classes/alfresco/core-services-context.xml

2) And the Webclient one:

org.alfresco.web.app.ResourceBundleBootstrap

(check out the src code of org.alfresco.web.app.ResourceBundleWrapper to find out more about it)

Webclient resources are loaded by this class, but it not defined yet in a normal Alfresco environment.
Instead, you have to define yourself.
So, if you want to use different webclient message files, you need to add them to the list.
So, create a file :

WEB-INF/classes/alfresco/extension/custom-webclient-context.xml

contents:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <bean id="resourceBundlesWebApp" class="org.alfresco.web.app.ResourceBundleBootstrap">
      <property name="resourceBundles">
         <list>
             <value>alfresco.extension.custom-webclient</value>
         </list>
      </property>      
   </bean>
  
  
</beans>


And then put you're properties into:

WEB-INF/classes/alfresco/extension/custom-webclient.properties

Now you're action labels etc will work !
For inside the JSP, you off course still have to load them like this
<f:loadBundle basename="alfresco.extension.custom-webclient" var="customMsg"/>


hope this helped!

Kind regards

Dominique De Munck