Search code examples
javajsfpropertiesresourcebundle

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>

?


Solution

  • 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