Translate with i18n gem¶ ↑
Rodauth
allows transforming user-facing text configuration such as flash messages, validation errors, labels etc. via the translate
configuration method. This method receives a name of a configuration along with its default value, and is expected to return the result text.
You can use this to perform translations using the i18n gem:
plugin :rodauth do enable :login, :logout, :reset_password translate do |key, default| I18n.translate("rodauth.#{key}") || default end end
Your translation file may then look something like this:
en: rodauth: login_notice_flash: "You have been signed in" require_login_error_flash: "Login is required for accessing this page" no_matching_login_message: "user with this email address doesn't exist" reset_password_email_subject: "Password Reset Instructions"
Alternatively, you can use the rodauth-i18n gem.