本文整理汇总了Golang中github.com/beego/i18n.Locale.Tr方法的典型用法代码示例。如果您正苦于以下问题:Golang Locale.Tr方法的具体用法?Golang Locale.Tr怎么用?Golang Locale.Tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/beego/i18n.Locale
的用法示例。
在下文中一共展示了Locale.Tr方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SendRegisterMail
// Send user register mail with active code
func SendRegisterMail(locale i18n.Locale, user *User) {
code := CreateUserActiveCode(user, nil)
subject := locale.Tr("Verify you email address.")
body := locale.Tr("code: %s", code)
msg := NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send register mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例2: SendActiveMail
// Send email verify active email.
func SendActiveMail(locale i18n.Locale, user *User) {
code := CreateUserActiveCode(user, nil)
subject := locale.Tr("mail.verify_your_email_subject")
body := locale.Tr("code: %s", code)
msg := NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send email verify mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例3: SendResetPwdMail
// Send user reset password mail with verify code
func SendResetPwdMail(locale i18n.Locale, user *User) {
code := CreateUserResetPwdCode(user, nil)
subject := locale.Tr("mail.reset_passowrd_subject")
body := locale.Tr("code: %s", code)
msg := NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send reset password mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例4: SendActiveMail
// Send email verify active email.
func SendActiveMail(locale i18n.Locale, user *models.User) {
code := CreateUserActiveCode(user, nil)
subject := locale.Tr("mail.verify_your_email_subject")
data := mailer.GetMailTmplData(locale.Lang, user)
data["Code"] = code
body := utils.RenderTemplate("mail/auth/active_email.html", data)
msg := mailer.NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send email verify mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例5: SendResetPwdMail
// Send user reset password mail with verify code
func SendResetPwdMail(locale i18n.Locale, user *models.User) {
code := CreateUserResetPwdCode(user, nil)
subject := locale.Tr("mail.reset_password_subject")
data := mailer.GetMailTmplData(locale.Lang, user)
data["Code"] = code
body := utils.RenderTemplate("mail/auth/reset_password.html", data)
msg := mailer.NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send reset password mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例6: SendRegisterMail
// Send user register mail with active code
func SendRegisterMail(locale i18n.Locale, user *User) {
code := CreateUserActiveCode(user, nil)
subject := locale.Tr("mail.register_success_subject")
data := GetMailTmplData(locale.Lang, user)
data["Code"] = code
body := utils.RenderTemplate("mail/auth/register_success.html", data)
msg := NewMailMessage([]string{user.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send register mail", user.Id)
// async send mail
mailer.SendAsync(msg)
}
示例7: SendActiveMail
//SendActiveMail sends email verify active email.
func SendActiveMail(locale i18n.Locale, u *user.User) {
serv := &userServ.UserService{}
code := serv.CreateUserActiveCode(u, nil)
subject := locale.Tr("mail.verify_your_email_subject")
data := GetMailTmplData(locale.Lang, u)
data["Code"] = code
body := utils.RenderTemplate("mail/auth/active_email.html", data)
msg := NewMailMessage([]string{u.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send email verify mail", u.Id)
// async send mail
SendAsync(msg)
}
示例8: SendResetPwdMail
// SendResetPwdMail sends user reset password mail with verify code
func SendResetPwdMail(locale i18n.Locale, u *user.User) {
serv := &userServ.UserService{}
code := serv.CreateUserResetPwdCode(u, nil)
subject := locale.Tr("mail.reset_password_subject")
data := GetMailTmplData(locale.Lang, u)
data["Code"] = code
body := utils.RenderTemplate("mail/auth/reset_password.html", data)
msg := NewMailMessage([]string{u.Email}, subject, body)
msg.Info = fmt.Sprintf("UID: %d, send reset password mail", u.Id)
// async send mail
SendAsync(msg)
}