Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource Bundle - make reference to other strings?

can I make references within a resource bundle?

eg:

label.name=John
label.surname=Doe

label.fullname=<label.name> <label.surename>

?

like image 342
membersound Avatar asked Apr 21 '26 02:04

membersound


2 Answers

you can do it like this

label.fullname = {0} {1} 

and while rendering it

<h:outputFormat value="#{bundle.label.fullname}">
  <f:param value="#{bundle.label.name}"/>
  <f:param value="#{bundle.label.surname}"/>
</h:outputFormat> 

or you could try this out

CONST_1 = name
CONST_2 = surname
fullname = {CONST_1}  {CONST_2}

from here

like image 166
jmj Avatar answered Apr 22 '26 20:04

jmj


For anyone else who stumbles upon this post, I figured I would share a recent find.

Using commons-configuration from Apache Commons, you can reference other properties in the same file as follows:

foo=somevalue
foo.bar=${foo}
like image 20
Andy Senn Avatar answered Apr 22 '26 20:04

Andy Senn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!