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
raSFUserraSFUser 

Toast message translation / edit text

I have an app that contains various toast messages based on the user selecting different options on the form, currently the messages are all hard coded and in the base language (English) however i would like to give admins the ability to modify the base text of the message as well as translate it for users in different countries. 


Is there a 'best practices' way of doing this?  

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Ryan,
you can use custom labelsin place of text  to translate toast message.
Try like this
({
	showToast : function(component, event, helper) {
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "title": "Success!",
        "message": $A.get("$Label.c.toast")
    });
    toastEvent.fire();
}
})


Please refer below links which might help you further
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/labels_value_provider_platform.htm
https://help.salesforce.com/articleView?id=cl_about.htm&type=5 (https://help.salesforce.com/articleView?id=cl_about.htm&type=5)

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards