Localize Login Prompts and Custom Error Messages for Login Discovery

When you use the Login Discovery page type in My Domain and Communities, you can localize the login prompt with a custom label. You can also localize custom login error messages in Apex. For example, you can alert users when they try to log in with a personal email address instead of their corporate email address.

Where: This change applies to Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions. It’s available in all communities accessed through Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.

How: To localize the login prompt, use the $Label global variable, for example, $Label.loginPrompt.

To localize custom error messages in Apex Auth.LoginDiscoveryHandler or Auth.MyDomainLoginDiscoveryHandler, create the error message as a custom label with the Auth.DiscoveryCustomErrorException exception. In this example, CustomError is a custom label.

throw new
   Auth.DiscoveryCustomErrorException(Label.CustomError)