Certified Platform Developer II Exam QuestionsBrowse all questions from this exam

Certified Platform Developer II Exam - Question 171


A Salesforce developer is hired by a multi-national company to build a custom Lightning application that shows employees their employment benefits and earned commissions over time. The application must acknowledge and respect the user's locale context for dates, times, numbers, currency, and currency symbols.

Which approach should the developer implement to ensure the Lightning application complies with the user's locale?

Show Answer
Correct Answer: B

To ensure the custom Lightning application respects the user's locale context for dates, times, numbers, currency, and currency symbols, the best approach is to use the $Locale value provider. $Locale is specifically designed to retrieve the user preferences related to localization and provides direct access to locale settings. Hierarchical custom settings and the $User global variable are not as suited for this purpose as they do not provide direct access to locale settings. Using JavaScript to format values would require additional logic to handle locale-specific formats, which is less efficient and more error-prone.

Discussion

3 comments
Sign in to comment
Maleek100
Sep 6, 2022

Its B if used in an Aura Component

AnhTH
Oct 8, 2022

Correct answer is B $locale $User used on visualforce page, not in lightning

Sapphire808Option: B
Sep 25, 2024

B. $local is the most direct way to get to the localization settings. $user requires more mapping.