Sha256: 981255a30d0c4c373e372194e27fd93598e7fe07cac630d49aaeaba04e7aa1f2

Contents?: true

Size: 916 Bytes

Versions: 16

Compression:

Stored size: 916 Bytes

Contents

= 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}[https://github.com/ruby-i18n/i18n]:

  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"

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rodauth-2.17.0 doc/guides/i18n.rdoc
rodauth-2.16.0 doc/guides/i18n.rdoc
rodauth-2.15.0 doc/guides/i18n.rdoc
rodauth-2.14.0 doc/guides/i18n.rdoc
rodauth-2.13.0 doc/guides/i18n.rdoc
rodauth-2.12.0 doc/guides/i18n.rdoc
rodauth-2.11.0 doc/guides/i18n.rdoc
rodauth-2.10.0 doc/guides/i18n.rdoc
rodauth-2.9.0 doc/guides/i18n.rdoc
rodauth-2.8.0 doc/guides/i18n.rdoc
rodauth-2.7.0 doc/guides/i18n.rdoc
rodauth-2.6.0 doc/guides/i18n.rdoc
rodauth-2.5.0 doc/guides/i18n.rdoc
rodauth-2.4.0 doc/guides/i18n.rdoc
rodauth-2.3.0 doc/guides/i18n.rdoc
rodauth-2.2.0 doc/guides/i18n.rdoc