Sha256: 8337a7979258320e923affd7015ac8e0d93b4182cb128cf44322fc8490dfd1fc

Contents?: true

Size: 1007 Bytes

Versions: 19

Compression:

Stored size: 1007 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"

Alternatively, you can use the
{rodauth-i18n}[https://github.com/janko/rodauth-i18n] gem.

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rodauth-2.36.0 doc/guides/i18n.rdoc
rodauth-2.34.0 doc/guides/i18n.rdoc
rodauth-2.33.0 doc/guides/i18n.rdoc
rodauth-2.32.0 doc/guides/i18n.rdoc
rodauth-2.31.0 doc/guides/i18n.rdoc
rodauth-2.30.0 doc/guides/i18n.rdoc
rodauth-2.29.0 doc/guides/i18n.rdoc
rodauth-2.28.0 doc/guides/i18n.rdoc
rodauth-2.27.0 doc/guides/i18n.rdoc
rodauth-2.26.1 doc/guides/i18n.rdoc
rodauth-2.26.0 doc/guides/i18n.rdoc
rodauth-2.25.0 doc/guides/i18n.rdoc
rodauth-2.24.0 doc/guides/i18n.rdoc
rodauth-2.23.0 doc/guides/i18n.rdoc
rodauth-2.22.0 doc/guides/i18n.rdoc
rodauth-2.21.0 doc/guides/i18n.rdoc
rodauth-2.20.0 doc/guides/i18n.rdoc
rodauth-2.19.0 doc/guides/i18n.rdoc
rodauth-2.18.0 doc/guides/i18n.rdoc