You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by wo...@pta.de on 2008/08/12 12:02:56 UTC

[Trinidad] How to use one's own (Text) resources instead of the built-in ones

Hi,

Regarding the use of our own text resources e.g. using our own label for 
Trinidad's showDetail table label (whichin German we found to be too 
long.. ;)
I suppose I could go any time to the trinidad JAR package and replace the 
texts by our own ones.

But this is not the way I would like. Rather, I would prefer a solution 
where I could somehow redirect the classpath used by the ResourceServlet 
to our own messages resources. Is there a setter method somewhere or how 
would I accomplish that?

Thanks a lot,
Wolfgang.

Re: [Trinidad] How to use one's own (Text) resources instead of the built-in ones

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi,

On Tue, Aug 12, 2008 at 12:02 PM,  <wo...@pta.de> wrote:
>
> Hi,
>
> Regarding the use of our own text resources e.g. using our own label for
> Trinidad's showDetail table label (whichin German we found to be too long..
> ;)
> I suppose I could go any time to the trinidad JAR package and replace the
> texts by our own ones.
>
> But this is not the way I would like. Rather, I would prefer a solution
> where I could somehow redirect the classpath used by the ResourceServlet
> to our own messages resources. Is there a setter method somewhere or how
> would I accomplish that?

You can see in the trinidad-skins.xml in the demo bundle how you can
add a resource bundle name:
<skin>
<id>
purple.desktop
</id>
<family>
purple
</family>
<render-kit-id>
org.apache.myfaces.trinidad.desktop
</render-kit-id>
<style-sheet-name>
skins/purple/purpleSkin.css
</style-sheet-name>
<bundle-name>
org.apache.myfaces.trinidaddemo.resource.SkinBundle
</bundle-name>
</skin>

And the resource bundle code looks like this:

package org.apache.myfaces.trinidaddemo.resource;

import java.util.ListResourceBundle;

public class SkinBundle extends ListResourceBundle
{
@Override
public Object[][] getContents()
{
return _CONTENTS;
}

static private final Object[][] _CONTENTS =
{
{"af_tableSelectMany.SELECT_COLUMN_HEADER", "Select A Lot"},
{"af_tableSelectOne.SELECT_COLUMN_HEADER", "Select Just One"},
// add what ever "label" you want to replace
};
}


Greetings,
Matthias

>
> Thanks a lot,
> Wolfgang.



-- 
Matthias Wessendorf

Need JSF and Web 2.0?
http://code.google.com/p/facesgoodies

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org