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
GetText::CACHE_BOUND_TARGET_MAX_SIZE, GetText::VERSION
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=, clear_cache, create_mofiles, current_textdomain_info, each_textdomain, find_targets, gettext, included, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, #npgettext, ns_, nsgettext, output_charset, output_charset=, p_, pgettext, remove_all_textdomains, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_locale, set_locale_all, set_output_charset, setlocale, sgettext, textdomain, #textdomain_to, update_pofiles
Class Method Details
.columns_with_gettext ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/gettext/active_record.rb', line 184 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]
222 223 224 |
# File 'lib/gettext/active_record.rb', line 222 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]
208 209 210 |
# File 'lib/gettext/active_record.rb', line 208 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
167 168 169 170 171 |
# File 'lib/gettext/active_record.rb', line 167 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
175 176 177 178 |
# File 'lib/gettext/active_record.rb', line 175 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.
156 157 158 |
# File 'lib/gettext/active_record.rb', line 156 def untranslate_all @@gettext_untranslate[self] = true end |
.untranslate_all? ⇒ Boolean
Returns true if “untranslate_all” is called. Otherwise false.
161 162 163 |
# File 'lib/gettext/active_record.rb', line 161 def untranslate_all? @@gettext_untranslate[self] end |
.untranslate_data ⇒ Object
:nodoc:
180 181 182 |
# File 'lib/gettext/active_record.rb', line 180 def untranslate_data #:nodoc: [@@gettext_untranslate[self], @@gettext_untranslate_columns[self] || []] end |