Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Includes:
- Validations, GetText
- Defined in:
- lib/gettext/active_record.rb
Constant Summary collapse
- @@gettext_untranslate =
Hash.new(false)
- @@gettext_untranslate_columns =
{}
Constants included from GetText
Class Method Summary collapse
- .columns_with_gettext ⇒ Object
-
.set_error_message_explanation(msg, plural_msg = nil) ⇒ Object
call-seq: set_error_message_explanation(msg).
-
.set_error_message_title(msg, plural_msg = nil) ⇒ Object
call-seq: set_error_message_title(msg).
-
.untranslate(*w) ⇒ Object
Sets the untranslate columns.
-
.untranslate?(columnname) ⇒ Boolean
Returns true if the column is set “untranslate”.
-
.untranslate_all ⇒ Object
Untranslate all of the tablename/fieldnames in this model class.
-
.untranslate_all? ⇒ Boolean
Returns true if “untranslate_all” is called.
-
.untranslate_data ⇒ Object
:nodoc:.
Methods included from Validations
append_features_with_gettext, #custom_error_messages_d, included_with_gettext, real_included
Methods included from GetText
N_, #Nn_, _, #add_default_locale_path, bindtextdomain, #bindtextdomain_to, bound_target, bound_targets, cached=, cached?, cgi, cgi=, charset=, clear_cache, create_mofiles, current_textdomain_info, each_textdomain, gettext, included, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, ns_, nsgettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_charset, set_locale, set_locale_all, set_output_charset, setlocale, sgettext, textdomain, #textdomain_to, update_pofiles
Class Method Details
.columns_with_gettext ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/gettext/active_record.rb', line 156 def columns_with_gettext unless defined? @columns @columns = nil end unless @columns @columns = columns_without_gettext @columns.each {|column| column.table_class = self } end @columns end |
.set_error_message_explanation(msg, plural_msg = nil) ⇒ Object
call-seq: set_error_message_explanation(msg)
((Deprecated)) Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation instead.
Sets a your own explanation of the error message dialog.
-
msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
-
Returns: [single_msg, plural_msg]
194 195 196 |
# File 'lib/gettext/active_record.rb', line 194 def (msg, plural_msg = nil) ActionView::Helpers::ActiveRecordHelper::L10n.(msg, plural_msg) end |
.set_error_message_title(msg, plural_msg = nil) ⇒ Object
call-seq: set_error_message_title(msg)
((Deprecated)) Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title instead.
Sets a your own title of error message dialog.
-
msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
-
Returns: [single_msg, plural_msg]
180 181 182 |
# File 'lib/gettext/active_record.rb', line 180 def (msg, plural_msg = nil) ActionView::Helpers::ActiveRecordHelper::L10n.(msg, plural_msg) end |
.untranslate(*w) ⇒ Object
Sets the untranslate columns. (e.g.) untranslate :foo, :bar, :baz
139 140 141 142 143 |
# File 'lib/gettext/active_record.rb', line 139 def untranslate(*w) ary = @@gettext_untranslate_columns[self] || [] ary += w.collect{|v| v.to_s} @@gettext_untranslate_columns[self] = ary end |
.untranslate?(columnname) ⇒ Boolean
Returns true if the column is set “untranslate”. (e.g.) untranslate? :foo
147 148 149 150 |
# File 'lib/gettext/active_record.rb', line 147 def untranslate?(columnname) ary = @@gettext_untranslate_columns[self] || [] ary.include?(columnname) end |
.untranslate_all ⇒ Object
Untranslate all of the tablename/fieldnames in this model class.
128 129 130 |
# File 'lib/gettext/active_record.rb', line 128 def untranslate_all @@gettext_untranslate[self] = true end |
.untranslate_all? ⇒ Boolean
Returns true if “untranslate_all” is called. Otherwise false.
133 134 135 |
# File 'lib/gettext/active_record.rb', line 133 def untranslate_all? @@gettext_untranslate[self] end |
.untranslate_data ⇒ Object
:nodoc:
152 153 154 |
# File 'lib/gettext/active_record.rb', line 152 def untranslate_data #:nodoc: [@@gettext_untranslate[self], @@gettext_untranslate_columns[self] || []] end |