Module: I18n

Extended by:
GetText
Defined in:
lib/gettext_activerecord/i18n.rb

Overview

lib/gettext_activerecord/i18n.rb - GetText for ActiveRecord’s I18n.

Copyright (C) 2009 Masao Mutoh

You may redistribute it and/or modify it under the same
license terms as Ruby or LGPL.

Class Method Summary collapse

Methods included from GetText

update_pofiles, update_pofiles_org

Class Method Details

.translate_with_gettext_activerecord(key, options = {}) ⇒ Object Also known as: t_with_gettext_activerecord

gettext_activerecord doesn’t define backend. So it can be used with another backend.



14
15
16
17
18
19
20
21
# File 'lib/gettext_activerecord/i18n.rb', line 14

def translate_with_gettext_activerecord(key, options = {}) #:nodoc:
  if options[:scope] == [:activerecord, :errors]
    options[:attribute] = key.to_s.split(".")[3]
    options   # This value will be used in ActiveRecord::Base::Errors.localize_error_messages
  else
    translate_without_gettext_activerecord(key, options)
  end
end