Contents
Is there way to access custom labels from JavaScript?
Anything else on the page can be translated just fine with custom labels. The problem is that accessing custom labels requires VF context and {!xxx} syntax which of course doesn’t work in separate resource. So, is there a way to access custom labels from javascript?
The question was if it was possible to change the labels of the confirm dialog buttons from “Cancel/Ok” to “No/Yes”. If we look at the JavaScript APIsdocumentation, we can see that there are three different ways that we can display a confirmation dialog: apex.confirm apex.page.confirm apex.message.confirm Note
Where can I find custom labels in Salesforce?
Custom labels are custom text values that can be translated into any language that Salesforce supports. To access custom labels in Aura components, use the $Label global value provider.
How to access custom labels in JavaScript linked as separate static resource?
How one can access custom labels in javascript linked as separate static resource? For example, some user action on the page should trigger confirmation dialog with custom message. And this message should be translated. Anything else on the page can be translated just fine with custom labels.
How to pass parameters to a script tag?
Put the values you need someplace where the other script can retrieve them, like a hidden input, and then pull those values from their container when you initialize your new script. You could even put all your params as a JSON string into one hidden field.
How to pass variable from HTML to JavaScript?
The variable called video_filename was passed from html to javascript. Javascript printed it to screen, and it appeared as embedded into the html in the parent. If you are using jquery you might want to consider their data method.