如何更改Firebase身份验证

时间:2018-08-07 14:39:40

标签: firebase firebase-authentication

当我想在我的应用中重设密码时,我需要更改根据浏览器语言发送的消息的语言。这是我的onSubmit函数,我调用提交表单以发送消息。我从状态中获取价值,并将其放入languageCode中。我用redux

onSubmit = () => {
    let error = {}

    if (!this.state.email)
        error.email = <FormattedMessage id='common.error.empty' />

    if (Object.keys(error).length) {
        this.setState({error})

        return
    }

    this.props.languageCode(this.props.locale)

    this.props.doPasswordReset(this.state.email).then(() => {
        this.setState({openDialog: true})
    }).catch(error => {
        this.setState({
            error: {
                ...this.state.error,
                email: error.message,
            },
        })
    })
}

2 个答案:

答案 0 :(得分:1)

使用Auth的languageCode属性为用户指定语言。 Here是JS中的条目,但在iOS和Android上也可用。

答案 1 :(得分:0)

感谢@Frank van Puffelen,@ MiyoAlpízar@Frederiko Cesar感谢this questionthis question中的分析者

  

Firebase的错误消息是针对应用程序开发人员的,因此只有英文。尽管我们希望提供与提供文档时所使用的语言相同的语言,但绝不会涵盖您用户的所有语言。

     

因此,您将必须检测代码中的错误,将错误记录到可检查问题的中央系统中,然后向用户显示本地化的错误消息。

     

据我所知,Angular中没有标准化的方法。但是,如果有,它将与Firebase无关。