當前位置: 首頁>>代碼示例>>Golang>>正文


Golang i18n.Locale類代碼示例

本文整理匯總了Golang中github.com/beego/i18n.Locale的典型用法代碼示例。如果您正苦於以下問題:Golang Locale類的具體用法?Golang Locale怎麽用?Golang Locale使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Locale類的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)
}
開發者ID:sirithink,項目名稱:beebbs,代碼行數:13,代碼來源:auth_mail.go

示例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)
}
開發者ID:thuongdinh,項目名稱:beegowebapp,代碼行數:13,代碼來源:user_mail.go

示例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)
}
開發者ID:thuongdinh,項目名稱:beegowebapp,代碼行數:13,代碼來源:user_mail.go

示例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)
}
開發者ID:JessonChan,項目名稱:wetalk,代碼行數:16,代碼來源:mail.go

示例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)
}
開發者ID:JessonChan,項目名稱:wetalk,代碼行數:16,代碼來源:mail.go

示例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)
}
開發者ID:supermouseno1,項目名稱:wetalk,代碼行數:16,代碼來源:mail_auth.go

示例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)
}
開發者ID:thanzen,項目名稱:identity,代碼行數:17,代碼來源:usermailer.go

示例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)
}
開發者ID:thanzen,項目名稱:identity,代碼行數:17,代碼來源:usermailer.go


注:本文中的github.com/beego/i18n.Locale類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。