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.
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:
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!
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: