Create an Object That Contains Label Translations JSON File for a Static Resource

Create a JSON file that includes label translations. Upload this JSON file in Static Resources in Salesforce Setup. Alternatively, create the object directly in the LWC Javascript file.

Here’s an example of our static resource in the code snippet for an LWC component. The function getCustomLabels creates an object of labels for the snippet language.