Auth0 Home Blog Docs

How I can have multi language support at Lock v2 (swift) for error messages triggered by custom rules?


I’m developing an iPhone app using Lock component.

I have set up the rule [1] to not let the user log in before its email is verified.

The app has to have multi-language support and I cannot find any way using Lock v2 for iOS to have the chance to translate the message thrown from the rule.

Is there any way to do that?


Hi there @carlos-martin!

I’m not sure if you can actually set language for the message thrown from the rule but you can certainly use localisation for Lock itself. Here’s how to do it:

Hello @konrad.sopala

and thanks for the quick answer :slight_smile:

following the previous link [1] I have created a rule with the following code

function (user, context, callback) {
  if (!user.email_verified) {
    return callback(new UnauthorizedError('Please verify your email before logging in.'));
  } else {
    return callback(null, user, context);

and also I have completed all the steps at the link for Lock Internationalization that you shared.

The issue that I found is the next one:

When an user without a verified email try to login the error message displayed in the app is this one:

Please verify your email before logging in.

even if the app is in Spanish or Swedish or other language.

Debugging the Lock library, it seems that the error thrown from custom rules always generate a CredentialAuthError.customRuleFailure.

Reaching this point, I was wondering if are there any way using Lock v2 to be able to translate this kind of error message trowing from the custom rules.


I’m not aware of any method that you can apply to translate the error message thrown by the rule but I’ll ask internally and get back to you with any info I obtain!

1 Like

Unfortunately we don’t have a mechanism for that for now however it’s a good idea! I’ll suggest it to appropriate team for future addition to our product roadmap.

If you ever feel like you have another suggestion to our tech stack feel free to leave your feedback using our feedback site:

Thanks a lot for that!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.