Expand my Community achievements bar.

SOLVED

Translate dynamic field label that is foreign value to english

Avatar

Level 2

Hello, I have a situation where the analytics team needs to see the english version of the label, no matter the current language for the page.

For example, the page is in Chinese, the label value is a manually updated text field (dynamic not static),  the analytics team need to read the data-layer values in english. 

I tried adding ` @ i18n, locale="en"     `. , but since this is a dynamic textfield, nothing was render, because I do not have anything in the dictionary and the values of the text field can change anytime. 

 

Current solution is adding the foreign string to the i18n dictionary and adding the english value.

         ex:         string: パスワ        value : " abc"

This is time consuming and the authors will not be happy about manually translating everything on the page.

 

 

Is there a way of referencing values for a template to get the dynamic property fields and set the english values instead of the current page locale

<sly data-sly-test="${properties.linkTypeHidden || (properties.linkType != 'none'  &&  properties.linkType != 'button') }" data-sly-call="${templateLink.linkText @ linkTextObject=bodyText, shouldAddTrackingScript=true, moduleName='textblock'}"/>

This is my code for the LABEL html

data-sly-test.trackingScript ='{"eventInfo":{"eventAction":"click","eventName":"select link"},"attributes":{"moduleName":"${moduleName}","label":"${link.manualOverrideLabel @ i18n, locale="en"} "/>
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @miniMeatball 
You can automate this process to have analytics labels in a another tab in the component.

 

For the translation, you have to look for automated solution to fill the analytics fields on dialog save etc.
Here you can look for the GenAI for automated translation.



Arun Patidar

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @miniMeatball 
You can automate this process to have analytics labels in a another tab in the component.

 

For the translation, you have to look for automated solution to fill the analytics fields on dialog save etc.
Here you can look for the GenAI for automated translation.



Arun Patidar

Avatar

Level 2

I actually ended up writing a java logic to get the current resource path and replace it with the English path of another page and return that object . 

Avatar

Administrator

@miniMeatball Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni