Hi All,
This question is regarding
struts error handling and using placeholders for displaying custom messages.
Currently my application resources properties file has messages something like this
----
errors.range={0} is not in the range {1} through {2}.
----
Now when we construct the action message from
java code for the same, the placeholder
string {0} in the message is replaced by the first runtime argument, {1} is replaced by the second argument, and so on for the mentioned key (errors.range) in the order we provide the replacement values.
Rather than this, I want to couple the placeholder in application resource properties keys with the values we provide from java code.
To give a hypothetical example say the message in french evaluates to something like this
errors.range={1} is not in the range {0} through {2}. or in japanese its like this
errors.range={2} is not in the range {1} through {0}.
(not the exact syntax just trying to elaborate)
I want the code to tackle such situations in a generic fashion or should i resort to the above approach of semantically adjusting the placeholders based on the language. The placeholder values are fetched from the external system to which we communicate.
Do post your thoughts on the same.
Thanks