Forum Discussion

nicgutierrez's avatar
11 years ago

How to use text.format

Hello. I'm working on a custom component and I'm trying to use text.format to localize the copy. Here's the sentence that I need to localise:   <h4>${notification.target.actor.login} @mention...
  • PaoloT's avatar
    PaoloT
    11 years ago

    Hi nicgutierrez 

     

    you can definitely use placeholders in your text keys and pass appropriate variables when you use them

     

    For example , if you defined custom-text-key = "My name is {0}"

     

    Then what you can do is:

     

    <#assign myName = "Slim Shady">
    ${text.format("custom-text-key",myName)}

    Or even having multiple placeholders and so on ...

     

    Hope it helps!