gpt4 book ai didi

firebase - 如何更改在 Firebase 身份验证中发送的消息的语言

转载 作者:行者123 更新时间:2023-12-05 08:41:11 26 4
gpt4 key购买 nike

当我想在我的应用程序中重置密码时,我需要根据浏览器的语言更改发送消息的语言。这是我的 onSubmit 函数,我在提交表单时调用它来发送消息。我从状态中获取值(value)并将其放入语言代码中。我用的是 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,
},
})
})
}

最佳答案

感谢@Frank van Puffelen、@Miyo Alpízar @Frederiko Cesar 在 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.

关于firebase - 如何更改在 Firebase 身份验证中发送的消息的语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51729482/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com