[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Internationalization with args  XML
Forum Index -> Development
Author Message
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

Hi,

a normal MessageSource allows me to do this:
Code:
org.springframework.context.MessageSource.getMessage(String, Object[], Locale)


With the normal CaptainCasa resource mechanism I can only use static messages, and I cannot fill in any arguments into placeholders.

So my first question is: Have I simply not discovered that args-Feature in the resource mechanism of CaptainCasa or is this really not possible?

Thanks,

Björn
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Hi,

I am not sure what "normal" is ;-)
We are using the properties management within Java by default.

What you should do is:
Derive the message, e.g. "$1 has been processed."
Then use String.replace to fill in "$1" or whatever you use.
...and of course you can shrinkwrap this in an own Util-method.


Regards, Björn

Björn Müller, CaptainCasa GmbH
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

Hi,

it seems I have not expressed myself good enough.

As long as I am in my code, args are no Problem ...

But when i am in my JSP, I do the following:
Code:
 <... text="#{rr.resource['message_key']}"
 

If I have then defined in resources.properties ...
Code:
 message_key=Message with Placeholder {0} inside
 

... I cannot pass an argument to be filled into the placeholder. The resource mechanism does not seem to give me a chance to pass args into the tag. I guess this is simply a fact, isn't it?

Regards,

Björn
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

...yes, this is a fact as you describe it...

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team