Is it possible to combine a key and literal constant?
For example.
I want to show 4 texts to show the status of Vacuum 1 - 4, but I do not want to have 4 translation keys. It does not seem to be possible to use !!Vacuum!! 1 and so on.
Best Answer
-
Hi, do you want to use code to parse the current multilingual entries in AppStudio?
You've noticed that App Studio uses !! + key name + !! as the multilingual key, but if you want to dynamically retrieve its value, you can use TComponents.Component_A.t('key name') to get its value.
like:
const stringTest = TComponents.Component_A.t('vacuum') + String(index);
AppStudio is about to release a new version. In the new version, you can get help by referring to the API Documentation. Hope this helps 😆.
TComponents.Component_A.html#.tPost edited by yitong on1
Answers
-
Hi, you can use classic approach to build custom strings. Like for example: const stringTest = `${string1} ${string2}`; Or you can just add two strings like const stringTest = translatedString + String(index);0
-
Hi,
I don't think you have fully understood my question.
I know how to combine strings in javascript. What I want is to do it without breaking the translation function in AppStudio.I have been trying to combine a translation key with additional text, but so far I have not been able to get the key to translate when it is concatenated with other strings.
If there is a supported way to combine a
!!key!!with other values (for example, an index or suffix), I would really appreciate seeing a concrete code example that demonstrates how this should be done.For reference, the following does not work in my case, as
!!vacuum!!is not replaced with its translated value:const stringTest = "!!vacuum!!" + String(index);
Thank you in advance for any clarification or guidance you can provide.
//Markus Näslund0 -
Thank you! That is exactly what I’m looking for.//Markus Näslund0
-
What did I miss here? It doesn't work and then it does?Lee Justice0
-
The response from yitong answered my question, it popped to the top as is was marked best answerlemster68 said:What did I miss here? It doesn't work and then it does?//Markus Näslund0 -
Oh, I see. Thanks for clarifying that. 👍Lee Justice0
Categories
- All Categories
- 5.7K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 16 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 251 ScreenMaker
- 2.9K Robot Controller
- 366 IRC5
- 90 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 857 RAPID Programming
- 43 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 111 Collaborative Robots
- 5 Job listings
