You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Strand <ma...@entcap.biz> on 2005/09/23 12:45:50 UTC

Message keys with white space

Hi.
I want to use whitespace in one of my message keys:
props.put("key with whitespace", "value");
Normally, I would type this in my.properties file:
key\ with\ whitespace=value
but it appears Tapestry (beta-6) won't recognise the key if I do that. Is  
there a way to fix this or will I have to skip whitespace in the key?

Thanks,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Message keys with white space

Posted by Geoff Longman <gl...@gmail.com>.
Firstly, why do you want to use whitespace? No end user is ever going
to see the key.

Secondly, I just tried this

Properties p = new Properties();
p.load(A file with keys containing ws);

A resource bundle that loads from a file uses a
PropertiesResourceBundle, which calls the load() method.The problem
you describe is in the implementation of the parser that loads
properties files

That said you can implement your resource bundle as a class (a
subclass of ListResourceBundle) and then you can have whitespace in
the keys. But, that's hardly ideal as a change would require a
recompile.

There is another option for Properties which you can not use for
resource bundles unfortunately. You write your properties file in XML
and use loadFromXML() instead of load(). Then you can have whitespace.
As I said you can't use XML for resource bundles as 
PropertiesResourceBundles only calls load().

Geoff

Geoff

On 9/23/05, Martin Strand <ma...@entcap.biz> wrote:
> Hi.
> I want to use whitespace in one of my message keys:
> props.put("key with whitespace", "value");
> Normally, I would type this in my.properties file:
> key\ with\ whitespace=value
> but it appears Tapestry (beta-6) won't recognise the key if I do that. Is
> there a way to fix this or will I have to skip whitespace in the key?
>
> Thanks,
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org