Re: internationalising error messages
Hi Jurrie, Interesting. The property was in my main Application properties file, not in the properties for the class that threw this error (lets say TestPage.java). I'm not too keen on having multiple properties files for lots of different Classes so I keep them all in one spot, I was under the understanding it was meant to cascade up the tree? Does Component's getString() method not cascade for properties? If they are both just as localisable, I'm happy ;) cheers, Steve On 11 Nov 2008, at 14:12, Jurrie Overgoor wrote: Steve Swinsburg wrote: That throws a java.util.MissingResourceException: Unable to find resource: error.empty.file.uploaded for component: . Is there a reason why StringResourceModel is not preferred. Its just as localisable as the other method right? I'm not saying that StringResourceModel is less preferred. They are both just as localisable. (Perhaps under the hood both methods boil down to the same thing?) I'm just saying that I mostly see examples that use Component's getString() method :) Why the MissingResourceException is thrown is a little unclear to me. Are you sure that the resource is in the correct file? getString() should load the string from the corresponding .properties file. So, if the code was in HelloWorld.java, then HelloWorld.properties should contain a line like error.empty.file.uploaded = You have uploaded an empty file. -- With kind regards, Jurrie Overgoor 2go-mobile b.v. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
Re: internationalising error messages
Steve Swinsburg wrote: Cool, ended up doing this: error(new StringResourceModel(error.empty.file.uploaded, this, null).getString()); Reckon thats the best solution? It's a bit heavier than just ResourceModel, for simple strings with no param substitution would it still be ok? I suppose it would work, but I think in Wicket you are ment to do: error(getString(error.empty.file.uploaded)); -- Met vriendelijke groet, Jurrie Overgoor 2go-mobile b.v. t: +31 570 609 910 f: +31 877 844 210 e: [EMAIL PROTECTED] w: www.2go-mobile.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: internationalising error messages
Steve Swinsburg wrote: That throws a java.util.MissingResourceException: Unable to find resource: error.empty.file.uploaded for component: . Is there a reason why StringResourceModel is not preferred. Its just as localisable as the other method right? I'm not saying that StringResourceModel is less preferred. They are both just as localisable. (Perhaps under the hood both methods boil down to the same thing?) I'm just saying that I mostly see examples that use Component's getString() method :) Why the MissingResourceException is thrown is a little unclear to me. Are you sure that the resource is in the correct file? getString() should load the string from the corresponding .properties file. So, if the code was in HelloWorld.java, then HelloWorld.properties should contain a line like error.empty.file.uploaded = You have uploaded an empty file. -- With kind regards, Jurrie Overgoor 2go-mobile b.v. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: internationalising error messages
Cool, ended up doing this: error(new StringResourceModel(error.empty.file.uploaded, this, null).getString()); Reckon thats the best solution? It's a bit heavier than just ResourceModel, for simple strings with no param substitution would it still be ok? cheers, Steve On 11 Nov 2008, at 13:24, James Carman wrote: Component has a getString() method that you can use to access its message bundle. On Tue, Nov 11, 2008 at 8:17 AM, Steve Swinsburg [EMAIL PROTECTED] wrote: Is there a way to internationalise the error messages? I'd like them to come from my resource bundle: error(new ResourceModel(error.empty.file.uploaded)); doesnt work and gives: Model:classname=[org.apache.wicket.model.ResourceModel] as the output. Alternatively I'll need to look at using a custom panel to render my messages in one spot. cheers, Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
internationalising error messages
Is there a way to internationalise the error messages? I'd like them to come from my resource bundle: error(new ResourceModel(error.empty.file.uploaded)); doesnt work and gives: Model:classname=[org.apache.wicket.model.ResourceModel] as the output. Alternatively I'll need to look at using a custom panel to render my messages in one spot. cheers, Steve smime.p7s Description: S/MIME cryptographic signature
Re: internationalising error messages
That throws a java.util.MissingResourceException: Unable to find resource: error.empty.file.uploaded for component: . Is there a reason why StringResourceModel is not preferred. Its just as localisable as the other method right? Steve On 11 Nov 2008, at 13:34, Jurrie Overgoor wrote: Steve Swinsburg wrote: Cool, ended up doing this: error(new StringResourceModel(error.empty.file.uploaded, this, null).getString()); Reckon thats the best solution? It's a bit heavier than just ResourceModel, for simple strings with no param substitution would it still be ok? I suppose it would work, but I think in Wicket you are ment to do: error(getString(error.empty.file.uploaded)); -- Met vriendelijke groet, Jurrie Overgoor 2go-mobile b.v. t: +31 570 609 910 f: +31 877 844 210 e: [EMAIL PROTECTED] w: www.2go-mobile.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
Re: internationalising error messages
Component has a getString() method that you can use to access its message bundle. On Tue, Nov 11, 2008 at 8:17 AM, Steve Swinsburg [EMAIL PROTECTED] wrote: Is there a way to internationalise the error messages? I'd like them to come from my resource bundle: error(new ResourceModel(error.empty.file.uploaded)); doesnt work and gives: Model:classname=[org.apache.wicket.model.ResourceModel] as the output. Alternatively I'll need to look at using a custom panel to render my messages in one spot. cheers, Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]