Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Extended by:
GetText::Rails
Includes:
GetText::Rails
Defined in:
lib/gettext/rails.rb

Constant Summary collapse

@@error_message_title =
nil
@@error_message_explanation =
nil

Constants included from GetText::Rails

GetText::Rails::Rails

Constants included from GetText

GetText::VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GetText::Rails

_bindtextdomain, bindtextdomain, bindtextdomain_to, callersrc, use_localized_templates, use_localized_templates?

Methods included from GetText

N_, #Nn_, _, #add_default_locale_path, bindtextdomain, callersrc, cgi, cgi=, charset=, create_mofiles, gettext, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_charset, set_locale, set_output_charset, setlocale, sgettext, textdomain, update_pofiles

Class Method Details

.columnsObject



208
209
210
211
212
213
214
215
216
217
# File 'lib/gettext/rails.rb', line 208

def self.columns
  unless @columns
	@columns = connection.columns(table_name, "#{name} Columns")
	@columns.each {|column| 
	  column.table_class = self
	  column.primary = column.name == primary_key
	}
  end
  @columns
end

.set_error_message_explanation(msg, plural_msg = nil) ⇒ Object

call-seq: set_error_message_explanation(msg)

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]



225
226
227
228
229
230
231
232
233
# File 'lib/gettext/rails.rb', line 225

def self.set_error_message_explanation(msg, plural_msg = nil)
  if msg.kind_of? Array
    single_msg = msg[0]
    plural_msg = msg[1]
  else
    single_msg = msg
  end
  @@error_message_explanation = [single_msg, plural_msg]
end

.set_error_message_title(msg, plural_msg = nil) ⇒ Object

call-seq: set_error_message_title(msg)

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]



198
199
200
201
202
203
204
205
206
# File 'lib/gettext/rails.rb', line 198

def self.set_error_message_title(msg, plural_msg = nil)
  if msg.kind_of? Array
    single_msg = msg[0]
    plural_msg = msg[1]
  else
    single_msg = msg
  end
  @@error_message_title = [single_msg, plural_msg]
end

Instance Method Details

#error_message_explanationObject

:nodoc:



242
243
244
245
246
247
248
# File 'lib/gettext/rails.rb', line 242

def error_message_explanation #:nodoc:
  if @@error_message_explanation
	[_(@@error_message_explanation[0]), _(@@error_message_explanation[1])]
  else
	nil
  end
end

#error_message_titleObject

:nodoc:



235
236
237
238
239
240
241
# File 'lib/gettext/rails.rb', line 235

def error_message_title #:nodoc:
  if @@error_message_title
	[_(@@error_message_title[0]), _(@@error_message_title[1])]
  else
	nil
  end
end

#gettext(str) ⇒ Object

:nodoc:



250
251
252
# File 'lib/gettext/rails.rb', line 250

def gettext(str)  #:nodoc:
  _(str)
end