目前我正在開發一個應用程序。我的用戶註冊使用了recaptcha插件。 當驗證碼是錯誤的,應用程序獲得誤差:什麼是翻譯標籤來翻譯Recaptcha錯誤消息
- 不正確,驗證碼溶膠
如何翻譯與I18n.t
此消息?
目前我正在開發一個應用程序。我的用戶註冊使用了recaptcha插件。 當驗證碼是錯誤的,應用程序獲得誤差:什麼是翻譯標籤來翻譯Recaptcha錯誤消息
如何翻譯與I18n.t
此消息?
嗯
我找到了一個解決方案,把這種消息 n個Recaptcha文檔頁面。
verify_recaptcha方法提供:消息選項 但這不適用於我。
respond_to do |format|
if verify_recaptcha(:model => @post, :message => 'Oh! It's error with reCAPTCHA!') && @post.save
# ...
else
# ...
end
end
我覆蓋了flash消息。 (Thx至slobodan)
respond_to do |format|
if verify_recaptcha
# ...
else
flash[:recaptcha_error] = I18n.t("defaults.recaptcha")
# ...
end
end
的Recaptcha v0.3.4不平移誤差:https://github.com/ambethia/recaptcha/blob/043cec2b64646ec270f2b30cfc55da661145e3ae/lib/recaptcha/verify.rb
這是固定在主分支。