Module: GetText::ActiveRecordParser

Module | GetText::ActiveRecordParser
In: | lib/gettext/parser/active_record.rb

### Methods

init untranslate_column?

### Included Modules

GetText

### Public Instance methods

init(config)

Sets some preferences to parse ActiveRecord files.

- config: a Hash of the config. It can takes some values below:
  - :use_classname - If true, the msgids of ActiveRecord become "ClassName|FieldName" (e.g. "Article|Title"). Otherwise the ClassName is not used (e.g. "Title"). Default is true.
  - :db_yml - the path of database.yml. Default is "config/database.yml".
  - :db_mode - the mode of the database. Default is "development"
  - :activerecord_classes - an Array of the superclass of the models. The classes should be String value. Default is ["ActiveRecord::Base"]
  - :untranslate_columns - an Array of the column names which is ignored as the msgid.
  - :adapter - the options for ActiveRecord::Base.establish_connection. If this value is set, :db_yml option is ignored.
  - :host - ditto
  - :username - ditto
  - :password - ditto
  - :database - ditto
  - :socket - ditto
  - :encoding - ditto

"ClassName|FieldName" uses GetText.sgettext. So you don‘t need to translate the left-side of "|". See <Documents for Translators for more details(www.yotabanana.com/hiki/ruby-gettext-translate.html)>.

[Source]

        # File lib/gettext/parser/active_record.rb, line 61
    61:     def init(config)
    62:       if config
    63:         config.each{|k, v|
    64:           @config[k] = v
    65:         }
    66:       end
    67:       @ar_re = /class.*(#{@config[:activerecord_classes].join("|")})/
    68:     end

untranslate_column?(klass, columnname)

[Source]

        # File lib/gettext/parser/active_record.rb, line 70
    70:     def untranslate_column?(klass, columnname)
    71:       klass.untranslate?(columnname) || @config[:untranslate_columns].include?(columnname)
    72:     end

[Validate]