Valid AP-202 Dumps shared by EduDump.com for Helping Passing AP-202 Exam! EduDump.com now offer the newest AP-202 exam dumps, the EduDump.com AP-202 exam questions have been updated and answers have been corrected get the newest EduDump.com AP-202 dumps with Test Engine here:
A developer needs to implement a custom Lightning web component (LWC) for the storefront. The LWC contains language-specific text values. How should the developer translate the text values?
Correct Answer: C
Custom labels are text values that can be translated into any language that Salesforce supports. They are useful for displaying language-specific text in Lightning web components. To use custom labels in a LWC, the developer needs to create them in the Setup menu and assign them to a language and a value. Then, the developer can import them in the LWC using the@salesforce/labelscoped module. For example, if the developer has a custom label namedwelcomeHeader, they can import it as follows: import welcomeHeader from '@salesforce/label/c.welcomeHeader'; Then, they can use it in the HTML template or the JavaScript file of the LWC. For example, in the HTML template, they can use it as follows: HTMLAI-generated code. Review and use carefully.More info on FAQ. <template> <h1>{welcomeHeader}</h1> </template> The custom label will automatically display the translated value based on the user's language preference. The developer can also use thelightning-formatted-textcomponent to format the custom label value with HTML tags. The other options are not correct because: A) Importing static resources for the text values is not a recommended way to translate text values in a LWC. Static resources are files that are stored in Salesforce and can be referenced by applications. They are not designed for storing language-specific text values and they do not support automatic translation based on the user's language preference. B) Using a CustomLabel xml file in the LWC to add the text values there is not a valid option. Custom labels are not stored in xml files, but in the Setup menu. They cannot be added directly to the LWC, but they need to be imported using the@salesforce/labelscoped module. D) Creating a custom Metadata object for the text values and querying it in the LWC is not a feasible option. Custom Metadata objects are records that store configuration data that can be deployed and packaged. They are not intended for storing language-specific text values and they do not support automatic translation based on the user's language preference. Querying them in the LWC would also require an Apex class and a wire service, which would add unnecessary complexity to the solution. Use Custom Labels in Lightning Web Components Custom Labels Internationalizing Your Lightning Web Component (LWC)