firebase authentication error in other languages
Firebase errors are not localized. You could request a feature for this via Firebase support.
What you could do instead is create your own localized messages based on the error codes provided. This is what FirebaseUI does:
FirebaseUI-ios
FirebaseUI-web
Or you could just simply use FirebaseUI-ios. It would save you a lot of time and effort.
how to translate the error code from Firebase Authentication?
The following line of code:
exception.getMessage();
Gets the exception message in english while the following line of code:
exception.getLocalizedMessage();
Gets a localized message. According to the official documentation regarding Throwable's getLocalizedMessage() method:
Creates a localized description of this throwable. Subclasses may override this method in order to produce a locale-specific message. For subclasses that do not override this method, the default implementation returns the same result as getMessage().
How to change the language of the message sent in Firebase auth
thanks for @Frank van Puffelen, @Miyo Alpízar @Frederiko Cesar for thier anser in this question & this question
Firebase's error message are targeted at application developers, so are in English only. While we'd love to provide them in the same languages as we provide our documentation in, that will never cover all the languages of your users.
So you will have to detect the error in your code, log the error to a central system where you can inspect the problem and then show a localized error message to your user.
As far as I know there is no standardized way of doing that in Angular. But if there is, it'll be unrelated to Firebase.
How to properly display Firebase Auth error to user using Toast and Typescript?
The err
object has a code
property that you check check in your code, and a message
property that you can display to the user.
So:
...
} catch (err) {
toast.show({
title: 'Cannot sign-up an account.',
status: 'error',
description: err.message,
});
}
See the Firebase documentation on sending a password reset email that has an example of accessing these two properties.
Also see:
- Firebase error messages in different languages?
- list of all auth/ errors for firebase web API
- Does Firebase Auth return an Error Code if authentification is not successful?
How can I use firebase's language code (myFirebase.auth().languageCode) in my action link URL in Firebase Authentication email template?
In case if anyone of you guys wonders what I did.
So, I wrote a feature request to Firebase support and this was the last email I got from their support team.
Hello Erwin
Unfortunately there is no more customization but the one that I've shared with you, however I made sure to raise a feature request, asking to add more customization features to the email action links and handlers
Our engineers will certainly consider adding this to Firebase Authentication, keep an eye on the Firebase Release Notes to be informed of the latest from Firebase. Thanks again for sharing your thoughts!
Please write back if you have any other consult.
Cheers, X
At this point of time, I am still relying on the workaround solution that I have mentioned in my question. Hope it helps!
Related Topics
Get Section Number in Custom Cell Button Action
Sirikit, How to Display Response for Start Workout Intent
Firebase: Provided Bucket Does Not Match the Storage Bucket of the Current Instance in Swift
Ios11 Uibarbuttonitem Not Working
Crashing While Collection View Cell Deletion Because of "Uicollectionviewlayoutattributes"
Why Is My Admob Interstitial Working Fine in Xcode Simulator But Not on My Test Devices
How to Find the Index of a Tuple Element from an Tuple Array? iOS, Swift
How to Get Camera Calibration Data on iOS? Aka Avcameracalibrationdata
Why Obj-C Instance Have 1 Retain Count Just Created
How to Catch Accessibility Focus Changed
Uicollectionviewcontroller Error in Swift 3.0: Must Be Initialized with a Non-Nil Layout Parameter
Swift and Nsuserdefaults - Exc_Bad_Instruction When User Defaults Empty
Swift: Nil Is Incompatible with Return Type String
iOS How to Restart App for Changing Language Swift 4
How to Detect Which Image Has Been Tapped in Swift
How to Go Back to Rootviewcontroller from Presentview Controller