function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Line Break issue in Translations


I created a custom field and set the help text with the line breaks and when it is hovered in the detail page it displays as 
First Line
Second Line
When I checked the html page generated by Salesforce the code looks like below.
sfdcPage.setHelp('xxxx', 'FirstLine\r\u003Cbr\u003ESecondLine');
which i assume is complicated version of 
sfdcPage.setHelp('xxxx', 'FirstLine\r\nSecondLine');
Now when I added a translated text in Setup -> Translation Workbench -> Translate for another language and given the value as 
First Line_FR\r\nSecond Line_FR
but in the UI, it displays everything in a single line and there is no line break but instead it displays all the characters entered above. When looked at the html page generated by Salesforce this is what I see
sfdcPage.setHelp('xxxx', 'First line_FR \\r\\n Second line_FR');
SF automatically inserts another escape sequence character '\' so that it displays what we enter in the translated text. I tried replacing '\r\n' with the actual value which SF used '\r\u003Cbr\u003E' in the translation workbench but still no luck. Is there any other way to display the line break?

You need not do any coding for this. You just have to go to 'Help Text'.  Write Second Line. Now instead of hitting enter after this text, put your mouse cursor infront of the letter S and hit enter. 

User-added image

Let me know if you need help !!

I guess you entered this text in the custom field's help text box.. I am not facing any issue there.. The issue is in the Translation workbench when i want to have this line break for a different language. Did you try this in Translation workbench?
Jacky DecosterJacky Decoster
i'm facing the same issue with line breaks in Translation Workbench. Any solutions yet?
Yes Jacky - instead of directly editing it in the translation workbench as First Line_FR\r\nSecond Line_FR, add this info in an excel sheet and import it. THe line break worked fine.