Forum Discussion
Hi Catherine,
You can accomplish this by using a custom text key.
First, you could create a custom text key, add it to the Text Properties for each language, and finally give it a value depending on the language.
Steps:
1) Navigate to Studio
2) Choose the Text Editor tab
3) Choose the language of your choice from the Language drop-down menu
4) Click the Search button.
5) You should see a list of search results. Just below that, you should see a text box titled Text Properties
6) Here, you can add a custom text key (Example: customer.custom.textkey.title = test)
7) Once finished, click the Save button.
To give this text key a different value for other languages, repeat the above process, except choose a different language from the drop down menu in step #3. From there, follow the same steps and enter a new value for the text key when adding this to the text properties for the other language(s).
After you've done this, you could use the following syntax in your custom component to reference the text key and display the contents:
${text.format("customer.custom.textkey.title")}
This way, a user will see the content of that text key in the respective language depending on what they have their profile language set to.
Please let me know if any clarification is needed. I hope this is helpful. :)
- catherine_OTX14 years agoGuide
Awesome! Thank you for the quick reply! I'll let you know if I need clarification. :smileyhappy:
- catherine_OTX14 years agoGuide
Hello Jeff S -
I did a search for text keys and see that some of the text keys I thought I was going to create are already in your system. Are those text keys pretty stable? Can I use the ones already created for my custom components?
Thanks so much,Catherine
- JeffS14 years agoLithium Alumni (Retired)
catherine_OTX wrote:
Hello Jeff S -
I did a search for text keys and see that some of the text keys I thought I was going to create are already in your system. Are those text keys pretty stable? Can I use the ones already created for my custom components?
Thanks so much,Catherine
Certainly. You would use the same logic I provided in my initial comment and add in the desired text key. Whether you're creating a new text key or using one already in the system, the same syntax would apply.
For example, if you wanted to use the general.Kudos text key, you'd add something like this to your custom component:
${text.format("general.Kudos")}
Basically, you'll just want to add the text key of your choosing in between the quotes.
Hope this helps. :)
Related Content
- 6 months ago
- 2 years ago