Initial commit of foodsoft 2

This commit is contained in:
Benjamin Meichsner 2009-01-06 11:49:19 +01:00
commit 5b9a7e05df
657 changed files with 70444 additions and 0 deletions

View file

@ -0,0 +1,7 @@
* revision 8: Changed has_many :dependent => true to :dependent => :destroy for Rails 1.2.2
+ Thanks Josh Martin
Added an order clause in the has_many relationship.
Made comment column type to text from string in migration example in README
+ Thanks Patrick Crowley
Added this CHANGELOG file.

View file

@ -0,0 +1,20 @@
Copyright (c) 2006 Cosmin Radoi
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,59 @@
Acts As Commentable
=================
Allows for comments to be added to multiple and different models.
== Resources
Install
* Run the following command:
script/plugin install http://juixe.com/svn/acts_as_commentable
* Create a new rails migration and add the following self.up and self.down methods
def self.up
create_table "comments", :force => true do |t|
t.column "title", :string, :limit => 50, :default => ""
t.column "comment", :text, :default => ""
t.column "created_at", :datetime, :null => false
t.column "commentable_id", :integer, :default => 0, :null => false
t.column "commentable_type", :string, :limit => 15, :default => "", :null => false
t.column "user_id", :integer, :default => 0, :null => false
end
add_index "comments", ["user_id"], :name => "fk_comments_user"
end
def self.down
drop_table :comments
end
== Usage
* Make you ActiveRecord model act as commentable.
class Model < ActiveRecord::Base
acts_as_commentable
end
* Add a comment to a model instance
model = Model.new
comment = Comment.new
comment.comment = 'Some comment'
model.comments << comment
* Each comment reference commentable object
model = Model.find(1)
model.comments.get(0).commtable == model
== Credits
Xelipe - This plugin is heavily influced by Acts As Tagglable.
== More
http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/
http://www.juixe.com/projects/acts_as_commentable

View file

@ -0,0 +1,3 @@
# Include hook code here
require 'acts_as_commentable'
ActiveRecord::Base.send(:include, Juixe::Acts::Commentable)

View file

@ -0,0 +1 @@
# Install hook code here

View file

@ -0,0 +1,62 @@
# ActsAsCommentable
module Juixe
module Acts #:nodoc:
module Commentable #:nodoc:
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def acts_as_commentable
has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at ASC'
include Juixe::Acts::Commentable::InstanceMethods
extend Juixe::Acts::Commentable::SingletonMethods
end
end
# This module contains class methods
module SingletonMethods
# Helper method to lookup for comments for a given object.
# This method is equivalent to obj.comments.
def find_comments_for(obj)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
Comment.find(:all,
:conditions => ["commentable_id = ? and commentable_type = ?", obj.id, commentable],
:order => "created_at DESC"
)
end
# Helper class method to lookup comments for
# the mixin commentable type written by a given user.
# This method is NOT equivalent to Comment.find_comments_for_user
def find_comments_by_user(user)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
Comment.find(:all,
:conditions => ["user_id = ? and commentable_type = ?", user.id, commentable],
:order => "created_at DESC"
)
end
end
# This module contains instance methods
module InstanceMethods
# Helper method to sort comments by date
def comments_ordered_by_submitted
Comment.find(:all,
:conditions => ["commentable_id = ? and commentable_type = ?", id, self.type.name],
:order => "created_at DESC"
)
end
# Helper method that defaults the submitted time.
def add_comment(comment)
comments << comment
end
end
end
end
end

View file

@ -0,0 +1,34 @@
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
# NOTE: install the acts_as_votable plugin if you
# want user to vote on the quality of comments.
#acts_as_voteable
# NOTE: Comments belong to a user
belongs_to :user
# Helper class method to lookup all comments assigned
# to all commentable types for a given user.
def self.find_comments_by_user(user)
find(:all,
:conditions => ["user_id = ?", user.id],
:order => "created_at DESC"
)
end
# Helper class method to look up all comments for
# commentable class name and commentable id.
def self.find_comments_for_commentable(commentable_str, commentable_id)
find(:all,
:conditions => ["commentable_type = ? and commentable_id = ?", commentable_str, commentable_id],
:order => "created_at DESC"
)
end
# Helper class method to look up a commentable object
# given the commentable class name and id
def self.find_commentable(commentable_str, commentable_id)
commentable_str.constantize.find(commentable_id)
end
end

View file

@ -0,0 +1,4 @@
# desc "Explaining what the task does"
# task :acts_as_commentable do
# # Task goes here
# end

View file

@ -0,0 +1,8 @@
require 'test/unit'
class ActsAsCommentableTest < Test::Unit::TestCase
# Replace this with your real tests.
def test_this_plugin
flunk
end
end

View file

@ -0,0 +1,20 @@
Copyright (c) 2006 Jacob Radford
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,94 @@
= acts_as_configurable
This mixin adds a number of methods to an ActiveRecord module which
enable saving any settings you want (see examples below).
ActiveRecord is required.
== Install
./script/plugin install http://svn.nkryptic.com/plugins/acts_as_configurable
== Usage
This mixin will provide your model with a large variety of configuration options.
class User < ActiveRecord::Base
acts_as_configurable
end
Example:
user = User.create(:name => 'joe')
user.settings # => []
user.settings[:friends] = ['jane','sam','karl']
user.settings[:friends] # => ['jane','sam','karl']
user.settings[:age] = 25
user.settings[:age] # => 25
OR
user = User.create(:name => 'joe')
post = Post.find(:first)
user.settings_for(post) # => []
user.settings_for(post)[:show_headlines] = true
user.settings_for(post)[:show_headlines] # => true
user.settings_for(post).size # => 1
# but the user's untargeted settings are still empty
user.settings # => []
update: now there is a method each_with_key
user.settings.each_with_key {|k,s| do something} # k is the key (a string) and s is the setting
and
user.settings_for(post).each_with_key {|k,s| do something} # k is the key (a string) and s is the setting
This mixin will provide your model with the ability to see where it is used as a target of acts_as_configurable
class Post < ActiveRecord::Base
acts_as_configurable_target
end
Example:
user = User.create(:name => 'joe')
post = Post.find(:first)
user.settings_for(post) # => []
user.settings_for(post)[:num_lines] = 15
user.settings_for(post)[:num_lines] # => 15
post.targeted_settings[:num_lines].size # => 1
post.targeted_settings[:num_lines].first # => 15
post.targeted_settings[:num_lines].first.owner # => user
OR
user = User.create(:name => 'joe')
post = Post.find(:first)
user.settings_for(post) # => []
user.settings_for(post)[:num_lines] = 15
user.settings_for(post)[:num_lines] # => 15
user.settings_for(post)[:hide_comments] # => true
post.targeted_settings_for(user)[:num_lines] # => 15
post.targeted_settings_for(user) # => [15,true]
post.targeted_settings_for(user).collect {|x| x.name} # => ['num_lines','hide_comments']
== Subversion
http://svn.nkryptic.com/plugins/acts_as_configurable
== Credits
I was insprired by the following people/works
* Rick Olson - acts_as_versioned plugin (plugin design)
* Bill Katz - authorization plugin (roles applied to any model)
* Tobias Luetke - Typo (configuration settings manager with ruby-typing of value)
* Rails core - AssociationCollection and AssociationProxy classes

View file

@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the acts_as_configurable plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the acts_as_configurable plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ActsAsConfigurable'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

View file

@ -0,0 +1,5 @@
require 'acts_as_configurable'
ActiveRecord::Base.send(:include, Nkryptic::ActsAsConfigurable)
require 'configurable_setting'

View file

@ -0,0 +1 @@
puts IO.read(File.join(File.dirname(__FILE__), 'README'))

View file

@ -0,0 +1,497 @@
module Nkryptic # :nodoc:
module ActsAsConfigurable #:nodoc:
def self.included(base) # :nodoc:
base.extend ClassMethods
end
# These methods will be available to any ActiveRecord::Base descended model.
module ClassMethods
# == Acts As Configurable
# requirements::
# model descended from ActiveRecord::Base
# configurable_settings table has been created
#
# class User < ActiveRecord::Base
# acts_as_configurable
# end
#
# This mixin will provide your model with a large variety of configuration options.
#
# see:: settings and settins_for
#
def acts_as_configurable(options = {})
# don't allow multiple calls
return if self.included_modules.include?(Nkryptic::ActsAsConfigurable::InstanceMethods)
send :include, Nkryptic::ActsAsConfigurable::InstanceMethods
cattr_accessor :defaults
self.defaults = (options.class == Hash ? options : {}).with_indifferent_access
has_many :_configurable_settings,
:as => :configurable,
:class_name => 'ConfigurableSetting',
:dependent => :destroy
end
# == Acts As Configurable Target
# requirements::
# model descended from ActiveRecord::Base
# configurable_settings table has been created
#
# class User < ActiveRecord::Base
# acts_as_configurable_target
# end
#
# This mixin will provide your model with the ability to see where it is used as a target of acts_as_configurable
#
# see:: targetable_settings and targetable_settings_for
#
def acts_as_configurable_target(options = {})
return if self.included_modules.include?(Nkryptic::ActsAsConfigurable::TargetInstanceMethods)
send :include, Nkryptic::ActsAsConfigurable::TargetInstanceMethods
has_many :_targetable_settings,
:as => :targetable,
:class_name => 'ConfigurableSetting',
:dependent => :destroy
end
end
module InstanceMethods
def self.included(base) # :nodoc:
base.extend Nkryptic::ActsAsConfigurable::InstanceMethods::ClassMethods
end
# * specify any setting you want for an instance of a model
#
# Example:
#
# user = User.create(:name => 'joe')
# user.settings # => []
#
# user.settings[:friends] = ['jane','sam','karl']
# user.settings[:friends] # => ['jane','sam','karl']
# user.settings[:age] = 25
# user.settings[:age] # => 25
#
def settings
@general_settings ||= ConfigurableSettings.new(self)
end
# * specify any setting you want for an instance of a model targeting another object
#
# Example:
#
# user = User.create(:name => 'joe')
# post = Post.find(:first)
#
# user.settings_for(post) # => []
# user.settings_for(post)[:show_headlines] = true
#
# user.settings_for(post)[:show_headlines] # => true
# user.settings_for(post).size # => 1
#
# # but the user's untargeted settings are still empty
# user.settings # => []
#
def settings_for(obj)
if obj.is_a? Class
# wire the settings object to only deal with settings targeting this class obj
variable_name = "settings_for_class_#{obj.name}"
else
# wire the settings object to only deal with settings targeting this instance obj
variable_name = "settings_for_#{obj.class}_#{obj.id}"
end
settings_obj = instance_variable_get("@#{variable_name}")
settings_obj = instance_variable_set("@#{variable_name}",ConfigurableSettings.new(self, obj)) if settings_obj.nil?
settings_obj
end
# These are class methods that are mixed in with the model class.
module ClassMethods # :nodoc:
end
end
module TargetInstanceMethods
def self.included(base) # :nodoc:
base.extend Nkryptic::ActsAsConfigurable::TargetInstanceMethods::ClassMethods
end
# * specify any setting you want for an instance of a model targeting another object
#
# Example:
#
# user = User.create(:name => 'joe')
# post = Post.find(:first)
#
# user.settings_for(post) # => []
# user.settings_for(post)[:num_lines] = 15
#
# user.settings_for(post)[:num_lines] # => 15
# post.targeted_settings[:num_lines].size # => 1
# post.targeted_settings[:num_lines].first # => 15
# post.targeted_settings[:num_lines].first.owner # => user
#
def targeted_settings
@targeted_settings ||= TargetedSettings.new(self)
end
# * specify any setting you want for an instance of a model targeting another object
#
# Example:
#
# user = User.create(:name => 'joe')
# post = Post.find(:first)
#
# user.settings_for(post) # => []
# user.settings_for(post)[:num_lines] = 15
#
# user.settings_for(post)[:num_lines] # => 15
# user.settings_for(post)[:hide_comments] # => true
# post.targeted_settings_for(user)[:num_lines] # => 15
# post.targeted_settings_for(user) # => [15,true]
# post.targeted_settings_for(user).collect {|x| x.name} # => ['num_lines','hide_comments']
#
def targeted_settings_for(obj)
if obj.is_a? Class
# wire the targeted_settings object to only deal with settings targeting this class obj
variable_name = "targeted_settings_for_class_#{obj.name}"
else
# wire the targeted_settings object to only deal with settings targeting this instance obj
variable_name = "targeted_settings_for_#{obj.class}_#{obj.id}"
end
settings_obj = instance_variable_get("@#{variable_name}")
settings_obj = instance_variable_set("@#{variable_name}",TargetedSettings.new(self, obj)) if settings_obj.nil?
settings_obj
end
# These are class methods that are mixed in with the model class.
module ClassMethods # :nodoc:
end
end
class ProxySettings # :nodoc:
alias_method '__class', 'class'
instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$)/ }
#class_inheritable_accessor(:sql_word)
def initialize(source, reference=nil)
@source = source
@reference = reference
true
end
def real_class
__class
end
def settings
@source.send(@settings)
end
def to_ary
find_settings.collect do |x|
ProxySetting.new(x)
end
end
def responds_to?(what)
settings.responds_to?(what)
end
def ==(what)
find_settings == what
end
def size
find_settings.size
end
def inspect
find_settings.inspect
end
def each(&block)
find_settings.each do |x|
yield ProxySetting.new(x)
end
end
def each_with_key(&block)
find_settings.each do |x|
yield(x.name, ProxySetting.new(x))
end
end
def select(&block)
find_settings.select do |x|
yield ProxySetting.new(x)
end
end
def reject(&block)
find_settings.reject do |x|
yield ProxySetting.new(x)
end
end
def collect(&block)
find_settings.collect do |x|
yield ProxySetting.new(x)
end
end
def has_key?(name)
name = name.to_s
setting = find_setting(name)
if setting.nil?
false
else
if setting.is_a? Array
setting.size == 0 ? false : true
else
true
end
end
end
def [](name)
name = name.to_s
setting = find_setting(name)
return nil if setting.nil?
if setting.is_a? Array
setting.collect {|x| ProxySetting.new(x)}
else
ProxySetting.new(setting)
end
end
def []=(name, value)
name = name.to_s
setting = find_setting(name)
if setting.is_a? Array
setting.collect do |x|
x.value_type = value.class.to_s
x.value = value.to_yaml
x.save
ProxySetting.new(x)
end
else
if setting.nil?
setting = create_setting(name)
end
setting.value_type = value.class.to_s
setting.value = value.to_yaml
setting.save
ProxySetting.new(setting)
end
end
private
def find_settings; nil end
def find_setting(name); nil end
def create_setting(name); nil end
def method_missing(method, *args, &block)
settings.send(method, *args, &block)
end
end
class ConfigurableSettings < ProxySettings # :nodoc:
def initialize(source, reference=nil)
super
@settings = '_configurable_settings'
@@sql_word = "targetable"
true
end
private
def find_settings
if @reference.is_a? Class
settings.find( :all,
:conditions => [ "#{@@sql_word}_type = ? and #{@@sql_word}_id IS NULL", @reference.to_s ] )
elsif @reference
settings.find( :all,
:conditions => [ "#{@@sql_word}_type = ? and #{@@sql_word}_id = ?", @reference.class.to_s, @reference.id ] )
else
settings.find( :all,
:conditions => [ "#{@@sql_word}_type is null and #{@@sql_word}_id is null" ] )
end
end
def find_setting(name)
if @reference.is_a? Class
settings.find( :first,
:conditions => [ "name = ? and #{@@sql_word}_type = ? and #{@@sql_word}_id IS NULL", name, @reference.to_s ] )
elsif @reference
settings.find( :first,
:conditions => [ "name = ? and #{@@sql_word}_type = ? and #{@@sql_word}_id = ?", name, @reference.class.to_s, @reference.id ] )
else
settings.find( :first,
:conditions => [ "name = ? and #{@@sql_word}_type is null and #{@@sql_word}_id is null", name ] )
end
end
def create_setting(name)
if @reference.is_a? Class
settings.create( :name => name, "#{@@sql_word}_type" => @reference.to_s )
elsif @reference
settings.create( :name => name, "#{@@sql_word}_type" => @reference.class.to_s, "#{@@sql_word}_id" => @reference.id )
else
settings.create( :name => name )
end
end
end
class TargetedSettings < ProxySettings # :nodoc:
def initialize(target, owner=nil)
super
@settings = '_targetable_settings'
@@sql_word = "configurable"
true
end
private
def find_settings
if @reference.is_a? Class
settings.find( :all,
:conditions => [ "#{@@sql_word}_type = ? and #{@@sql_word}_id IS NULL", @reference.to_s ] )
elsif @reference
settings.find( :all,
:conditions => [ "#{@@sql_word}_type = ? and #{@@sql_word}_id = ?", @reference.class.to_s, @reference.id ] )
else
settings.find( :all )
end
end
def find_setting(name)
if @reference.is_a? Class
settings.find( :first,
:conditions => [ "name = ? and #{@@sql_word}_type = ? and #{@@sql_word}_id IS NULL", name, @reference.to_s ] )
elsif @reference
settings.find( :first,
:conditions => [ "name = ? and #{@@sql_word}_type = ? and #{@@sql_word}_id = ?", name, @reference.class.to_s, @reference.id ] )
else
settings.find( :all,
:conditions => [ "name = ?", name ] )
end
end
def create_setting(name)
if @reference.is_a? Class
settings.create( :name => name, "#{@@sql_word}_type" => @reference.to_s )
elsif @reference
settings.create( :name => name, "#{@@sql_word}_type" => @reference.class.to_s, "#{@@sql_word}_id" => @reference.id )
end
end
end
class ProxySetting # :nodoc:
alias_method '__class', 'class'
instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$)/ }
def initialize(setting)
@_setting = setting
true
end
def real_class
ProxySetting
end
def target
unless @_setting.targetable_type.blank? or @_setting.targetable_id.blank?
ConfigurableSetting.find_targetable(@_setting.targetable_type, @_setting.targetable_id)
else
nil
end
end
def owner
unless @_setting.configurable_type.blank? or @_setting.configurable_id.blank?
ConfigurableSetting.find_configurable(@_setting.configurable_type, @_setting.configurable_id)
else
nil
end
end
def []=(name, val)
obj = self.value
if obj.responds_to? '[]='
obj[name] = val
self.value = obj
self.save
else
method_missing('[]=', [name,val])
end
end
def delete(name)
obj = self.value
if obj.responds_to? 'delete'
obj.delete(name)
self.value = obj
self.save
else
method_missing('delete', [name,val])
end
end
def save
@_setting.save
end
protected
def value
@value ||= YAML.load(@_setting.value)
end
def value=(val)
@value = val
self.set_value
end
def set_value
@_setting.value_type = @value.class.to_s
@_setting.value = @value.to_yaml
end
private
def method_missing(method, *args, &block)
return_value = self.value.send(method, *args, &block)
if @value != YAML.load(@_setting.value)
STDERR.puts "#{method} called with args #{args} for ProxySetting"
self.set_value
end
return_value
end
end
end
end

View file

@ -0,0 +1,50 @@
# this is the base class of all configurable settings
class ConfigurableSetting < ActiveRecord::Base
belongs_to :configurable, :polymorphic => true
belongs_to :targetable, :polymorphic => true
# ==For migration up
# in your migration self.up method:
# <tt>ConfigurableSetting.create_table</tt>
def self.create_table
self.connection.create_table :configurable_settings, :options => 'ENGINE=InnoDB' do |t|
t.column :configurable_id, :integer
t.column :configurable_type, :string
t.column :targetable_id, :integer
t.column :targetable_type, :string
t.column :name, :string, :null => false
t.column :value_type, :string
t.column :value, :text, :null => true
end
self.connection.add_index :configurable_settings, :name
end
# ==For migration down
# in your migration self.down method:
# <tt>ConfigurableSetting.drop_table</tt>
def self.drop_table
self.connection.remove_index :configurable_settings, :name
self.connection.drop_table :configurable_settings
end
# returns a string with the classname of configurable
def self.configurable_class(configurable) # :nodoc:
ActiveRecord::Base.send(:class_name_of_active_record_descendant, configurable.class).to_s
end
# returns a string with the classname of configurable
def self.targetable_class(targetable) # :nodoc:
ActiveRecord::Base.send(:class_name_of_active_record_descendant, targetable.class).to_s
end
# returns the instance of the "owner" of the setting
def self.find_configurable(configured_class, configured_id) # :nodoc:
configured_class.constantize.find(configured_id)
end
# returns the instance of the "target" of the setting
def self.find_targetable(targeted_class, targeted_id) # :nodoc:
targeted_class.constantize.find(targeted_id)
end
end

View file

@ -0,0 +1,28 @@
require 'rake/testtask'
require 'rake/rdoctask'
namespace :test do
desc "run the acts as configurable test suite"
task :acts_as_configurable do
Rake::TestTask.new(:aac_test) do |t|
t.libs << File.join(File.dirname(__FILE__), '/../lib')
t.pattern = File.join(File.dirname(__FILE__), '/../test/**/*_test.rb')
t.verbose = true
end
Rake::Task[:aac_test].invoke
end
end
namespace :doc do
desc "generate the acts as configurable rdoc files"
task :acts_as_configurable do
Rake::RDocTask.new(:aac_rdoc) do |rdoc|
rdoc.rdoc_dir = File.join(File.dirname(__FILE__), '/../rdoc')
rdoc.title = 'Acts As Configurable'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include(File.join(File.dirname(__FILE__), '/../README'))
rdoc.rdoc_files.include(File.join(File.dirname(__FILE__), '/../lib/**/*.rb'))
end
Rake::Task[:aac_rdoc].invoke
end
end

View file

@ -0,0 +1,117 @@
require 'test/unit'
require File.dirname(__FILE__) + '/test_helper'
require File.join(File.dirname(__FILE__), 'fixtures/entities')
class ActsAsConfigurableTest < Test::Unit::TestCase
fixtures :test_users, :test_groups
def setup
@group = TestGroup.create(:display_name => 'Rails Core')
@user = TestUser.create(:login => 'sam', :name => 'Sam Testuser', :email => 'sam@example.com')
end
SETTINGS = ActiveRecord::Base.const_get('ConfigurableSettings')
TARGETEDSETTINGS = ActiveRecord::Base.const_get('TargetedSettings')
PROXYSETTING = ActiveRecord::Base.const_get('ProxySetting')
USR_CFG = {
:how_many_time_i_eat_out_a_week => 4,
'what i am made of' => 'steel',
:friends => ['bob', 'ken']
}
GR_ROLES = ['creator', 'member', 'fundraiser']
def test_user_model_settings
assert_equal 'sam', @user.login
assert_equal 'Rails Core', @group.display_name
assert_equal 0, @user._configurable_settings.size
assert_equal Array, @user.settings.class
assert_equal SETTINGS, @user.settings.real_class
assert_equal 0, @user.settings.size
@user.settings[:config] = USR_CFG
assert_equal 1, @user._configurable_settings.size
assert_equal USR_CFG, @user.settings[:config]
assert_equal 1, @user.settings.size
assert_equal Hash, @user.settings[:config].class
assert_equal PROXYSETTING, @user.settings[:config].real_class
assert_equal 3, @user.settings[:config].keys.size
assert_equal 4, @user.settings[:config][:how_many_time_i_eat_out_a_week]
assert_equal Array, @user.settings[:config][:friends].class
assert_equal 2, @user.settings[:config][:friends].size
@user.settings[:my_group] = @group
assert_equal 2, @user.settings.size
assert_equal TestGroup, @user.settings[:my_group].class
end
def test_new_each_with_key
@user.settings[:config] = USR_CFG
@user.settings.each_with_key do |key, setting|
assert_equal :config.to_s, key
assert_equal USR_CFG, setting
end
end
def test_valid_raw_setting
assert ConfigurableSetting.find(:first).nil?
@user.settings[:config] = USR_CFG
first_setting = ConfigurableSetting.find(:first)
assert_equal 'config', first_setting.name
assert_equal 'TestUser', first_setting.configurable_type
assert_equal @user.id, first_setting.configurable_id
assert_equal nil, first_setting.targetable_type
assert_equal nil, first_setting.targetable_id
assert_equal USR_CFG.to_yaml, first_setting.value
end
def test_associated_settings
assert_equal [], @user.settings
assert_equal [], @user.settings_for(@group)
@user.settings_for(@group)[:roles] = GR_ROLES
assert_equal GR_ROLES, @user.settings_for(@group)[:roles]
assert_equal 1, @user.settings_for(@group).size
assert_equal 0, @user.settings.size
end
def test_associated_target_settings
assert_equal [], @group.targeted_settings
assert_equal TARGETEDSETTINGS, @group.targeted_settings.real_class
@user.settings_for(@group)[:roles] = GR_ROLES
assert_equal 1, @group._targetable_settings.size
assert_equal 1, @group.targeted_settings.size
assert_equal 1, @group.targeted_settings_for(@user).size
assert_equal GR_ROLES, @group.targeted_settings_for(@user)[:roles]
@group.targeted_settings.each do |x|
assert x.owner == @user and x.target == @group and x.name == 'roles'
end
@group.targeted_settings.each do |x|
assert x == GR_ROLES
end
@group.targeted_settings[:roles].each do |x|
assert x.owner == @user and x == GR_ROLES
end
end
end

View file

@ -0,0 +1,14 @@
class TestUser < ActiveRecord::Base
acts_as_configurable
end
class TestGroup < ActiveRecord::Base
acts_as_configurable
acts_as_configurable_target
end

View file

@ -0,0 +1,4 @@
---
test_groups_001:
id: "1"
display_name: Clan of the Cavebear

View file

@ -0,0 +1,11 @@
---
test_users_001:
name: Bob Testuser
id: "1"
login: bob
email: bob@example.com
test_users_002:
name: Ken Testuser
id: "2"
login: ken
email: ken@example.com

View file

@ -0,0 +1,28 @@
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define(:version => 0) do
create_table :configurable_settings, :force => true do |t|
t.column :configurable_id, :integer
t.column :configurable_type, :string
t.column :targetable_id, :integer
t.column :targetable_type, :string
t.column :name, :string, :default => "", :null => false
t.column :value_type, :string
t.column :value, :text
end
add_index :configurable_settings, :name
create_table :test_groups, :force => true do |t|
t.column :display_name, :string, :limit => 80
end
create_table :test_users, :force => true do |t|
t.column :login, :string, :limit => 20
t.column :name, :string, :limit => 80
t.column :email, :string
end
end
ActiveRecord::Migration.verbose = true

View file

@ -0,0 +1,30 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
require 'test/unit'
require 'active_record/fixtures'
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
load(File.dirname(__FILE__) + '/schema.rb')
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures/'
$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
class Test::Unit::TestCase #:nodoc:
def create_fixtures(*table_names)
if block_given?
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
else
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
end
end
# Turn off transactional fixtures if you're working with MyISAM tables in MySQL
self.use_transactional_fixtures = true
# Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
self.use_instantiated_fixtures = false
# Add more helper methods to be used by all tests here...
end

View file

@ -0,0 +1,27 @@
[28 September 2007]
* Refactoring.
[29 June 2007]
* Add :ignore_sti option to allow next and previous to iterate over all models.
[3 June 2007]
* Improve STI ordering
* BACKWARDS INCOMPATIBLE
To jump more than one record forward or back, pass :number => x to next or previous, not just the number.
Number defaults to 1.
Old: person.next(10)
New: person.next(:number => 10)
This allows options to be passed to the find method when the record is instantiated:
person.next(:include => :groups)
[31 Jul 2006]
* Make the plugin work with Rails 1.1, not just trunk

View file

@ -0,0 +1,20 @@
Copyright (c) 2006 Jonathan Viney
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

88
vendor/plugins/acts_as_ordered/README vendored Normal file
View file

@ -0,0 +1,88 @@
= acts_as_ordered
If you find this plugin useful, please consider a donation to show your support!
http://www.paypal.com/cgi-bin/webscr?cmd=_send-money
Email address: jonathan.viney@gmail.com
== Instructions
This plugin gives ActiveRecord models an easy way to find their neighbours in a given order.
== Resources
Install
* script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_ordered
== Usage
class Person < ActiveRecord::Base
acts_as_ordered :order => 'first_name'
end
Say you have people with first names of Adam, Jonathan and Robert:
p = Person.find_by_first_name('Jonathan')
p.next # Robert
p.previous # Adam
p.previous.previous # Adam (does not wrap around to end)
p.next.next # Robert (does not wrap around to start)
If you want the next and previous methods to wrap around the ends, use:
acts_as_ordered :order => 'first_name', :wrap => true
You can also jump by more than one at a time:
# Without wrapping (clamps to ends)
p = Person.find_by_first_name('Jonathan')
p.next(:number => 2) # Robert
p.next(:number => 100) # Robert
p.previous(:number => 100) # Jonathan
# With wrapping (wraps around ends as many times as you like)
p = Person.find_by_first_name('Jonathan')
p.next(:number => 8) # Adam
p.previous(:number => 17) # Robert
You can use this to get the next/previous model that matches some condition:
class Person < ActiveRecord::Base
acts_as_ordered :condition => proc { |p| p.age > 10 }
# Or check that a method on the model returns true
acts_as_ordered :conditions => :male?
end
In this case, the next and previous methods will return the closest adjacent object that matches the condition.
You can use this in a application to be able to quickly browse through people. Eg:
class PersonController < ApplicationController
def view_neighbour
# params[:direction] is passed off the page as 'next' or 'previous'
@person = Person.find(params[:id]).find_by_direction(params[:direction])
render :action => 'view'
end
# Or alternatively...
def view_next
@person = Person.find(params[:id]).next
render :action => 'view'
end
def view_previous
@person = Person.find(params[:id]).previous
render :action => 'view'
end
end
Problems, comments, and suggestions all welcome. jonathan.viney@gmail.com
== Credits
Atelier Fabien - Support for :scope =>
Rick Olson - I borrowed some of the testing code from acts_as_versioned

22
vendor/plugins/acts_as_ordered/Rakefile vendored Normal file
View file

@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the acts_as_ordered plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the acts_as_ordered plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Acts As Ordered'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

View file

@ -0,0 +1 @@
require 'acts_as_ordered'

View file

@ -0,0 +1,138 @@
module ActiveRecord
module Acts
module Ordered
def self.included(base)
base.extend(ClassMethods)
end
class InvalidDirection < Exception
end
module ClassMethods
def acts_as_ordered(options = {})
options.assert_valid_keys :order, :wrap, :condition, :scope, :ignore_sti
options[:order] = options[:order] ? "#{options[:order]}, #{primary_key}" : primary_key
options[:condition] = options[:condition].to_proc if options[:condition].is_a?(Symbol)
options[:scope] = "#{options[:scope]}_id".to_sym if options[:scope].is_a?(Symbol) && options[:scope].to_s !~ /_id$/
cattr_accessor :_acts_as_ordered_options
self._acts_as_ordered_options = options
include InstanceMethods
end
end
module InstanceMethods
def ordered_scope_condition
scope = self.class._acts_as_ordered_options[:scope]
return if scope.nil?
if scope.is_a?(Symbol)
{ scope => send(scope) }
else
interpolate_sql(scope)
end
end
def adjacent_id(number)
ids = ordered_ids
ids.reverse! if number < 0
index = ids.index(self.id)
if self.class._acts_as_ordered_options[:wrap]
ids[(index + number.abs) % ids.size]
else
ids[index + number.abs] || ids.last
end
end
def ordered_ids
conditions, options = [], self.class._acts_as_ordered_options
if !options[:ignore_sti] && !self.class.descends_from_active_record?
conditions << self.class.send(:type_condition)
end
unless ordered_scope_condition.blank?
conditions << self.class.send(:sanitize_sql, ordered_scope_condition)
end
sql_conditions = "WHERE #{conditions.join(') AND (')}" if conditions.any?
connection.select_values("SELECT #{self.class.primary_key} FROM #{self.class.table_name} #{sql_conditions} ORDER BY #{options[:order]}").map!(&:to_i)
end
def adjacent_record(options = {})
previous_record, number, ordered_options = self, options.delete(:number), self.class._acts_as_ordered_options
loop do
adjacent_record = self.class.base_class.find(previous_record.adjacent_id(number), options.dup)
matches = ordered_options[:condition] ? ordered_options[:condition].call(adjacent_record) : true
return adjacent_record if matches
return self if adjacent_record == self # If the search for a matching record failed
return self if previous_record == adjacent_record # If we've found the same adjacent_record twice
previous_record = adjacent_record
number = number < 0 ? -1 : 1
end
end
def current_total
self.class.base_class.count :conditions => ordered_scope_condition
end
def current_index
ordered_ids.index(id)
end
def current_position
current_index + 1
end
def next(options = {})
adjacent_record(options.reverse_merge(:number => 1))
end
def previous(options = {})
options = options.reverse_merge(:number => 1)
options[:number] = -options[:number]
adjacent_record(options)
end
def find_by_direction(direction, options = {})
direction = direction.to_s
['next', 'previous'].include?(direction) ? send(direction, options) : raise(InvalidDirection.new(direction))
end
def first?
id == first_id
end
def last?
id == last_id
end
def first
self.class.base_class.find(first_id)
end
def last
self.class.base_class.find(last_id)
end
def first_id
ordered_ids.first
end
def last_id
ordered_ids.last
end
end
end
end
end
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Ordered)

View file

@ -0,0 +1,30 @@
require 'test/unit'
begin
require File.dirname(__FILE__) + '/../../../../config/environment'
rescue LoadError
require 'rubygems'
gem 'activerecord'
require 'active_record'
end
# Search for fixtures first
fixture_path = File.dirname(__FILE__) + '/fixtures/'
Dependencies.load_paths.insert(0, fixture_path)
ActiveRecord::Base.configurations = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
ActiveRecord::Base.establish_connection(ENV['DB'] || 'mysql')
require 'active_record/fixtures'
require File.dirname(__FILE__) + '/../lib/acts_as_ordered'
load(File.dirname(__FILE__) + '/schema.rb')
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures/'
class Test::Unit::TestCase #:nodoc:
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
end

View file

@ -0,0 +1,281 @@
require File.join(File.dirname(__FILE__), 'abstract_unit')
class ActsAsOrderedTest < Test::Unit::TestCase
fixtures :cartoons
def test_normal
bugs = cartoons(:bugs)
assert_equal bugs, bugs.previous
assert_equal cartoons(:daffy), bugs.next
# No wrapping
assert_equal cartoons(:roger), bugs.next.next.next.next.next
assert_equal bugs, bugs.next.next.next.next.next.next.previous.previous.previous.previous.previous.previous
end
def test_find_by_direction
assert_equal cartoons(:bugs), cartoons(:bugs).find_by_direction(:previous)
assert_equal cartoons(:daffy), cartoons(:bugs).find_by_direction(:next)
assert_equal cartoons(:roger), cartoons(:bugs).find_by_direction(:next, :number => 5)
assert_raises(ActiveRecord::Acts::Ordered::InvalidDirection) { cartoons(:bugs).find_by_direction('destroy') }
end
def test_insert_and_remove
bugs, daffy = cartoons(:bugs), cartoons(:daffy)
assert_equal daffy, bugs.next
cat = Cartoon.create(:first_name => 'Cat', :last_name => 'in the Hat')
assert_equal cat, bugs.next
assert_equal daffy, bugs.next.next
assert_equal cat, daffy.previous
assert cat.destroy
assert_equal bugs, daffy.previous
end
def test_desc_order
bugs = reversed_cartoons(:bugs)
assert_equal bugs, bugs.next
assert_equal reversed_cartoons(:daffy), bugs.previous
end
def test_with_wrapping
elmer = wrapped_cartoons(:elmer)
assert_equal wrapped_cartoons(:roger), elmer.next
assert_equal wrapped_cartoons(:roger), elmer.previous.previous.previous
assert_equal wrapped_cartoons(:bugs), elmer.next.next
assert_equal wrapped_cartoons(:bugs), elmer.previous.previous
end
def test_jump_multiple_no_wrapping
daffy = cartoons(:daffy)
assert_equal cartoons(:roger), daffy.next(:number => 2)
assert_equal cartoons(:roger), daffy.next(:number => 100)
assert_equal cartoons(:bugs), daffy.previous(:number => 10)
end
def test_jump_multiple_with_wrapping
roger = wrapped_cartoons(:roger)
assert_equal roger, roger.previous(:number => 4)
assert_equal roger, roger.next(:number => 4)
assert_equal wrapped_cartoons(:elmer), roger.previous(:number => 9)
assert_equal wrapped_cartoons(:bugs), roger.next(:number => 13)
end
def test_with_condition
elmer = silly_cartoons(:elmer)
assert_equal silly_cartoons(:roger), elmer.next
assert_equal silly_cartoons(:roger), elmer.next(:number => 10)
assert_equal silly_cartoons(:elmer), elmer.previous
assert_equal silly_cartoons(:elmer), elmer.previous(:number => 3)
end
def test_with_condition_and_wrapping
bugs = funny_cartoons(:bugs)
assert_equal funny_cartoons(:daffy), bugs.next
assert_equal funny_cartoons(:elmer), bugs.next.next
assert_equal funny_cartoons(:bugs), bugs.next.next.next
assert_equal funny_cartoons(:bugs), bugs.next(:number => 3)
assert_equal funny_cartoons(:elmer), bugs.previous
assert_equal funny_cartoons(:daffy), bugs.previous(:number => 3)
end
def test_current_index_and_position
assert_equal 0, cartoons(:bugs).current_index
assert_equal 1, cartoons(:bugs).current_position
assert_equal 1, cartoons(:daffy).current_index
assert_equal 2, cartoons(:daffy).current_position
assert_equal 2, cartoons(:bugs).next.current_position
assert_equal 4, cartoons(:bugs).last.current_position
assert_equal 4, cartoons(:roger).current_position
end
def test_current_total
assert_equal 4, cartoons(:bugs).current_total
end
private
def find_cartoon(name, klass)
klass.find(cartoons(name).id)
end
def wrapped_cartoons(name)
find_cartoon(name, WrappedCartoon)
end
def reversed_cartoons(name)
find_cartoon(name, ReversedCartoon)
end
def funny_cartoons(name)
find_cartoon(name, FunnyCartoon)
end
def silly_cartoons(name)
find_cartoon(name, SillyCartoon)
end
end
class ActsAsOrderedWithScopeTest < Test::Unit::TestCase
fixtures :categories, :projects
def test_first_and_last_a
assert projects(:one).first?
assert projects(:three).last?
assert_equal 1, projects(:two).first_id
assert_equal 3, projects(:two).last_id
assert_equal projects(:one), projects(:one).first
assert_equal projects(:three), projects(:one).last
assert_equal projects(:one), projects(:two).first
assert_equal projects(:three), projects(:two).last
assert_equal projects(:one), projects(:three).first
assert_equal projects(:three), projects(:three).last
end
def test_first_and_last_b
assert projects(:four).first?
assert projects(:seven).last?
assert_equal 4, projects(:five).first_id
assert_equal 7, projects(:five).last_id
assert_equal projects(:four), projects(:four).first
assert_equal projects(:seven), projects(:four).last
assert_equal projects(:four), projects(:five).first
assert_equal projects(:seven), projects(:five).last
assert_equal projects(:four), projects(:six).first
assert_equal projects(:seven), projects(:six).last
assert_equal projects(:four), projects(:seven).first
assert_equal projects(:seven), projects(:seven).last
end
def test_symbol_scope_no_wrapping_a
one = projects(:one)
assert projects(:one).first?
assert projects(:three).last?
assert_equal one, one.previous
assert_equal one, one.next.previous
assert_equal projects(:two), one.next
assert_equal projects(:three), projects(:three).next
assert_equal projects(:three), one.next.next
assert_equal projects(:three), one.next.next.next
assert_equal projects(:three), one.next.next.next.next
end
def test_symbol_scope_no_wrapping_b
assert projects(:four).first?
assert projects(:seven).last?
assert_equal projects(:four), projects(:four).previous
assert_equal projects(:five), projects(:four).next
assert_equal projects(:six), projects(:five).next
assert_equal projects(:seven), projects(:six).next
assert_equal projects(:seven), projects(:seven).next
end
def test_symbol_scope_and_wrapping_a
one = wrapped_projects(:one)
assert wrapped_projects(:one).first?
assert wrapped_projects(:three).last?
assert_equal wrapped_projects(:three), one.previous
assert_equal wrapped_projects(:one), wrapped_projects(:one).next.previous
assert_equal wrapped_projects(:two), wrapped_projects(:one).next
assert_equal wrapped_projects(:three), wrapped_projects(:two).next
assert_equal wrapped_projects(:three), wrapped_projects(:one).next.next
assert_equal wrapped_projects(:one), wrapped_projects(:three).next
end
def test_symbol_scope_and_wrapping_b
assert wrapped_projects(:four).first?
assert wrapped_projects(:seven).last?
assert_equal wrapped_projects(:seven), wrapped_projects(:four).previous
assert_equal wrapped_projects(:five), wrapped_projects(:four).next
assert_equal wrapped_projects(:six), wrapped_projects(:five).next
assert_equal wrapped_projects(:seven), wrapped_projects(:six).next
assert_equal wrapped_projects(:four), wrapped_projects(:seven).next
end
def test_sql_scope_no_wrapping
one = sql_scoped_projects(:one)
assert sql_scoped_projects(:one).first?
assert sql_scoped_projects(:three).last?
assert_equal one, one.previous
assert_equal one, one.next.previous
assert_equal sql_scoped_projects(:two), one.next
assert_equal sql_scoped_projects(:three), sql_scoped_projects(:three).next
assert_equal sql_scoped_projects(:three), one.next.next
assert_equal sql_scoped_projects(:three), one.next.next.next
assert_equal sql_scoped_projects(:three), one.next.next.next.next
end
def test_sql_scope_and_wrapping
one = wrapped_sql_scoped_projects(:one)
assert wrapped_sql_scoped_projects(:one).first?
assert wrapped_sql_scoped_projects(:three).last?
assert_equal wrapped_sql_scoped_projects(:three), one.previous
assert_equal wrapped_sql_scoped_projects(:one), wrapped_sql_scoped_projects(:one).next.previous
assert_equal wrapped_sql_scoped_projects(:two), wrapped_sql_scoped_projects(:one).next
assert_equal wrapped_sql_scoped_projects(:three), wrapped_sql_scoped_projects(:two).next
assert_equal wrapped_sql_scoped_projects(:three), wrapped_sql_scoped_projects(:one).next.next
assert_equal wrapped_sql_scoped_projects(:one), wrapped_sql_scoped_projects(:three).next
end
def test_current_total
assert_equal 3, projects(:one).current_total
assert_equal 4, projects(:four).current_total
end
def test_with_options
project = wrapped_projects(:one).next(:include => :category)
assert project.instance_variable_get('@category')
end
private
def find_project(name, klass)
klass.find(projects(name).id)
end
def wrapped_projects(name)
find_project(name, WrappedProject)
end
def sql_scoped_projects(name)
find_project(name, SQLScopedProject)
end
def wrapped_sql_scoped_projects(name)
find_project(name, WrappedSQLScopedProject)
end
end
class ActsAsOrderedStiTest < Test::Unit::TestCase
fixtures :documents
def test_subclasses
assert_equal documents(:entry_2), documents(:entry_1).next
assert_equal documents(:entry_3), documents(:entry_2).next
assert_equal documents(:entry_2), documents(:entry_3).previous
assert_equal documents(:entry_1), documents(:entry_2).previous
assert_equal documents(:page_2), documents(:page_1).next
assert_equal documents(:page_1), documents(:page_2).previous
end
def test_subclasses_without_sti_scoping
Document._acts_as_ordered_options[:ignore_sti] = true
assert_equal documents(:page_1), documents(:entry_2).next
assert_equal documents(:page_2), documents(:document_2).previous
ensure
Document._acts_as_ordered_options.delete(:ignore_sti)
end
end

View file

@ -0,0 +1,6 @@
mysql:
:adapter: mysql
:host: localhost
:username: rails
:password:
:database: rails_plugin_test

View file

@ -0,0 +1,27 @@
class Cartoon < ActiveRecord::Base
acts_as_ordered :order => 'first_name'
end
class ReversedCartoon < ActiveRecord::Base
set_table_name :cartoons
acts_as_ordered :order => 'last_name desc'
end
class WrappedCartoon < ActiveRecord::Base
set_table_name :cartoons
acts_as_ordered :order => 'last_name', :wrap => true
end
class SillyCartoon < ActiveRecord::Base
set_table_name :cartoons
acts_as_ordered :condition => Proc.new { |c| c.first_name =~ /e/i }
end
class FunnyCartoon < ActiveRecord::Base
set_table_name :cartoons
acts_as_ordered :condition => Proc.new { |r| r.last_name_contains_u? }, :wrap => true
def last_name_contains_u?
last_name =~ /u/
end
end

View file

@ -0,0 +1,19 @@
bugs:
id: 1
first_name: Bugs
last_name: Bunny
daffy:
id: 2
first_name: Daffy
last_name: Duck
elmer:
id: 3
first_name: Elmer
last_name: Fudd
roger:
id: 4
first_name: Roger
last_name: Rabbit

View file

@ -0,0 +1,7 @@
programming:
id: 1
name: Programming
design:
id: 2
name: Design

View file

@ -0,0 +1,3 @@
class Category < ActiveRecord::Base
has_many :projects
end

View file

@ -0,0 +1,9 @@
class Document < ActiveRecord::Base
acts_as_ordered
end
class Entry < Document
end
class Page < Document
end

View file

@ -0,0 +1,35 @@
entry_1:
id: 1
title: Entry 1
type: Entry
entry_2:
id: 2
title: Entry 2
type: Entry
page_1:
id: 3
title: Page 1
type: Page
entry_3:
id: 4
title: Entry 3
type: Entry
document_1:
id: 5
title: Document 1
type:
page_2:
id: 6
title: Page 2
type: Page
document_2:
id: 7
title: Document 2
type:

View file

@ -0,0 +1,20 @@
class Project < ActiveRecord::Base
belongs_to :category
acts_as_ordered :order => 'name', :scope => :category
end
class WrappedProject < ActiveRecord::Base
belongs_to :category
set_table_name :projects
acts_as_ordered :order => 'name', :scope => :category, :wrap => true
end
class SQLScopedProject < ActiveRecord::Base
set_table_name :projects
acts_as_ordered :order => 'name', :scope => 'category_id = #{category_id}'
end
class WrappedSQLScopedProject < ActiveRecord::Base
set_table_name :projects
acts_as_ordered :order => 'name', :scope => 'category_id = #{category_id}', :wrap => true
end

View file

@ -0,0 +1,41 @@
one:
id: 1
category_id: 1
name: A - First Project
description: This is the first one
two:
id: 2
category_id: 1
name: B - Second Project
description: This is the second one
three:
id: 3
category_id: 1
name: C - Third Project
description: This is the third one
four:
id: 4
category_id: 2
name: D - Fourth
description: This is the fourth one
five:
id: 5
category_id: 2
name: E - Fifth
description: This is the fifth one
six:
id: 6
category_id: 2
name: F - Sixth
description: This is the sixth one
seven:
id: 7
category_id: 2
name: G - Seventh
description: This is the seventh one

View file

@ -0,0 +1,21 @@
ActiveRecord::Schema.define :version => 0 do
create_table :cartoons, :force => true do |t|
t.column :first_name, :string
t.column :last_name, :string
end
create_table :categories, :force => true do |t|
t.column :name, :string
end
create_table :projects, :force => true do |t|
t.column :category_id, :integer
t.column :name, :string
t.column :description, :string
end
create_table :documents, :force => true do |t|
t.column :title, :string
t.column :type, :string
end
end

23
vendor/plugins/auto_complete/README vendored Normal file
View file

@ -0,0 +1,23 @@
Example:
# Controller
class BlogController < ApplicationController
auto_complete_for :post, :title
end
# View
<%= text_field_with_auto_complete :post, title %>
By default, auto_complete_for limits the results to 10 entries,
and sorts by the given field.
auto_complete_for takes a third parameter, an options hash to
the find method used to search for the records:
auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
For more examples, see script.aculo.us:
* http://script.aculo.us/demos/ajax/autocompleter
* http://script.aculo.us/demos/ajax/autocompleter_customized
Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license

22
vendor/plugins/auto_complete/Rakefile vendored Normal file
View file

@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test auto_complete plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for auto_complete plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Auto Complete'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

2
vendor/plugins/auto_complete/init.rb vendored Normal file
View file

@ -0,0 +1,2 @@
ActionController::Base.send :include, AutoComplete
ActionController::Base.helper AutoCompleteMacrosHelper

View file

@ -0,0 +1,47 @@
module AutoComplete
def self.included(base)
base.extend(ClassMethods)
end
#
# Example:
#
# # Controller
# class BlogController < ApplicationController
# auto_complete_for :post, :title
# end
#
# # View
# <%= text_field_with_auto_complete :post, title %>
#
# By default, auto_complete_for limits the results to 10 entries,
# and sorts by the given field.
#
# auto_complete_for takes a third parameter, an options hash to
# the find method used to search for the records:
#
# auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
#
# For help on defining text input fields with autocompletion,
# see ActionView::Helpers::JavaScriptHelper.
#
# For more examples, see script.aculo.us:
# * http://script.aculo.us/demos/ajax/autocompleter
# * http://script.aculo.us/demos/ajax/autocompleter_customized
module ClassMethods
def auto_complete_for(object, method, options = {})
define_method("auto_complete_for_#{object}_#{method}") do
find_options = {
:conditions => [ "LOWER(#{method}) LIKE ?", '%' + params[object][method].downcase + '%' ],
:order => "#{method} ASC",
:limit => 10 }.merge!(options)
@items = object.to_s.camelize.constantize.find(:all, find_options)
render :inline => "<%= auto_complete_result @items, '#{method}' %>"
end
end
end
end

View file

@ -0,0 +1,143 @@
module AutoCompleteMacrosHelper
# Adds AJAX autocomplete functionality to the text input field with the
# DOM ID specified by +field_id+.
#
# This function expects that the called action returns an HTML <ul> list,
# or nothing if no entries should be displayed for autocompletion.
#
# You'll probably want to turn the browser's built-in autocompletion off,
# so be sure to include an <tt>autocomplete="off"</tt> attribute with your text
# input field.
#
# The autocompleter object is assigned to a Javascript variable named <tt>field_id</tt>_auto_completer.
# This object is useful if you for example want to trigger the auto-complete suggestions through
# other means than user input (for that specific case, call the <tt>activate</tt> method on that object).
#
# Required +options+ are:
# <tt>:url</tt>:: URL to call for autocompletion results
# in url_for format.
#
# Addtional +options+ are:
# <tt>:update</tt>:: Specifies the DOM ID of the element whose
# innerHTML should be updated with the autocomplete
# entries returned by the AJAX request.
# Defaults to <tt>field_id</tt> + '_auto_complete'
# <tt>:with</tt>:: A JavaScript expression specifying the
# parameters for the XMLHttpRequest. This defaults
# to 'fieldname=value'.
# <tt>:frequency</tt>:: Determines the time to wait after the last keystroke
# for the AJAX request to be initiated.
# <tt>:indicator</tt>:: Specifies the DOM ID of an element which will be
# displayed while autocomplete is running.
# <tt>:tokens</tt>:: A string or an array of strings containing
# separator tokens for tokenized incremental
# autocompletion. Example: <tt>:tokens => ','</tt> would
# allow multiple autocompletion entries, separated
# by commas.
# <tt>:min_chars</tt>:: The minimum number of characters that should be
# in the input field before an Ajax call is made
# to the server.
# <tt>:on_hide</tt>:: A Javascript expression that is called when the
# autocompletion div is hidden. The expression
# should take two variables: element and update.
# Element is a DOM element for the field, update
# is a DOM element for the div from which the
# innerHTML is replaced.
# <tt>:on_show</tt>:: Like on_hide, only now the expression is called
# then the div is shown.
# <tt>:after_update_element</tt>:: A Javascript expression that is called when the
# user has selected one of the proposed values.
# The expression should take two variables: element and value.
# Element is a DOM element for the field, value
# is the value selected by the user.
# <tt>:select</tt>:: Pick the class of the element from which the value for
# insertion should be extracted. If this is not specified,
# the entire element is used.
# <tt>:method</tt>:: Specifies the HTTP verb to use when the autocompletion
# request is made. Defaults to POST.
def auto_complete_field(field_id, options = {})
function = "var #{field_id}_auto_completer = new Ajax.Autocompleter("
function << "'#{field_id}', "
function << "'" + (options[:update] || "#{field_id}_auto_complete") + "', "
function << "'#{url_for(options[:url])}'"
js_options = {}
js_options[:tokens] = array_or_string_for_javascript(options[:tokens]) if options[:tokens]
js_options[:callback] = "function(element, value) { return #{options[:with]} }" if options[:with]
js_options[:indicator] = "'#{options[:indicator]}'" if options[:indicator]
js_options[:select] = "'#{options[:select]}'" if options[:select]
js_options[:paramName] = "'#{options[:param_name]}'" if options[:param_name]
js_options[:frequency] = "#{options[:frequency]}" if options[:frequency]
js_options[:method] = "'#{options[:method].to_s}'" if options[:method]
{ :after_update_element => :afterUpdateElement,
:on_show => :onShow, :on_hide => :onHide, :min_chars => :minChars }.each do |k,v|
js_options[v] = options[k] if options[k]
end
function << (', ' + options_for_javascript(js_options) + ')')
javascript_tag(function)
end
# Use this method in your view to generate a return for the AJAX autocomplete requests.
#
# Example action:
#
# def auto_complete_for_item_title
# @items = Item.find(:all,
# :conditions => [ 'LOWER(description) LIKE ?',
# '%' + request.raw_post.downcase + '%' ])
# render :inline => "<%= auto_complete_result(@items, 'description') %>"
# end
#
# The auto_complete_result can of course also be called from a view belonging to the
# auto_complete action if you need to decorate it further.
def auto_complete_result(entries, field, phrase = nil)
return unless entries
items = entries.map { |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field])) }
content_tag("ul", items.uniq)
end
# Wrapper for text_field with added AJAX autocompletion functionality.
#
# In your controller, you'll need to define an action called
# auto_complete_for to respond the AJAX calls,
#
def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {})
(completion_options[:skip_style] ? "" : auto_complete_stylesheet) +
text_field(object, method, tag_options) +
content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") +
auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options))
end
private
def auto_complete_stylesheet
content_tag('style', <<-EOT, :type => Mime::CSS)
div.auto_complete {
width: 350px;
background: #fff;
}
div.auto_complete ul {
border:1px solid #888;
margin:0;
padding:0;
width:100%;
list-style-type:none;
}
div.auto_complete ul li {
margin:0;
padding:3px;
}
div.auto_complete ul li.selected {
background-color: #ffb;
}
div.auto_complete ul strong.highlight {
color: #800;
margin:0;
padding:0;
}
EOT
end
end

View file

@ -0,0 +1,67 @@
require File.expand_path(File.join(File.dirname(__FILE__), '../../../../test/test_helper'))
class AutoCompleteTest < Test::Unit::TestCase
include AutoComplete
include AutoCompleteMacrosHelper
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::FormHelper
include ActionView::Helpers::CaptureHelper
def setup
@controller = Class.new do
def url_for(options)
url = "http://www.example.com/"
url << options[:action].to_s if options and options[:action]
url
end
end
@controller = @controller.new
end
def test_auto_complete_field
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" });
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {minChars:3})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){alert('me');}})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){alert('me');}");
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {frequency:2})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :frequency => 2);
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {afterUpdateElement:function(element,value){alert('You have chosen: '+value)}})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" },
:after_update_element => "function(element,value){alert('You have chosen: '+value)}");
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {paramName:'huidriwusch'})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch');
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {method:'get'})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get);
end
def test_auto_complete_result
result = [ { :title => 'test1' }, { :title => 'test2' } ]
assert_equal %(<ul><li>test1</li><li>test2</li></ul>),
auto_complete_result(result, :title)
assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li><li>t<strong class=\"highlight\">est</strong>2</li></ul>),
auto_complete_result(result, :title, "est")
resultuniq = [ { :title => 'test1' }, { :title => 'test1' } ]
assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li></ul>),
auto_complete_result(resultuniq, :title, "est")
end
def test_text_field_with_auto_complete
assert_match %(<style type="text/css">),
text_field_with_auto_complete(:message, :recipient)
assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">\n//<![CDATA[\nvar message_recipient_auto_completer = new Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})\n//]]>\n</script>),
text_field_with_auto_complete(:message, :recipient, {}, :skip_style => true)
end
end

View file

@ -0,0 +1,111 @@
= Exception Notifier Plugin for Rails
The Exception Notifier plugin provides a mailer object and a default set of
templates for sending email notifications when errors occur in a Rails
application. The plugin is configurable, allowing programmers to specify:
* the sender address of the email
* the recipient addresses
* the text used to prefix the subject line
The email includes information about the current request, session, and
environment, and also gives a backtrace of the exception.
== Usage
First, include the ExceptionNotifiable mixin in whichever controller you want
to generate error emails (typically ApplicationController):
class ApplicationController < ActionController::Base
include ExceptionNotifiable
...
end
Then, specify the email recipients in your environment:
ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)
And that's it! The defaults take care of the rest.
== Configuration
You can tweak other values to your liking, as well. In your environment file,
just set any or all of the following values:
# defaults to exception.notifier@default.com
ExceptionNotifier.sender_address =
%("Application Error" <app.error@myapp.com>)
# defaults to "[ERROR] "
ExceptionNotifier.email_prefix = "[APP] "
Email notifications will only occur when the IP address is determined not to
be local. You can specify certain addresses to always be local so that you'll
get a detailed error instead of the generic error page. You do this in your
controller (or even per-controller):
consider_local "64.72.18.143", "14.17.21.25"
You can specify subnet masks as well, so that all matching addresses are
considered local:
consider_local "64.72.18.143/24"
The address "127.0.0.1" is always considered local. If you want to completely
reset the list of all addresses (for instance, if you wanted "127.0.0.1" to
NOT be considered local), you can simply do, somewhere in your controller:
local_addresses.clear
== Customization
By default, the notification email includes four parts: request, session,
environment, and backtrace (in that order). You can customize how each of those
sections are rendered by placing a partial named for that part in your
app/views/exception_notifier directory (e.g., _session.rhtml). Each partial has
access to the following variables:
* @controller: the controller that caused the error
* @request: the current request object
* @exception: the exception that was raised
* @host: the name of the host that made the request
* @backtrace: a sanitized version of the exception's backtrace
* @rails_root: a sanitized version of RAILS_ROOT
* @data: a hash of optional data values that were passed to the notifier
* @sections: the array of sections to include in the email
You can reorder the sections, or exclude sections completely, by altering the
ExceptionNotifier.sections variable. You can even add new sections that
describe application-specific data--just add the section's name to the list
(whereever you'd like), and define the corresponding partial. Then, if your
new section requires information that isn't available by default, make sure
it is made available to the email using the exception_data macro:
class ApplicationController < ActionController::Base
...
protected
exception_data :additional_data
def additional_data
{ :document => @document,
:person => @person }
end
...
end
In the above case, @document and @person would be made available to the email
renderer, allowing your new section(s) to access and display them. See the
existing sections defined by the plugin for examples of how to write your own.
== Advanced Customization
By default, the email notifier will only notify on critical errors. For
ActiveRecord::RecordNotFound and ActionController::UnknownAction, it will
simply render the contents of your public/404.html file. Other exceptions
will render public/500.html and will send the email notification. If you want
to use different rules for the notification, you will need to implement your
own rescue_action_in_public method. You can look at the default implementation
in ExceptionNotifiable for an example of how to go about that.
Copyright (c) 2005 Jamis Buck, released under the MIT license

View file

@ -0,0 +1 @@
require "action_mailer"

View file

@ -0,0 +1,99 @@
require 'ipaddr'
# Copyright (c) 2005 Jamis Buck
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module ExceptionNotifiable
def self.included(target)
target.extend(ClassMethods)
end
module ClassMethods
def consider_local(*args)
local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })
end
def local_addresses
addresses = read_inheritable_attribute(:local_addresses)
unless addresses
addresses = [IPAddr.new("127.0.0.1")]
write_inheritable_attribute(:local_addresses, addresses)
end
addresses
end
def exception_data(deliverer=self)
if deliverer == self
read_inheritable_attribute(:exception_data)
else
write_inheritable_attribute(:exception_data, deliverer)
end
end
def exceptions_to_treat_as_404
exceptions = [ActiveRecord::RecordNotFound,
ActionController::UnknownController,
ActionController::UnknownAction]
exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
exceptions
end
end
private
def local_request?
remote = IPAddr.new(request.remote_ip)
!self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?
end
def render_404
respond_to do |type|
type.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" }
type.all { render :nothing => true, :status => "404 Not Found" }
end
end
def render_500
respond_to do |type|
type.html { render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error" }
type.all { render :nothing => true, :status => "500 Error" }
end
end
def rescue_action_in_public(exception)
case exception
when *self.class.exceptions_to_treat_as_404
render_404
else
render_500
deliverer = self.class.exception_data
data = case deliverer
when nil then {}
when Symbol then send(deliverer)
when Proc then deliverer.call(self)
end
ExceptionNotifier.deliver_exception_notification(exception, self,
request, data)
end
end
end

View file

@ -0,0 +1,67 @@
require 'pathname'
# Copyright (c) 2005 Jamis Buck
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class ExceptionNotifier < ActionMailer::Base
@@sender_address = %("Exception Notifier" <exception.notifier@default.com>)
cattr_accessor :sender_address
@@exception_recipients = []
cattr_accessor :exception_recipients
@@email_prefix = "[ERROR] "
cattr_accessor :email_prefix
@@sections = %w(request session environment backtrace)
cattr_accessor :sections
def self.reloadable?; false; end
def exception_notification(exception, controller, request, data={})
subject "#{email_prefix}#{controller.controller_name}##{controller.action_name} (#{exception.class}) #{exception.message.inspect}"
recipients exception_recipients
from sender_address
body data.merge({ :controller => controller, :request => request,
:exception => exception, :host => request.env["HTTP_HOST"],
:backtrace => sanitize_backtrace(exception.backtrace),
:rails_root => rails_root, :data => data,
:sections => sections })
end
def template_root
"#{File.dirname(__FILE__)}/../views"
end
private
def sanitize_backtrace(trace)
re = Regexp.new(/^#{Regexp.escape(rails_root)}/)
trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s }
end
def rails_root
return @rails_root if @rails_root
@rails_root = Pathname.new(RAILS_ROOT).cleanpath.to_s
end
end

View file

@ -0,0 +1,77 @@
require 'pp'
# Copyright (c) 2005 Jamis Buck
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module ExceptionNotifierHelper
VIEW_PATH = "views/exception_notifier"
APP_PATH = "#{RAILS_ROOT}/app/#{VIEW_PATH}"
PARAM_FILTER_REPLACEMENT = "[FILTERED]"
def render_section(section)
RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}")
summary = render_overridable(section).strip
unless summary.blank?
title = render_overridable(:title, :locals => { :title => section }).strip
"#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
end
end
def render_overridable(partial, options={})
if File.exist?(path = "#{APP_PATH}/_#{partial}.rhtml")
render(options.merge(:file => path, :use_full_path => false))
elsif File.exist?(path = "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.rhtml")
render(options.merge(:file => path, :use_full_path => false))
else
""
end
end
def inspect_model_object(model, locals={})
render_overridable(:inspect_model,
:locals => { :inspect_model => model,
:show_instance_variables => true,
:show_attributes => true }.merge(locals))
end
def inspect_value(value)
len = 512
result = object_to_yaml(value).gsub(/\n/, "\n ").strip
result = result[0,len] + "... (#{result.length-len} bytes more)" if result.length > len+20
result
end
def object_to_yaml(object)
object.to_yaml.sub(/^---\s*/m, "")
end
def exclude_raw_post_parameters?
@controller && @controller.respond_to?(:filter_parameters)
end
def filter_sensitive_post_data_parameters(parameters)
exclude_raw_post_parameters? ? @controller.filter_parameters(parameters) : parameters
end
def filter_sensitive_post_data_from_env(env_key, env_value)
return env_value unless exclude_raw_post_parameters?
(env_key =~ /RAW_POST_DATA/i) ? PARAM_FILTER_REPLACEMENT : env_value
end
end

View file

@ -0,0 +1,61 @@
require 'test_helper'
require 'exception_notifier_helper'
class ExceptionNotifierHelperTest < Test::Unit::TestCase
class ExceptionNotifierHelperIncludeTarget
include ExceptionNotifierHelper
end
def setup
@helper = ExceptionNotifierHelperIncludeTarget.new
end
# No controller
def test_should_not_exclude_raw_post_parameters_if_no_controller
assert !@helper.exclude_raw_post_parameters?
end
# Controller, no filtering
class ControllerWithoutFilterParameters; end
def test_should_not_filter_env_values_for_raw_post_data_keys_if_controller_can_not_filter_parameters
stub_controller(ControllerWithoutFilterParameters.new)
assert @helper.filter_sensitive_post_data_from_env("RAW_POST_DATA", "secret").include?("secret")
end
def test_should_not_exclude_raw_post_parameters_if_controller_can_not_filter_parameters
stub_controller(ControllerWithoutFilterParameters.new)
assert !@helper.exclude_raw_post_parameters?
end
def test_should_return_params_if_controller_can_not_filter_parameters
stub_controller(ControllerWithoutFilterParameters.new)
assert_equal :params, @helper.filter_sensitive_post_data_parameters(:params)
end
# Controller with filtering
class ControllerWithFilterParameters
def filter_parameters(params); :filtered end
end
def test_should_filter_env_values_for_raw_post_data_keys_if_controller_can_filter_parameters
stub_controller(ControllerWithFilterParameters.new)
assert !@helper.filter_sensitive_post_data_from_env("RAW_POST_DATA", "secret").include?("secret")
assert @helper.filter_sensitive_post_data_from_env("SOME_OTHER_KEY", "secret").include?("secret")
end
def test_should_exclude_raw_post_parameters_if_controller_can_filter_parameters
stub_controller(ControllerWithFilterParameters.new)
assert @helper.exclude_raw_post_parameters?
end
def test_should_delegate_param_filtering_to_controller_if_controller_can_filter_parameters
stub_controller(ControllerWithFilterParameters.new)
assert_equal :filtered, @helper.filter_sensitive_post_data_parameters(:params)
end
private
def stub_controller(controller)
@helper.instance_variable_set(:@controller, controller)
end
end

View file

@ -0,0 +1,7 @@
require 'test/unit'
require 'rubygems'
require 'active_support'
$:.unshift File.join(File.dirname(__FILE__), '../lib')
RAILS_ROOT = '.' unless defined?(RAILS_ROOT)

View file

@ -0,0 +1 @@
<%= @backtrace.join "\n" %>

View file

@ -0,0 +1,7 @@
<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%>
<% @request.env.keys.sort.each do |key| -%>
* <%= "%*-s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
<% end -%>
* Process: <%= $$ %>
* Server : <%= `hostname -s`.chomp %>

View file

@ -0,0 +1,16 @@
<% if show_attributes -%>
[attributes]
<% attrs = inspect_model.attributes -%>
<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%>
<% attrs.keys.sort.each do |attr| -%>
* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ").strip] %>
<% end -%>
<% end -%>
<% if show_instance_variables -%>
[instance variables]
<% inspect_model.instance_variables.sort.each do |variable| -%>
<%- next if variable == "@attributes" -%>
* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %>
<% end -%>
<% end -%>

View file

@ -0,0 +1,3 @@
* URL: <%= @request.protocol %><%= @host %><%= @request.request_uri %>
* Parameters: <%= filter_sensitive_post_data_parameters(@request.parameters).inspect %>
* Rails root: <%= @rails_root %>

View file

@ -0,0 +1,2 @@
* session id: <%= @request.session.instance_variable_get(:@session_id).inspect %>
* data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %>

View file

@ -0,0 +1,3 @@
-------------------------------
<%= title.to_s.humanize %>:
-------------------------------

View file

@ -0,0 +1,6 @@
A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>:
<%= @exception.message %>
<%= @backtrace.first %>
<%= @sections.map { |section| render_section(section) }.join %>

8
vendor/plugins/haml/init.rb vendored Normal file
View file

@ -0,0 +1,8 @@
begin
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
rescue LoadError
require 'haml' # From gem
end
# Load Haml and Sass
Haml.init_rails(binding)

View file

@ -0,0 +1,20 @@
Copyright (c) 2006 Jesper Rønn-Jensen
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

158
vendor/plugins/l10n-simplified-0.8/README vendored Executable file
View file

@ -0,0 +1,158 @@
= Localization Simplified (aka LocalizationSimplified or L10n-simplified)
Localization Simplified plugin for Ruby on Rails. Really simple localization. Written by Jesper Rønn-Jensen ( http://justaddwater.dk/ )
The goal is to have a dead simple plugin for one-language (non-english) Rails
applications. Many of the existing localization / internationalization plugins are
too big for this and hard to get started with. Just dump this plugin in
/vendor/plugins/, set your language and off you go.
Unlike the more advanced plugins, you don't have to translate anything in your
view files. Just use the standard Rails commands you're used to.
The simple approach also makes limits. Make sure you understand them to decide if
this plugin is right for you.
I use this plugin when creating new projects. Then later in the development
process I can decide to change to a more advanced localization plugin (if necessary)
=== What it does
This plugin modifies the following most used helpers for Rails
* Sets UTF-8 connection to database (known to work with MySQL and PostgreSQL)
* Localized monthnames on date_select etc. (changing the order of Y-M-D, on date_select and datetime_select from 0.7)
* Localized ActiveRecord errors (and error headings)
* Localized distance_of_time_in_words
* Localized to_currency (from 0.7 also changing the order of unit/currency)
* Simple pluralization also available in the lang-file
* Uses standard Rails methods. In this way, there is no tedious rewrite required
to localize your view files
=== Limitations
* More advanced features are not likely to be available here.
* If you want support for multiple languages, use another L10N/I18n plugin, like
GLoc or Globalize
It could be a good idea to take a look at the [comparison chart](http://wiki.rubyonrails.org/rails/pages/InternationalizationComparison) on the Ruby on Rails wiki
=== Version notes
* For Rails 1.1.x or below, use version 0.7.1 of this plugin
* For Rails 1.2 or above, use version 0.8 (or higher) of this plugin
=== Supported languages
Curr ently supported languages:
* English (for running test cases and comparing to normal texts)
* German
* Spanish
* Spanish (argentinian)
* French
* Dutch
* Italian
* Danish
* Swedish
* Finnish
* Canadian French
* Korean
* Swedish Chef, and Pirate talk (just for the fun of it)
* any other language you want. Just dump your translation in the /lib folder
=== Download code
* Project homepage: http://rubyforge.org/projects/l10n-simplified/
* Subversion access: svn checkout svn://rubyforge.org/var/svn/l10n-simplified
* Browse: http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=l10n-simplified
=== Usage:
in init.rb, set your language. That's it. Now your db connection is running UTF-8 and standard Rails output is localized.
If your view files contains text containing non-English characters (such as ß,ö,ñ or å), you probably also want to save your files as UTF-8.
=== Installation:
1. Just copy this plugin into your /vendor/plugins/ folder
2. Choose your lang-file in init.rb (default is Danish because I am Danish)
3. no step three :)
A special note of WARNING: All files here are saved using UTF-8 encoding.
It's not required for working, I guess, but other encodings could bring you in trouble.
=== Your help
Feel free to use, translate, modify and improve this code.
Do send me translations, improvements, etc. I cannot promise to use it,
but chances are that I will unless it bloats the code here completely or makes
code harder to maintain.
I added FIXME notes in the code to indicate where I also could use help.
=== TODO / wishlist
* A Rails application for testing L10n-simplified. This is top of my wish-list.
I'd like it to contain a test suite testing ActiveRecord errors, datehelper, necessary
numberhelper etc.
* Rake task to create a release
* Better tests to verify both hooks in Rails and this plugin
* Better tests to verify each lang-file
* Create rdoc in UTF-8 format and not including every lang-file (only lang_en.rb)
* Rake task that modifies all view-files and converts them to UTF-8
* Also a task that modifies all generators to use UTF-8
=== DONE
* --- release 0.8 ---
* Works with Rails 1.2 (not working with earlier versions)
* Whitespace/formatting modifications. Removed commented code not needed
* Removed code from plugin because Rails 1.2 date_select and datetime_select
now support :order
* ActiveRecord hooks updated for Rails 1.2 (thanks Casper Fabricius)
* Dots after day number in time formats (Danish), to keep it consistent with Date formats
* --- release 0.7.1 ---
* Fixed RJS bug where javascript content-header was overwritten with text/html (thanks Jakob Skjerning)
* Small language corrections by Wijnand Wiersma
* PostGres friendly: Added quotes around ActiveRecord::Base.connection.execute "SET NAMES 'UTF8'" (thanks Wijnand Wiersma)
* German language errors corrected by Matthias Tarasiewicz
* Added "no step three" in installation section :)
* --- release 0.7 ---
* Fixed messed-up ø's and a few wording changes in README
* Override +number_to_currency+ and +datetime_select+ to support :order
even though I prefer these changes to go into Rails Core (2006-10-10)
* Added italian lang file (thanks Michele Franzin) (2006-10-08)
* Added argentinian flavoured Spanish lang File + corrected bug in lang_es (thanks Damian Janowski) (2006-10-03)
* German translation issues (thanks Christian W. Zuckschwerdt) (2006-10-03)
* Fixed typo in README File (thanks Diego Algorta Casamayou) (2006-10-02)
* Bugfix removed incorrect 'then' after 'else' (thanks Michele Franzin)(2006-09-16)
* Added augmented and corrected distance_of_time_in_words from Rails trunk (2006-09-07)
* Added date_select and datetime_select on the helper page (2006-09-07)
* Updated dutch date-time formats, thanks Jeroen Houben (2006-09-07)
* --- release 0.6.1 ---
* Added comments in all lang-files, thanks Jarkko Laine for the idea (2006-09-07)
* Bugfix: Replaced hardcoded string in distance_of_time_in_words when :include_seconds was false (2006-08-30)
* Added Canadian French translation (thanks Daniel) (2006-08-25)
* Added comments in lang-file for documentation of how to localize (2006-08-25)
* Added French translation (thanks Fred Cavazza) (2006-08-25)
* Added Finnish translation (thanks Jarkko Laine) (2006-08-25)
* Bugfix re-added HTTP header for UTF-8. Necessary for some lang-files (2004-08-24)
* --- release 0.6 ---
* Renamed test files to make rake test command work (2006-08-23)
* Localized time "Wed Aug 23 12:38:22 Romance Daylight Time 2006" =>
"onsdag d. 23 august 2006 12:38:22" (Danish)
* Reordering of date_select fields (2006-08-23)
* Test that plugin works with the Rails version it is installed next to (2006-08-20)
* Added Dutch translation lang_nl.rb, thanks to Jeroen Houben (2006-08-20)
* Added Pirate language lang_pirate.rb, thanks to Tobias Michaelsen (2006-08-18)
* Added Date and Time#to_formatted_s with locale specific strings (2006-08-18)
* Added MIT-license, copied from Ruby on Rails (2006-08-13)
* Added tests for plugin (2006-08-13)
* Localized version of Array.to_sentence (2006-08-09)
* Added test scaffold (2006-08-09)
* Added swedish language, thanks to Olle Jonsson (2006-08-09)
* Localized version of to_currency helper (2006-08-07)
=== Credits
This plugin uses a few bits and pieces from other Rails plugins GLoc (http://rubyforge.org/projects/gloc/) and swe_rails (http://opensource.ki.se/swe_rails.html)
Created 2006-07-28 by
Jesper Rønn-Jensen http://justaddwater.dk/
http://rubyforge.org/projects/l10n-simplified/
http://agilewebdevelopment.com/plugins/localization_simplified

22
vendor/plugins/l10n-simplified-0.8/Rakefile vendored Executable file
View file

@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the l10n_simplified plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the l10n_simplified plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'LocalizationSimplified'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

View file

@ -0,0 +1,24 @@
cd ..
svn export l10n-simplified export\l10n-simplified-0.8
(right-click to create zip file)
FIXME make a rake task and
cd export
tar -czf l10n-simplified-0.8.tar.gz l10n-simplified-0.8
# ==========
# other commands that I use with this plugin
# ==========
FIXME Create rdoc in UTF-8 format and not including every lang-file (only lang_en.rb)
FIXME describe upload of rdoc to l10n-simplified website

20
vendor/plugins/l10n-simplified-0.8/init.rb vendored Executable file
View file

@ -0,0 +1,20 @@
# Choose language file here
# ONLY choose one of the ones below:
#require 'lang_en' #default language to run the test cases
#require 'lang_da'
require 'lang_de'
#require 'lang_es'
#require 'lang_fi'
#require 'lang_fr'
#require 'lang_nl'
#require 'lang_ko'
#require 'lang_se'
#require 'lang_chef'
#require 'lang_pirate'
# You can Add your own localization file and add it here
# Also include hook code here
require 'localization_simplified'

View file

@ -0,0 +1,118 @@
# lang_cf.rb
# french canadian translation file
# Translation by Daniel Lepage ( http://www.solulabs.com/ )
module LocalizationSimplified
About = {
:lang => "cf",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "n'est pas inclus dans la liste",
:exclusion => "est réservé",
:invalid => "est non valide",
:confirmation => "ne correspond pas à la confirmation",
:accepted => "doit être accepté",
:empty => "ne peut pas être vide",
:blank => "ne peut pas être laissé à blanc",
:too_long => "dépasse la longueur permise (le maximum étant de %d caractères)",
:too_short => "est trop court (le minimum étant de %d caractères)",
:wrong_length => "n'est pas de la bonne longueur (doit être de %d caractères)",
:taken => "as déjà été pris",
:not_a_number => "n'est pas un nombre",
#Jespers additions:
:error_translation => "erreur",
:error_header => "%s interdit d'enregistrer %s ",
:error_subheader => "Il y a des erreurs dans les champs suivants : "
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "moins de %d secondes",
:half_a_minute => "30 secondes",
:less_than_a_minute => "moins d'une minute",
:one_minute => "1 minute",
:x_minutes => "%d minutes",
:one_hour => "environ 1 heure",
:x_hours => "environ %d heures",
:one_day => "1 jour",
:x_days => "%d jours",
:one_month => "1 mois",
:x_months => "%d mois",
:one_year => "1 an",
:x_years => "%d ans"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre}
AbbrMonthnames = [nil] + %w{Jan Fev Mar Avr Mai Jun Jui Aou Sep Oct Nov Dec}
Daynames = %w{Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi}
AbbrDaynames = %w{Dim Lun Mar Mer Jeu Ven Sam}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "$",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'et',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,119 @@
# lang_chef.rb
# Swedish Chef language file for Ruby on Rails
# Translation by Jesper Rønn-Jensen ( http://justaddwater.dk/ ), via web based translator
module LocalizationSimplified
About = {
:lang => "chef",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "is nut inclooded in zee leest",
:exclusion => "is reserfed",
:invalid => "is infeleed",
:confirmation => "duesn't metch cunffurmeshun",
:accepted => "moost be-a eccepted",
:empty => "cun't be-a impty",
:blank => "ees reeequired",# alternate, formulation: "is required"
:too_long => "is tuu lung (mexeemoom is %d cherecters)",
:too_short => "is tuu shurt (meenimoom is %d cherecters)",
:wrong_length => "is zee vrung lengt (shuoold be-a %d cherecters)",
:taken => "hes elreedy beee tekee",
:not_a_number => "is nut a noomber",
#Jespers additions:
:error_translation => "irrur",
:error_header => "%s pruheebited thees %s frum beeeng sefed. Børk! Børk! Børk!",
:error_subheader => "Zeere-a vere-a prublems veet zee fullooeeng feeelds:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "less thun %d secunds",
:half_a_minute => "helff a meenoote-a",
:less_than_a_minute => "less thun a meenoote-a",
:one_minute => "one-a meenoote-a",
:x_minutes => "%d meenootes",
:one_hour => "ebuoot one-a huoor",
:x_hours => "ebuoot %d huoors",
:one_day => "one-a dey",
:x_days => "%d deys",
:one_month => "one-a munt",
:x_months => "%d munts",
:one_year => "one-a yeer",
:x_years => "%d yeers"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{Junooery Febrooery Merch Epreel Mey Joone-a Jooly Oogoost Seeptembooor Ooctuber Nufember Deezember}
AbbrMonthnames = [nil] + %w{Jun Feb Mer Epr Mey Joon Jool Oog Sep Ooct Nuf Deez}
Daynames = %w{Soondey Mundey Tooesdey Vednesdey Thoorsdey Freedey Setoordey}
AbbrDaynames = %w{Soon Mun Tooe-a Ved Thoo Free Set}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "$",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'eend',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,117 @@
# lang_da.rb
# Danish translation file
# Translation by Jesper Rønn-Jensen ( http://justaddwater.dk/ )
module LocalizationSimplified
About = {
:lang => "da",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "er ikke med på listen",
:exclusion => "er et reserveret ord",
:invalid => "er ugyldig",
:confirmation => "matcher ikke med bekræftelsen",
:accepted => "skal accepteres",
:empty => "kan ikke være tom",
:blank => "skal udfyldes",
:too_long => "er for langt (max er %d tegn)",
:too_short => "er for kort (minimum er %d tegn)",
:wrong_length => "har forkert længde (skal være %d tegn)",
:taken => "er allerede taget",
:not_a_number => "er ikke et tal",
#Jespers additions:
:error_translation => "fejl",
:error_header => "%s forhindrede %s i at blive gemt",
:error_subheader => "Problemer med følgende felter:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "under %d sekunder",
:half_a_minute => "et halvt minut",
:less_than_a_minute => "under et minut",
:one_minute => "1 minut",
:x_minutes => "%d minutter",
:one_hour => "omkring en time",
:x_hours => "omkring %d timer",
:one_day => "1 dag",
:x_days => "%d dage",
:one_month => "1 måned",
:x_months => "%d måneder",
:one_year => "1 år",
:x_years => "%d år"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{januar februar marts april maj juni juli august september oktober november december}
AbbrMonthnames = [nil] + %w{jan feb mar apr maj jun jul aug sep okt nov dec}
Daynames = %w{søndag mandag tirsdag onsdag torsdag fredag lørdag}
AbbrDaynames = %w{søn man tir ons tors fre lør}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%e. %b",
:long => "%e. %B, %Y"
}
TimeFormats = {
:default => "%A d. %d %B %Y %H:%M", #no timezone
:short => "%d. %b %H:%M",
:long => "%d. %B %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "kr.",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:number, :unit] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'og',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
inflect.uncountable %w( fejl )
end

View file

@ -0,0 +1,117 @@
# lang_de.rb
# German translation file
# Translation by Benedikt Huber
# Additions by Matthias Tarasiewicz - parasew (at) gmail
module LocalizationSimplified
About = {
:lang => "de",
:updated => "2006-09-28"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "ist nicht in der Liste gültiger Optionen enthalten",
:exclusion => "ist reserviert",
:invalid => "ist ungültig",
:confirmation => "entspricht nicht der Bestätigung",
:accepted => "muss akzeptiert werden",
:empty => "darf nicht leer sein",
:blank => "wird benötigt",# alternate, formulation: "is required"
:too_long => "ist zu lang (höchstens %d Zeichen)",
:too_short => "ist zu kurz (mindestens %d Zeichen)",
:wrong_length => "hat eine falsche Länge (sollte %d Zeichen sein)",
:taken => "ist schon vergeben",
:not_a_number => "ist keine Zahl",
#Bennis additions
:greater_than => "muss größer sein als %d",
#Jespers additions:
:error_translation => "Fehler",
:error_header => "%s hinderte %s daran, gespeichert zu werden",
:error_subheader => "Es gab folgende Probleme: "
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "weniger als %d Sekunden",
:half_a_minute => "eine halbe Minute",
:less_than_a_minute => "weniger als eine Minute",
:one_minute => "1 Minute",
:x_minutes => "%d Minuten",
:one_hour => "ungefähr 1 Stunde",
:x_hours => "ungefähr %d Stunden",
:one_day => "1 Tag",
:x_days => "%d Tage",
:one_month => "1 Monat",
:x_months => "%d Monate",
:one_year => "1 Jahr",
:x_years => "%d Jahre"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{Januar Februar März April Mai Juni Juli August September Oktober November Dezember}
AbbrMonthnames = [nil] + %w{Jan Feb Mrz Apr Mai Jun Jul Aug Sep Okt Nov Dez}
Daynames = %w{Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag}
AbbrDaynames = %w{So Mo Di Mi Do Fr Sa}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%A, %d %B %Y %H:%M:%S %Z",
:short => "%d %b. %H:%M",
:long => "%d %B %Y, %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:number, :unit] #order is at present unsupported in Rails
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'und',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
inflect.uncountable %w( Fehler )
end

View file

@ -0,0 +1,119 @@
# lang_en.rb
# English baseline translation file. Comes in handy for testing purposes
module LocalizationSimplified
About = {
:lang => "en",
:updated => "2006-09-01"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "is not included in the list",
:exclusion => "is reserved",
:invalid => "is invalid",
:confirmation => "doesn't match confirmation",
:accepted => "must be accepted",
:empty => "can't be empty",
:blank => "can't be blank",# alternate, formulation: "is required"
:too_long => "is too long (maximum is %d characters)",
:too_short => "is too short (minimum is %d characters)",
:wrong_length => "is the wrong length (should be %d characters)",
:taken => "has already been taken",
:not_a_number => "is not a number",
#Jespers additions:
:error_translation => "error",
:error_header => "%s prohibited this %s from being saved",
:error_subheader => "There were problems with the following fields:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "less than %d seconds",
:half_a_minute => "half a minute",
:less_than_a_minute => "less than a minute",
:one_minute => "1 minute",
:x_minutes => "%d minutes",
:one_hour => "about 1 hour",
:x_hours => "about %d hours",
:one_day => "1 day",
:x_days => "%d days",
:one_month => "1 month",
:x_months => "%d months",
:one_year => "1 year",
:x_years => "%d years"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{January February March April May June July August September October November December}
AbbrMonthnames = [nil] + %w{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}
Daynames = %w{Sunday Monday Tuesday Wednesday Thursday Friday Saturday}
AbbrDaynames = %w{Sun Mon Tue Wed Thu Fri Sat}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "$",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'and',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,115 @@
# lang_es.rb
# Spanish translation file.
# Translation by Luis Villa del Campo (www.grancomo.com)
module LocalizationSimplified
About = {
:lang => "es",
:updated => "2006-10-03"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "no está incluido en la lista",
:exclusion => "está reservado",
:invalid => "no es válido",
:confirmation => "no coincide con la conformación",
:accepted => "debe ser aceptado",
:empty => "no puede estar vacío",
:blank => "no puede estar en blanco",# alternate, formulation: "is required"
:too_long => "es demasiado largo (el máximo es %d caracteres)",
:too_short => "es demasiado corto (el mínimo es %d caracteres)",
:wrong_length => "no posee el largo correcto (debería ser de %d caracteres)",
:taken => "ya está ocupado",
:not_a_number => "no es un número",
#Jespers additions:
:error_translation => "error",
:error_header => "%s no permite guardar %s",
:error_subheader => "Ha habido problemas con los siguientes campos:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "menos de %d segundos",
:half_a_minute => "medio minuto",
:less_than_a_minute => "menos de un minuto",
:one_minute => "1 minuto",
:x_minutes => "%d minutos",
:one_hour => "sobre una hora",
:x_hours => "sobre %d horas",
:one_day => "un día",
:x_days => "%d días",
:one_month => "1 mes",
:x_months => "%d meses",
:one_year => "1 año",
:x_years => "%d años"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre}
AbbrMonthnames = [nil] + %w{ene feb mar abr may jun jul ago sep oct nov dic}
Daynames = %w{domingo lunes martes miércoles jueves viernes sábado}
AbbrDaynames = %w{dom lun mar mié jue vie sáb}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'y',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
inflect.plural /^(error)$/i, '\1es'
end

View file

@ -0,0 +1,120 @@
# lang_es-AR.rb
# Argentinean-flavored Spanish translation file.
# Translation by Damian Janowski damian.janowski@gmail.com
# (based on lang_es.rb by Luis Villa del Campo)
module LocalizationSimplified
About = {
:lang => "es-ar",
:updated => "2006-10-03"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "no está incluido en la lista",
:exclusion => "está reservado",
:invalid => "es inválido",
:confirmation => "no coincide con la confirmación",
:accepted => "debe ser aceptado",
:empty => "no puede estar vacío",
:blank => "no puede estar en blanco", # alternate, formulation: "es requerido"
:too_long => "es demasiado largo (el máximo es de %d caracteres)",
:too_short => "es demasiado corto (el mínimo es de %d caracteres)",
:wrong_length => "no posee el largo correcto (debería ser de %d caracteres)",
:taken => "ya está tomado",
:not_a_number => "no es un número",
#Jespers additions:
:error_translation => "error ocurrió",
:error_header => "%s al guardar su %s",
:error_subheader => "Los siguientes campos presentan problemas:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "menos de %d segundos",
:half_a_minute => "medio minuto",
:less_than_a_minute => "menos de un minuto",
:one_minute => "1 minuto",
:x_minutes => "%d minutos",
:one_hour => "una hora",
:x_hours => "%d horas",
:one_day => "un día",
:x_days => "%d días",
:one_month => "un mes",
:x_months => "%d meses",
:one_year => "un año",
:x_years => "%d años"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre}
AbbrMonthnames = [nil] + %w{ene feb mar abr may jun jul ago sep oct nov dic}
Daynames = %w{domingo lunes martes miércoles jueves viernes sábado}
AbbrDaynames = %w{dom lun mar mié jue vie sáb}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%e %b",
:long => "%e de %B de %Y"
}
TimeFormats = {
:default => "%a, %d de %b de %Y %H:%M:%S %z",
:short => "%b %d %H:%M",
:long => "%d de %B de %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "$",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'y',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
inflect.plural /^(error ocurrió)$/i, 'errores ocurrieron'
end

View file

@ -0,0 +1,119 @@
# lang_fi.rb
# Finnish translation file.
# Translation by Jarkko Laine ( http://jlaine.net/ )
module LocalizationSimplified
About = {
:lang => "fi",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "ei löydy listalta",
:exclusion => "on varattu",
:invalid => "on virheellinen",
:confirmation => "ei vastaa vahvistusta",
:accepted => "on hyväksyttävä",
:empty => "ei voi olla tyhjä",
:blank => "ei voi olla tyhjä",
:too_long => "on liian pitkä (maksimi on %d merkkiä)",
:too_short => "on liian lyhyt (minimi on %d merkkiä)",
:wrong_length => "on väärän pituinen (oikea pituus %d merkkiä)",
:taken => "on jo varattu",
:not_a_number => "ei ole numero",
#Jespers additions:
:error_translation => "virhe",
:error_header => "%s esti tämän %s tallentamisen",
:error_subheader => "Seuraavat kentät aiheuttivat ongelmia:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "alle %d sekuntia",
:half_a_minute => "puoli minuuttia",
:less_than_a_minute => "alle minuutti",
:one_minute => "1 minuutti",
:x_minutes => "%d minuuttia",
:one_hour => "noin tunti",
:x_hours => "noin %d tuntia",
:one_day => "1 päivä",
:x_days => "%d päivää",
:one_month => "1 month",
:x_months => "%d months",
:one_year => "1 year",
:x_years => "%d years"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{tammikuu helmikuu maaliskuu huhtikuu toukokuu kesäkuu heinäkuu elokuu syyskuu lokakuu marraskuu joulukuu}
AbbrMonthnames = [nil] + %w{tammi helmi maalis huhti touko kesä heinä elo syys loka marras joulu}
Daynames = %w{sunnuntai maanantai tiistai keskiviikko torstai perjantai lauantai}
AbbrDaynames = %w{su ma ti ke to pe la}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%e.%m.%Y",
:short => "%d.%m.",
:long => "%e. %Bta %Y"
}
TimeFormats = {
:default => "%a %Bn %e. %H:%M:%S %Z %Y",
:short => "%d.%m.%Y %H:%M",
:long => "%a %e. %Bta %Y %T"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => " ", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'ja',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,118 @@
# lang_fr.rb
# Traduction française des messages d'erruer. A compléter ou corriger.
# Translation by Frédéric Cavazza ( www.fredcavazza.net )
module LocalizationSimplified
About = {
:lang => "fr",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "n'est pas inclut dans la liste",
:exclusion => "est réservé",
:invalid => "est invalide",
:confirmation => "ne correspond pas à la confirmation",
:accepted => "doit être accepté",
:empty => "ne peut pas être vide",
:blank => "ne peut pas être vierge",# alternate, formulation: "is required"
:too_long => "est trop long (%d caractères maximum)",
:too_short => "est trop court(%d caractères minimum)",
:wrong_length => "n'est pas de la bonne longueur (devrait être de %d caractères)",
:taken => "est déjà prit",
:not_a_number => "n'est pas le nombre",
#Jespers additions:
:error_translation => "erreur",
:error_header => "%s interdit ce %s d'être sauvegardé",
:error_subheader => "Il y a des problèmes avec les champs suivants :"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "moins de %d secondes",
:half_a_minute => "une demi-minute",
:less_than_a_minute => "moins d'une minute",
:one_minute => "1 minute",
:x_minutes => "%d minutes",
:one_hour => "à peut près 1 heure",
:x_hours => "à peu près %d heures",
:one_day => "1 jour",
:x_days => "%d jours",
:one_month => "1 mois",
:x_months => "%d mois",
:one_year => "1 an",
:x_years => "%d ans"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Decembre}
AbbrMonthnames = [nil] + %w{Jan Fev Mar Avr Mai Jui Jul Aoû Sep Oct Nov Dec}
Daynames = %w{Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi}
AbbrDaynames = %w{Dim Lun Mar Mer Jeu Ven Sam}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'et',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,120 @@
# lang_it.rb
# Traduzione italiana.
module LocalizationSimplified
About = {
:lang => "it",
:updated => "2006-09-16"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "non è incluso nella lista",
:exclusion => "è riservato",
:invalid => "non è valido",
:confirmation => "doesn't match confirmation",
:accepted => "deve essere accettato",
:empty => "non può essere vuoto",
:blank => "è richiesto",# alternate, formulation: "is required"
:too_long => "è troppo lungo (massimo %d caratteri)",
:too_short => "è troppo corto (minimo %d caratteri)",
:wrong_length => "è della lunghezza sbagliata (dovrebbe essere di %d caratteri)",
:taken => "è già stato assegnato",
:not_a_number => "non è un numero",
#Jespers additions:
:error_translation => "errore",
:error_header => "%s impedisce a %s di essere salvato",
:error_subheader => "Ci sono dei problemi con i seguenti campi:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "meno di %d secondi",
:half_a_minute => "mezzo minuto",
:less_than_a_minute => "meno di un minuto",
:one_minute => "un minuto",
:x_minutes => "%d minuti",
:one_hour => "circa un'ora",
:x_hours => "circa %d ore",
:one_day => "un giorno",
:x_days => "%d giorni",
:one_month => "un mese",
:x_months => "%d mesi",
:one_year => "un anno",
:x_years => "%d anni"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w( Gennaio Febbraio Marzo Aprile Maggio Giugno Luglio
Agosto Settembre Ottobre Novembre Dicembre )
Daynames = %w( Domenica Lunedì Martedì Marcoledì Giovedì Venerdì Sabato )
AbbrMonthnames = [nil] + %w( Gen Feb Mar Apr Mag Giu
Lug Ago Set Ott Nov Dic )
AbbrDaynames = %w( Dom Lun Mar Mer Gio Ven Sab )
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%d-%m-%Y",
:short => "%e %b",
:long => "%e %B, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%d %B, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "¤",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'e',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,119 @@
# lang_ko.rb
# Translation by Jeong Mok, Cho ( http://niceview.egloos.com )
module LocalizationSimplified
About = {
:lang => "ko",
:updated => "2006-09-29"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "값은 목록에 없습니다.",
:exclusion => "값은 이미 사용중입니다.",
:invalid => "값이 잘못되었습니다.",
:confirmation => "가 일치하지 않습니다.",
:accepted => "항목이 채크되어야 합니다.",
:empty => "값은 꼭 입력하셔야 합니다.",
:blank => "값은 꼭 입력하셔야 합니다.",# alternate, formulation: "is required"
:too_long => "값이 너무 깁니다. (최대 %d자 이내)",
:too_short => "값이 너무 짧습니다. (최소 %d자 이상)",
:wrong_length => "값은 길이가 잘못되었습니다. (%d자로 입력하세요)",
:taken => "값은 이미 사용중입니다.",
:not_a_number => "값은 숫자가 아닙니다.",
#Jespers additions:
:error_translation => "개의 애러",
:error_header => "%s가 발생하였습니다. 이 %s는(은) 저장되지 않았습니다.",
:error_subheader => "다음의 항목에 대한 입력값들이 잘못되었습니다."
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "%d초 이내",
:half_a_minute => "30초",
:less_than_a_minute => "1분 이내",
:one_minute => "1분",
:x_minutes => "%d분",
:one_hour => "약 1시간",
:x_hours => "약 %d시간",
:one_day => "1일",
:x_days => "%d일",
:one_month => "1개월",
:x_months => "%d개월",
:one_year => "1년",
:x_years => "%d년"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월}
AbbrMonthnames = [nil] + %w{1 2 3 4 5 6 7 8 9 10 11 12}
Daynames = %w{일요일 월요일 화요일 수요일 목요일 금요일 토요일}
AbbrDaynames = %w{일 월 화 수 목 금 토}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y/%m/%d",
:short => "%m/%d",
:long => "%Y년 %b월 %e일 %A"
}
TimeFormats = {
#:default => "%a, %d %b %Y %H:%M:%S %z",
:default => "%Y/%m/%d (%a) %p %H:%M:%S",
:short => "%H:%M",
:long => "%Y년 %b월 %e일 %A %p %I시 %M분 %S초"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => '그리고',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
inflect.uncountable '개의 애러'
end

View file

@ -0,0 +1,115 @@
# lang_nl.rb
# Dutch translation by Jeroen Houben
module LocalizationSimplified
About = {
:lang => "nl",
:updated => "2006-08-23"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "zit niet in de lijst",
:exclusion => "is gereserveerd",
:invalid => "is ongeldig",
:confirmation => "is niet hetzelfde als de verificatie",
:accepted => "moet worden geaccepteerd",
:empty => "mag niet leeg zijn",
:blank => "mag niet blanko zijn",# alternate, formulation: "is required"
:too_long => "is te lang (maximum is %d karakters)",
:too_short => "is te kort (minimum is %d karakters)",
:wrong_length => "is de verkeerde lengte (dient %d karakters te zijn)",
:taken => "is reeds in gebruik",
:not_a_number => "is geen nummer",
#Jespers additions:
:error_translation => "fout",
:error_header => "%s zorgen ervoor dat %s niet kan worden opgeslagen",
:error_subheader => "Er zijn problemen met de volgende velden:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "minder dan %d seconden",
:half_a_minute => "een halve minuut",
:less_than_a_minute => "minder dan een halve minuut",
:one_minute => "1 minuut",
:x_minutes => "%d minuten",
:one_hour => "ongeveer 1 uur",
:x_hours => "ongeveer %d uur",
:one_day => "1 dag",
:x_days => "%d dagen",
:one_month => "1 maand",
:x_months => "%d maanden",
:one_year => "1 jaar",
:x_years => "%d jaar"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{Januari Februari Maart April Mei Juni Juli Augustus September Oktober November December}
AbbrMonthnames = [nil] + %w{Jan Feb Mar Apr Mei Jun Jul Aug Sep Okt Nov Dec}
Daynames = %w{Zondag Maandag Dinsdag Woensdag Donderdag Vrijdag Zaterdag}
AbbrDaynames = %w{Zo Ma Di Wo Do Vr Za}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%d-%m-%Y",
:short => "%d %b",
:long => "%d %B %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%d %B %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:unit, :number] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'en',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
inflect.irregular 'fout', 'fouten'
end

View file

@ -0,0 +1,119 @@
# lang_pirate.rb
# Pirate baseline translation file.
# Translated by Tobias Michaelsen , additions by Jesper Rønn-Jensen ( http://justaddwater.dk/ )
module LocalizationSimplified
About = {
:lang => "pirate",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "be not included in the list, me hearty",
:exclusion => "be reserrrrved",
:invalid => "be innvalid, m hearty",
:confirmation => "doesn't match confirmation",
:accepted => "must be accepted, arrrrh!",
:empty => "no nay ne'er be empty",
:blank => "no nay be blank, ye scurvy dog!",# alternate, formulation: "is required"
:too_long => "be too vastly in length (no more than %d characters or ye drivin' me nuts)",
:too_short => "be way too short (at least %d characters or ye drivin' me nuts)",
:wrong_length => "be the wrong length (should be %d characters)",
:taken => "has already been taken",
:not_a_number => "be not a number, matey",
#Jespers additions:
:error_translation => "errrorrr",
:error_header => "Ahoy me hearty! %s prohibited ye %s from bein' saved",
:error_subheader => "Turn the steering wheeel and corrrect these fields, arrrrh."
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "less than %d seconds",
:half_a_minute => "half arrr minute",
:less_than_a_minute => "less than arrr minute",
:one_minute => "1 minute ye landlubber",
:x_minutes => "%d minutes accounted ferrrr",
:one_hour => "about one hourrr and a bottle of rum",
:x_hours => "about %d hourrrs and a bottle of rum",
:one_day => "1 day and a dead mans chest arrr",
:x_days => "%d days and a ship full of hornpipes",
:one_month => "1 full moon",
:x_months => "%d full moons",
:one_year => "1 yearrrr",
:x_years => "%d yearrrrrs"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{January February March April May June July August September October November December}
AbbrMonthnames = [nil] + %w{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}
Daynames = %w{Sunday Monday Tuesday Wednesday Thurrrrrrsday Frrriday Saturrrrday}
AbbrDaynames = %w{Sun Mon Tue Wed Thurrrr Frri Sat}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%A, %d %b %Y %H:%M:%S",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:year, :month, :day] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "pieces o' silver",
:separator => ".", #unit separator (between integer part and fraction part)
:delimiter => ",", #delimiter between each group of thousands. Example: 1.234.567
:order => [:number, :unit] #order is at present unsupported in Rails
#to support for instance Danish format, the order is different: Unit comes last (ex. "1.234,00 dkr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'and',
:skip_last_comma => false
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person people'
# inflect.uncountable %w( information )
# end

View file

@ -0,0 +1,116 @@
# lang_se.rb
# Swedish translation file.
# Translation from plugin swe_rails by Ola Bini ( http://ola-bini.blogspot.com/ ) and Olle Jonsson ( http://olleolleolle.dk )
module LocalizationSimplified
About = {
:lang => "se",
:updated => "2006-09-07"
}
class ActiveRecord
# ErrorMessages to override default messages in
# +ActiveRecord::Errors::@@default_error_messages+
# This plugin also replaces hardcoded 3 text messages
# :error_translation is inflected using the Rails
# inflector.
#
# Remember to modify the Inflector with your localized translation
# of "error" and "errors" in the bottom of this file
#
ErrorMessages = {
:inclusion => "finns inte i listan",
:exclusion => "Är reserverat",
:invalid => "Är ogiltigt",
:confirmation => "stämmer inte övererens",
:accepted => "måste vara accepterad",
:empty => "för ej vara tom",
:blank => "för ej vara blank",
:too_long => "Är för lång (maximum är %d tecken)",
:too_short => "Är för kort (minimum är %d tecken)",
:wrong_length => "har fel längd (ska vara %d tecken)",
:taken => "har redan tagits",
:not_a_number => "Är ej ett nummer",
#Jespers additions:
:error_translation => "fel",
:error_header => "%s förhindrade %s från at sparse",
:error_subheader => "Problemar met dissa felterne:"
}
end
# Texts to override +distance_of_time_in_words()+
class DateHelper
Texts = {
:less_than_x_seconds => "mindre än %d sekunder",
:half_a_minute => "en halv minut",
:less_than_a_minute => "mindre än en minut",
:one_minute => "1 minut",
:x_minutes => "%d minutter",
:one_hour => "ungefär 1 timma",
:x_hours => "ungefär %d timmar",
:one_day => "1 dygn",
:x_days => "%d dygn",
:one_month => "1 month",
:x_months => "%d months",
:one_year => "1 year",
:x_years => "%d years"
}
# Rails uses Month names in Date and time select boxes
# (+date_select+ and +datetime_select+ )
# Currently (as of version 1.1.6), Rails doesn't use daynames
Monthnames = [nil] + %w{januari februari mars april maj juni juli augusti september oktober november december}
AbbrMonthnames = [nil] + %w{jan feb mar apr maj jun jul aug sep okt nov dec}
Daynames = %w{söndag måndag tisdag onsdag torsdag fredag lördag}
AbbrDaynames = %w{sön mån tis ons tors fre lör}
# Date and time format syntax explained in http://www.rubycentral.com/ref/ref_c_time.html#strftime
# These are sent to strftime that Ruby's date and time handlers use internally
# Same options as php (that has a better list: http://www.php.net/strftime )
DateFormats = {
:default => "%Y-%m-%d",
:short => "%b %e",
:long => "%B %e, %Y"
}
TimeFormats = {
:default => "%a, %d %b %Y %H:%M:%S %z",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
}
# Set the order of +date_select+ and +datetime_select+ boxes
# Note that at present, the current Rails version only supports ordering of date_select boxes
DateSelectOrder = {
:order => [:day, :month, :year] #default Rails is US ordered: :order => [:year, :month, :day]
}
end
class NumberHelper
# CurrencyOptions are used as default for +Number#to_currency()+
# http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449
CurrencyOptions = {
:unit => "kr.",
:separator => ",", #unit separator (between integer part and fraction part)
:delimiter => ".", #delimiter between each group of thousands. Example: 1.234.567
:order => [:number, :unit] #order is at present unsupported in Rails
#to support for instance Swedish format, the order is different: Unit comes last (ex. "1.234,00 kr.")
}
end
class ArrayHelper
# Modifies +Array#to_sentence()+
# http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274
ToSentenceTexts = {
:connector => 'och',
:skip_last_comma => true
}
end
end
# Use the inflector below to pluralize "error" from
# @@default_error_messages[:error_translation] above (if necessary)
Inflector.inflections do |inflect|
inflect.uncountable %w( fel )
end

View file

@ -0,0 +1,229 @@
# LocalizationSimplified (L10n-simplified)
# Really simple localization for Rails
# By Jesper Rønn-Jensen ( http://justaddwater.dk/ )
# Plugin available at http://rubyforge.org/projects/l10n-simplified/
#
module LocalizationSimplified
@@ignore = "\xFF\xFF\xFF\xFF" # %% == Literal "%" character
# substitute all daynames and monthnames with localized names
# from RUtils plugin
def self.localize_strftime(date='%d.%m.%Y', time='')
date.gsub!(/%%/, @@ignore)
date.gsub!(/%a/, LocalizationSimplified::DateHelper::AbbrDaynames[time.wday])
date.gsub!(/%A/, LocalizationSimplified::DateHelper::Daynames[time.wday])
date.gsub!(/%b/, LocalizationSimplified::DateHelper::AbbrMonthnames[time.mon])
date.gsub!(/%B/, LocalizationSimplified::DateHelper::Monthnames[time.mon])
date.gsub!(@@ignore, '%%')
end
end
module ActiveRecord
class Errors
#Error messages modified in lang file
@@default_error_messages.update(LocalizationSimplified::ActiveRecord::ErrorMessages)
end
end
module ActionView
module Helpers
#Modify ActiveRecord to use error message headers (text from lang-file)
module ActiveRecordHelper
alias_method :old_error_messages_for, :error_messages_for
def error_messages_for(*params)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) {|sum, object| sum + object.errors.count }
unless count.zero?
html = {}
[:id, :class].each do |key|
if options.include?(key)
value = options[key]
html[key] = value unless value.blank?
else
html[key] = 'errorExplanation'
end
end
messages = ActiveRecord:: Errors.default_error_messages
header_message = format( messages[:error_header],
pluralize(count, messages[:error_translation]),
(options[:object_name] ||
params.first).to_s.gsub("_", " "))
error_messages = objects.map {|object| object.errors.full_messages.map {|msg| content_tag(:li, msg) } }
content_tag(:div,
content_tag(options[:header_tag] || :h2, header_message) <<
content_tag(:p, messages[:error_subheader]) <<
content_tag(:ul, error_messages),
html
)
else
''
end
end
end
# Modify DateHelper to use text from lang-file
module DateHelper
#Modify DateHelper distance_of_time_in_words
alias_method :old_distance_of_time_in_words, :distance_of_time_in_words
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
from_time = from_time.to_time if from_time.respond_to?(:to_time)
to_time = to_time.to_time if to_time.respond_to?(:to_time)
distance_in_minutes = (((to_time - from_time).abs)/60).round
distance_in_seconds = ((to_time - from_time).abs).round
#First, I invent a variable (makes it easier for future localization)
messages = LocalizationSimplified::DateHelper::Texts #localized
case distance_in_minutes
when 0..1
return (distance_in_minutes==0) ? messages[:less_than_a_minute] : messages[:one_minute] unless include_seconds
case distance_in_seconds
when 0..5 then format( messages[:less_than_x_seconds], 5 )
when 6..10 then format( messages[:less_than_x_seconds], 10 )
when 11..20 then format( messages[:less_than_x_seconds], 20 )
when 21..40 then messages[:half_a_minute]
when 41..59 then messages[:less_than_a_minute]
else messages[:one_minute]
end
when 2..44 then format(messages[:x_minutes], distance_in_minutes)
when 45..89 then messages[:one_hour]
when 90..1439 then format( messages[:x_hours], (distance_in_minutes.to_f / 60.0).round )
when 1440..2879 then messages[:one_day]
when 2880..43199 then format( messages[:x_days], (distance_in_minutes / 1440).round )
when 43200..86399 then messages[:one_month]
when 86400..525959 then format( messages[:x_months], (distance_in_minutes / 43200).round )
when 525960..1051919 then messages[:one_year]
else format( messages[:x_years], (distance_in_minutes / 525960).round )
end
end
end
# Give default settings to number_to_currency()
module NumberHelper
alias_method :orig_number_to_currency, :number_to_currency
#modify number_to_currency to accept :order option
def number_to_currency(number, options = {})
# Blend default options with localized currency options
options.reverse_merge!(LocalizationSimplified::NumberHelper::CurrencyOptions)
options[:order] ||= [:unit, :number]
options = options.stringify_keys
precision, unit, separator, delimiter = options.delete("precision") { 2 }, options.delete("unit") { "$" }, options.delete("separator") { "." }, options.delete("delimiter") { "," }
separator = "" unless precision > 0
#add leading space before trailing unit
unit = " " + unit if options["order"] == [:number, :unit]
output = ''
begin
options["order"].each do |param|
case param
when :unit
output << unit
when :number
parts = number_with_precision(number, precision).split('.')
output << number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s
end
end
rescue
output = number
end
output
end
end# module NumberHelper
module DateHelper
alias_method :orig_date_select, :date_select
# Blend default options with localized :order option
def date_select(object_name, method, options = {})
options.reverse_merge!(LocalizationSimplified::DateHelper::DateSelectOrder)
orig_date_select(object_name, method, options)
end
alias_method :orig_datetime_select, :datetime_select
# Blend default options with localized :order option
def datetime_select(object_name, method, options = {})
options.reverse_merge!(LocalizationSimplified::DateHelper::DateSelectOrder)
orig_datetime_select(object_name, method, options)
end
end #module DateHelper
end #module Helpers
end #module ActionView
class Array
alias :orig_to_sentence :to_sentence
def to_sentence(options = {})
#Blend default options with sent through options
options.reverse_merge!(LocalizationSimplified::ArrayHelper::ToSentenceTexts)
orig_to_sentence(options)
end
end
# Modification of ruby constants
class Date
#FIXME as these are defined as Ruby constants, they can not be overwritten
MONTHNAMES = LocalizationSimplified::DateHelper::Monthnames
ABBR_MONTHNAMES = LocalizationSimplified::DateHelper::AbbrMonthnames
#DAYNAMES = LocalizationSimplified::DateHelper::Daynames #not in use by Rails
#ABBR_DAYNAMES = LocalizationSimplified::DateHelper::AbbrDaynames #not in use by Rails
end
# Modification of default Time format using Time.to_formatted_s(:default)
# Localizes the hash with the formats :default, :short, :long
# Usage:
# <% t = Time.parse('2006-12-25 13:55') %>
# <%= t.to_formatted_s(:short) #=> outputs time in localized format %>
# <%= t #=> outputs time in localized format %>
class Time
alias_method :old_strftime, :strftime
# Pre-translate format of Time before the time string is translated by strftime.
# The <tt>:default</tt> time format is changed by localizing month and daynames.
# Also Rails ActiveSupport allow us to modify the <tt>:default</tt> timeformatting string.
# Originally, its <tt>:default => "%a, %d %b %Y %H:%M:%S %z"</tt> (RFC2822 names), but as it can be
# modified in this plugin, and we can end up with a different file format in logfiles, etc
def strftime(date)
LocalizationSimplified::localize_strftime(date, self)
old_strftime(date)
end
end
# Modification of default Date format using Date.to_formatted_s(:default)
# Localizes the hash with the formats :default, :short, :long
# Usage:
# <% d = Date.parse('2006-12-25') %>
# <%= d.to_formatted_s(:short) #=> outputs date in localized format %>
#
# FIXME The Time conversion still does not modify week day and month (for some reason)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(LocalizationSimplified::DateHelper::DateFormats)
# Modification of default Time format using Time.to_formatted_s(:default)
# Localizes the hash with the formats :default, :short, :long
# Usage:
# <% t = Time.parse('2006-12-25 13:55') %>
# <%= t.to_formatted_s(:short) #=> outputs time in localized format %>
# <%= t #=> outputs time in localized format %>
#
# FIXME The Time conversion still does not modify week day and month (for some reason)
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(LocalizationSimplified::DateHelper::TimeFormats)
# Modify Actioncontroller to always use UTF-8
# Currently this modifies MySQL. Please add other databases you find necessary
class ActionController::Base
before_filter :configure_charsets
def configure_charsets(charset='utf-8')
# Set connection charset. MySQL 4.0 doesn't support this so it
# will throw an error, MySQL 4.1+ needs this.
suppress(ActiveRecord::StatementInvalid) do
ActiveRecord::Base.connection.execute "SET NAMES 'UTF8'"
end
end
end

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionController</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionController</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="ActionController/Base.html" class="link">ActionController::Base</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: ActionController::Base</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">ActionController::Base</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Modify Actioncontroller to always use UTF-8 Currently this modifies MySQL.
Please add other databases you find necessary
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000003">configure_charsets</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000003" class="method-detail">
<a name="M000003"></a>
<div class="method-heading">
<a href="#M000003" class="method-signature">
<span class="method-name">configure_charsets</span><span class="method-args">(charset='utf-8')</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000003-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 197</span>
197: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_charsets</span>(<span class="ruby-identifier">charset</span>=<span class="ruby-value str">'utf-8'</span>)
198: <span class="ruby-identifier">$KCODE</span> = <span class="ruby-value str">'u'</span>
199: <span class="ruby-comment cmt"># Response header necessary with some lang-files (like lang_pirate.rb for some reason)</span>
200: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Content-Type&quot;</span>] = <span class="ruby-value str">&quot;text/html; charset=utf-8&quot;</span>
201:
202: <span class="ruby-comment cmt"># Set connection charset. MySQL 4.0 doesn't support this so it</span>
203: <span class="ruby-comment cmt"># will throw an error, MySQL 4.1 needs this</span>
204: <span class="ruby-identifier">suppress</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StatementInvalid</span>) <span class="ruby-keyword kw">do</span>
205: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">execute</span> <span class="ruby-value str">'SET NAMES UTF8'</span>
206: <span class="ruby-keyword kw">end</span>
207: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Give default settings to number_to_currency()
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="ActionView/Helpers.html" class="link">ActionView::Helpers</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView::Helpers</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView::Helpers</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Helpers/ActiveRecordHelper.html" class="link">ActionView::Helpers::ActiveRecordHelper</a><br />
Module <a href="Helpers/DateHelper.html" class="link">ActionView::Helpers::DateHelper</a><br />
Module <a href="Helpers/NumberHelper.html" class="link">ActionView::Helpers::NumberHelper</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView::Helpers::ActiveRecordHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView::Helpers::ActiveRecordHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Modify <a href="../../ActiveRecord.html">ActiveRecord</a> to use error
message headers (text from lang-file)
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000005">error_messages_for</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">error_messages_for</td>
<td>-></td>
<td class="context-item-value">old_error_messages_for</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000005" class="method-detail">
<a name="M000005"></a>
<div class="method-heading">
<a href="#M000005" class="method-signature">
<span class="method-name">error_messages_for</span><span class="method-args">(object_name, options = {})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000005-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 65</span>
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_messages_for</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">options</span> = {})
66: <span class="ruby-identifier">messages</span> = <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span>.<span class="ruby-identifier">default_error_messages</span>
67: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys</span>
68: <span class="ruby-identifier">object</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">&quot;@#{object_name}&quot;</span>)
69: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">empty?</span>
70: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">&quot;div&quot;</span>,
71: <span class="ruby-identifier">content_tag</span>(
72: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:header_tag</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;h2&quot;</span>,
73: <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:error_header</span>], <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">count</span>, <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:error_translation</span>]), <span class="ruby-identifier">object_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;_&quot;</span>, <span class="ruby-value str">&quot; &quot;</span>) )
74: <span class="ruby-comment cmt">#&quot;#{pluralize(object.errors.count, &quot;error&quot;)} prohibited this #{object_name.to_s.gsub(&quot;_&quot;, &quot; &quot;)} from being saved&quot;</span>
75: ) <span class="ruby-operator">+</span>
76: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">&quot;p&quot;</span>, <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:error_subheader</span>]) <span class="ruby-operator">+</span>
77: <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">&quot;ul&quot;</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">full_messages</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">msg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">&quot;li&quot;</span>, <span class="ruby-identifier">msg</span>) }),
78: <span class="ruby-value str">&quot;id&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:id</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;errorExplanation&quot;</span>, <span class="ruby-value str">&quot;class&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:class</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;errorExplanation&quot;</span>
79: )
80: <span class="ruby-keyword kw">else</span>
81: <span class="ruby-value str">&quot;&quot;</span>
82: <span class="ruby-keyword kw">end</span>
83: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView::Helpers::DateHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView::Helpers::DateHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Modify <a href="DateHelper.html">DateHelper</a> to use text from lang-file
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000007">date_select</a>&nbsp;&nbsp;
<a href="#M000008">datetime_select</a>&nbsp;&nbsp;
<a href="#M000006">distance_of_time_in_words</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">distance_of_time_in_words</td>
<td>-></td>
<td class="context-item-value">old_distance_of_time_in_words</td>
</tr>
<tr class="top-aligned-row context-row">
<td>&nbsp;</td>
<td colspan="2" class="context-item-desc">
Modify <a href="DateHelper.html">DateHelper</a> <a
href="DateHelper.html#M000006">distance_of_time_in_words</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">date_select</td>
<td>-></td>
<td class="context-item-value">orig_date_select</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">datetime_select</td>
<td>-></td>
<td class="context-item-value">orig_datetime_select</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000007" class="method-detail">
<a name="M000007"></a>
<div class="method-heading">
<a href="#M000007" class="method-signature">
<span class="method-name">date_select</span><span class="method-args">(object_name, method, options = {})</span>
</a>
</div>
<div class="method-description">
<p>
Blend default options with localized :order option
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000007-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 117</span>
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_select</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
118: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">DateSelectOrder</span>)
119: <span class="ruby-identifier">orig_date_select</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
120: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000008" class="method-detail">
<a name="M000008"></a>
<div class="method-heading">
<a href="#M000008" class="method-signature">
<span class="method-name">datetime_select</span><span class="method-args">(object_name, method, options = {})</span>
</a>
</div>
<div class="method-description">
<p>
Blend default options with localized :order option
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000008-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 126</span>
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">datetime_select</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
127: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">DateSelectOrder</span>)
128: <span class="ruby-identifier">orig_datetime_select</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
129: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000006" class="method-detail">
<a name="M000006"></a>
<div class="method-heading">
<a href="#M000006" class="method-signature">
<span class="method-name">distance_of_time_in_words</span><span class="method-args">(from_time, to_time = 0, include_seconds = false)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000006-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 93</span>
93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">distance_of_time_in_words</span>(<span class="ruby-identifier">from_time</span>, <span class="ruby-identifier">to_time</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">include_seconds</span> = <span class="ruby-keyword kw">false</span>)
94: <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-identifier">distance_of_time_in_words</span>(<span class="ruby-identifier">from_time</span>, <span class="ruby-identifier">to_time</span>, <span class="ruby-identifier">include_seconds</span>)
95: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView::Helpers::NumberHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView::Helpers::NumberHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000004">number_to_currency</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">number_to_currency</td>
<td>-></td>
<td class="context-item-value">orig_number_to_currency</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000004" class="method-detail">
<a name="M000004"></a>
<div class="method-heading">
<a href="#M000004" class="method-signature">
<span class="method-name">number_to_currency</span><span class="method-args">(number, options = {})</span>
</a>
</div>
<div class="method-description">
<p>
Blend default options with localized currency options
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000004-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 107</span>
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">number_to_currency</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">options</span> = {})
108: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">CurrencyOptions</span>)
109: <span class="ruby-identifier">orig_number_to_currency</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">options</span>)
110: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActiveRecord</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActiveRecord</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="ActiveRecord/Errors.html" class="link">ActiveRecord::Errors</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: ActiveRecord::Errors</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">ActiveRecord::Errors</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Array</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Array</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000002">to_sentence</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">to_sentence</td>
<td>-></td>
<td class="context-item-value">orig_to_sentence</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">to_sentence</span><span class="method-args">(options = {})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 137</span>
137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">options</span> = {})
138: <span class="ruby-comment cmt">#Blend default options with sent through options</span>
139: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">ArrayHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">ToSentenceTexts</span>)
140: <span class="ruby-identifier">orig_to_sentence</span>(<span class="ruby-identifier">options</span>)
141: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Date</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Date</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Modification of ruby constants
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">MONTHNAMES</td>
<td>=</td>
<td class="context-item-value">LocalizationSimplified::DateHelper::Monthnames</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
FIXME as these are defined as Ruby constants, they can&#8217;t be
overwritten
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,344 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: LocalizationSimplified</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">LocalizationSimplified</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/lang_cf_rb.html">
lib/lang_cf.rb
</a>
<br />
<a href="../files/lib/lang_chef_rb.html">
lib/lang_chef.rb
</a>
<br />
<a href="../files/lib/lang_da_rb.html">
lib/lang_da.rb
</a>
<br />
<a href="../files/lib/lang_de_rb.html">
lib/lang_de.rb
</a>
<br />
<a href="../files/lib/lang_en_rb.html">
lib/lang_en.rb
</a>
<br />
<a href="../files/lib/lang_es_rb.html">
lib/lang_es.rb
</a>
<br />
<a href="../files/lib/lang_fi_rb.html">
lib/lang_fi.rb
</a>
<br />
<a href="../files/lib/lang_fr_rb.html">
lib/lang_fr.rb
</a>
<br />
<a href="../files/lib/lang_fr__rb.html">
lib/lang_fr_.rb
</a>
<br />
<a href="../files/lib/lang_nl_rb.html">
lib/lang_nl.rb
</a>
<br />
<a href="../files/lib/lang_pirate_rb.html">
lib/lang_pirate.rb
</a>
<br />
<a href="../files/lib/lang_se_rb.html">
lib/lang_se.rb
</a>
<br />
<a href="../files/lib/lang_template_rb.html">
lib/lang_template.rb
</a>
<br />
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="LocalizationSimplified.html">LocalizationSimplified</a> Really
simple localization for Rails By Jesper Rønn-Jensen ( <a
href="http://justaddwater.dk">justaddwater.dk</a>/ ) Plugin available at <a
href="http://rubyforge.org/projects/l10n-simplified">rubyforge.org/projects/l10n-simplified</a>/
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000010">distance_of_time_in_words</a>&nbsp;&nbsp;
<a href="#M000009">localize_strftime</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Class <a href="LocalizationSimplified/ActiveRecord.html" class="link">LocalizationSimplified::ActiveRecord</a><br />
Class <a href="LocalizationSimplified/ArrayHelper.html" class="link">LocalizationSimplified::ArrayHelper</a><br />
Class <a href="LocalizationSimplified/DateHelper.html" class="link">LocalizationSimplified::DateHelper</a><br />
Class <a href="LocalizationSimplified/NumberHelper.html" class="link">LocalizationSimplified::NumberHelper</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;cf&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;chef&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;da&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;de&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;en&quot;, :updated =&gt; &quot;2006-09-01&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;es&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;fi&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;fr&quot;, :updated =&gt; &quot;2006-09-03&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;fr&quot;, :updated =&gt; &quot;2006-08-24&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;nl&quot;, :updated =&gt; &quot;2006-08-23&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;pirate&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;se&quot;, :updated =&gt; &quot;2006-09-07&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">About</td>
<td>=</td>
<td class="context-item-value">{ :lang =&gt; &quot;en&quot;,#add locale code here :updated =&gt; &quot;2006-09-01&quot;</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000010" class="method-detail">
<a name="M000010"></a>
<div class="method-heading">
<a href="#M000010" class="method-signature">
<span class="method-name">distance_of_time_in_words</span><span class="method-args">(from_time, to_time = 0, include_seconds = false)</span>
</a>
</div>
<div class="method-description">
<p>
Modify <a href="LocalizationSimplified/DateHelper.html">DateHelper</a> <a
href="LocalizationSimplified.html#M000010">distance_of_time_in_words</a>
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000010-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 20</span>
20: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">distance_of_time_in_words</span>(<span class="ruby-identifier">from_time</span>, <span class="ruby-identifier">to_time</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">include_seconds</span> = <span class="ruby-keyword kw">false</span>)
21: <span class="ruby-identifier">from_time</span> = <span class="ruby-identifier">from_time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">from_time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_time</span>)
22: <span class="ruby-identifier">to_time</span> = <span class="ruby-identifier">to_time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to_time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_time</span>)
23: <span class="ruby-identifier">distance_in_minutes</span> = (((<span class="ruby-identifier">to_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">from_time</span>).<span class="ruby-identifier">abs</span>)<span class="ruby-operator">/</span><span class="ruby-value">60</span>).<span class="ruby-identifier">round</span>
24: <span class="ruby-identifier">distance_in_seconds</span> = ((<span class="ruby-identifier">to_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">from_time</span>).<span class="ruby-identifier">abs</span>).<span class="ruby-identifier">round</span>
25:
26: <span class="ruby-comment cmt">#First, I invent a variable (makes it easier for future i10n)</span>
27: <span class="ruby-identifier">messages</span> = <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">Texts</span> <span class="ruby-comment cmt">#localized</span>
28: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">distance_in_minutes</span>
29: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>
30: <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">distance_in_minutes</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:less_than_a_minute</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:one_minute</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">include_seconds</span>
31: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">distance_in_seconds</span>
32: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:less_than_x_seconds</span>], <span class="ruby-value">5</span> )
33: <span class="ruby-keyword kw">when</span> <span class="ruby-value">6</span><span class="ruby-operator">..</span><span class="ruby-value">10</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:less_than_x_seconds</span>], <span class="ruby-value">10</span> )
34: <span class="ruby-keyword kw">when</span> <span class="ruby-value">11</span><span class="ruby-operator">..</span><span class="ruby-value">20</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:less_than_x_seconds</span>], <span class="ruby-value">20</span> )
35: <span class="ruby-keyword kw">when</span> <span class="ruby-value">21</span><span class="ruby-operator">..</span><span class="ruby-value">40</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:half_a_minute</span>]
36: <span class="ruby-keyword kw">when</span> <span class="ruby-value">41</span><span class="ruby-operator">..</span><span class="ruby-value">59</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:less_than_a_minute</span>]
37: <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:one_minute</span>]
38: <span class="ruby-keyword kw">end</span>
39:
40: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">45</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">format</span>(<span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:x_minutes</span>], <span class="ruby-identifier">distance_in_minutes</span>)
41: <span class="ruby-keyword kw">when</span> <span class="ruby-value">46</span><span class="ruby-operator">..</span><span class="ruby-value">90</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:one_hour</span>]
42: <span class="ruby-keyword kw">when</span> <span class="ruby-value">90</span><span class="ruby-operator">..</span><span class="ruby-value">1440</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:x_hours</span>], (<span class="ruby-identifier">distance_in_minutes</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">60.0</span>).<span class="ruby-identifier">round</span> )
43: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1441</span><span class="ruby-operator">..</span><span class="ruby-value">2880</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:one_day</span>]
44: <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">format</span>( <span class="ruby-identifier">messages</span>[<span class="ruby-identifier">:x_days</span>], (<span class="ruby-identifier">distance_in_minutes</span> <span class="ruby-operator">/</span> <span class="ruby-value">1440</span>).<span class="ruby-identifier">round</span> )
45: <span class="ruby-keyword kw">end</span>
46: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000009" class="method-detail">
<a name="M000009"></a>
<div class="method-heading">
<a href="#M000009" class="method-signature">
<span class="method-name">localize_strftime</span><span class="method-args">(date='%d.%m.%Y', time='')</span>
</a>
</div>
<div class="method-description">
<p>
substitute all daynames and monthnames with localized names from RUtils
plugin
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000009-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 10</span>
10: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">localize_strftime</span>(<span class="ruby-identifier">date</span>=<span class="ruby-value str">'%d.%m.%Y'</span>, <span class="ruby-identifier">time</span>=<span class="ruby-value str">''</span>)
11: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/%%/</span>, <span class="ruby-ivar">@@ignore</span>)
12: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/%a/</span>, <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">AbbrDaynames</span>[<span class="ruby-identifier">time</span>.<span class="ruby-identifier">wday</span>])
13: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/%A/</span>, <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">Daynames</span>[<span class="ruby-identifier">time</span>.<span class="ruby-identifier">wday</span>])
14: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/%b/</span>, <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">AbbrMonthnames</span>[<span class="ruby-identifier">time</span>.<span class="ruby-identifier">mon</span>])
15: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/%B/</span>, <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-constant">DateHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">Monthnames</span>[<span class="ruby-identifier">time</span>.<span class="ruby-identifier">mon</span>])
16: <span class="ruby-identifier">date</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-ivar">@@ignore</span>, <span class="ruby-value str">'%%'</span>)
17: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,376 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: LocalizationSimplified::ActiveRecord</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">LocalizationSimplified::ActiveRecord</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/lang_cf_rb.html">
lib/lang_cf.rb
</a>
<br />
<a href="../../files/lib/lang_chef_rb.html">
lib/lang_chef.rb
</a>
<br />
<a href="../../files/lib/lang_da_rb.html">
lib/lang_da.rb
</a>
<br />
<a href="../../files/lib/lang_de_rb.html">
lib/lang_de.rb
</a>
<br />
<a href="../../files/lib/lang_en_rb.html">
lib/lang_en.rb
</a>
<br />
<a href="../../files/lib/lang_es_rb.html">
lib/lang_es.rb
</a>
<br />
<a href="../../files/lib/lang_fi_rb.html">
lib/lang_fi.rb
</a>
<br />
<a href="../../files/lib/lang_fr_rb.html">
lib/lang_fr.rb
</a>
<br />
<a href="../../files/lib/lang_fr__rb.html">
lib/lang_fr_.rb
</a>
<br />
<a href="../../files/lib/lang_nl_rb.html">
lib/lang_nl.rb
</a>
<br />
<a href="../../files/lib/lang_pirate_rb.html">
lib/lang_pirate.rb
</a>
<br />
<a href="../../files/lib/lang_se_rb.html">
lib/lang_se.rb
</a>
<br />
<a href="../../files/lib/lang_template_rb.html">
lib/lang_template.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;n'est pas inclus dans la liste&quot;, :exclusion =&gt; &quot;est réservé&quot;, :invalid =&gt; &quot;est non valide&quot;, :confirmation =&gt; &quot;ne correspond pas à la confirmation&quot;, :accepted =&gt; &quot;doit être accepté&quot;, :empty =&gt; &quot;ne peut pas être vide&quot;, :blank =&gt; &quot;ne peut pas être laissé à blanc&quot;, :too_long =&gt; &quot;dépasse la longueur permise (le maximum étant de %d caractères)&quot;, :too_short =&gt; &quot;est trop court (le minimum étant de %d caractères)&quot;, :wrong_length =&gt; &quot;n'est pas de la bonne longueur (doit être de %d caractères)&quot;, :taken =&gt; &quot;as déjà été pris&quot;, :not_a_number =&gt; &quot;n'est pas un nombre&quot;, #Jespers additions: :error_translation =&gt; &quot;erreur&quot;, :error_header =&gt; &quot;%s interdit d'enregistrer %s &quot;, :error_subheader =&gt; &quot;Il y a des erreurs dans les champs suivants : &quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;is nut inclooded in zee leest&quot;, :exclusion =&gt; &quot;is reserfed&quot;, :invalid =&gt; &quot;is infeleed&quot;, :confirmation =&gt; &quot;duesn't metch cunffurmeshun&quot;, :accepted =&gt; &quot;moost be-a eccepted&quot;, :empty =&gt; &quot;cun't be-a impty&quot;, :blank =&gt; &quot;ees reeequired&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;is tuu lung (mexeemoom is %d cherecters)&quot;, :too_short =&gt; &quot;is tuu shurt (meenimoom is %d cherecters)&quot;, :wrong_length =&gt; &quot;is zee vrung lengt (shuoold be-a %d cherecters)&quot;, :taken =&gt; &quot;hes elreedy beee tekee&quot;, :not_a_number =&gt; &quot;is nut a noomber&quot;, #Jespers additions: :error_translation =&gt; &quot;irrur&quot;, :error_header =&gt; &quot;%s pruheebited thees %s frum beeeng sefed&quot;, :error_subheader =&gt; &quot;Zeere-a vere-a prublems veet zee fullooeeng feeelds:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;er ikke med på listen&quot;, :exclusion =&gt; &quot;er et reserveret ord&quot;, :invalid =&gt; &quot;er ugyldig&quot;, :confirmation =&gt; &quot;matcher ikke med bekræftelsen&quot;, :accepted =&gt; &quot;skal accepteres&quot;, :empty =&gt; &quot;kan ikke være tom&quot;, :blank =&gt; &quot;skal udfyldes&quot;, :too_long =&gt; &quot;er for langt (max er %d tegn)&quot;, :too_short =&gt; &quot;er for kort (minimum er %d tegn)&quot;, :wrong_length =&gt; &quot;har forkert længde (skal være %d tegn)&quot;, :taken =&gt; &quot;er allerede taget&quot;, :not_a_number =&gt; &quot;er ikke et tal&quot;, #Jespers additions: :error_translation =&gt; &quot;fejl&quot;, :error_header =&gt; &quot;%s forhindrede %s i at blive gemt&quot;, :error_subheader =&gt; &quot;Problemer med følgende felter:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;ist nicht in Liste gültiger Optionen enthalten&quot;, :exclusion =&gt; &quot;ist reserviert&quot;, :invalid =&gt; &quot;ist ungültig&quot;, :confirmation =&gt; &quot;entspricht nicht der Best<73>tigung&quot;, :accepted =&gt; &quot;muß akzeptiert werden&quot;, :empty =&gt; &quot;darf nicht leer sein&quot;, :blank =&gt; &quot;darf nicht leer sein&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;ist zu lang (höchstens %d Zeichen)&quot;, :too_short =&gt; &quot;ist zu kurz (mindestens %d Zeichen)&quot;, :wrong_length =&gt; &quot;hat eine falsche Länge (es sollten %d Zeichen sein)&quot;, :taken =&gt; &quot;ist schon vergeben&quot;, :not_a_number =&gt; &quot;ist keine Zahl&quot;, #Jespers additions: :error_translation =&gt; &quot;Fehl&quot;, :error_header =&gt; &quot;%s verhinderte dieser %s gespeichert werden&quot;, :error_subheader =&gt; &quot;Es gab probleme mit dem folgenden:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;is not included in the list&quot;, :exclusion =&gt; &quot;is reserved&quot;, :invalid =&gt; &quot;is invalid&quot;, :confirmation =&gt; &quot;doesn't match confirmation&quot;, :accepted =&gt; &quot;must be accepted&quot;, :empty =&gt; &quot;can't be empty&quot;, :blank =&gt; &quot;can't be blank&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;is too long (maximum is %d characters)&quot;, :too_short =&gt; &quot;is too short (minimum is %d characters)&quot;, :wrong_length =&gt; &quot;is the wrong length (should be %d characters)&quot;, :taken =&gt; &quot;has already been taken&quot;, :not_a_number =&gt; &quot;is not a number&quot;, #Jespers additions: :error_translation =&gt; &quot;error&quot;, :error_header =&gt; &quot;%s prohibited this %s from being saved&quot;, :error_subheader =&gt; &quot;There were problems with the following fields:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;no está incluido en la lista&quot;, :exclusion =&gt; &quot;está reservado&quot;, :invalid =&gt; &quot;no es válido&quot;, :confirmation =&gt; &quot;no coincide con la conformación&quot;, :accepted =&gt; &quot;debe ser aceptado&quot;, :empty =&gt; &quot;no puede estar vacío&quot;, :blank =&gt; &quot;no puede estar en blanco&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;es demasiado largo (el máximo es %d caracteres)&quot;, :too_short =&gt; &quot;es demasiado cordo (el minimo es %d caracteres)&quot;, :wrong_length =&gt; &quot;is the wrong length (should be %d characters)&quot;, :taken =&gt; &quot;ya está ocupado&quot;, :not_a_number =&gt; &quot;no es un número&quot;, #Jespers additions: :error_translation =&gt; &quot;error&quot;, :error_header =&gt; &quot;%s no permite guardar %s&quot;, :error_subheader =&gt; &quot;Ha habido problemas con los siguientes campos:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;ei löydy listalta&quot;, :exclusion =&gt; &quot;on varattu&quot;, :invalid =&gt; &quot;on virheellinen&quot;, :confirmation =&gt; &quot;ei vastaa vahvistusta&quot;, :accepted =&gt; &quot;on hyväksyttävä&quot;, :empty =&gt; &quot;ei voi olla tyhjä&quot;, :blank =&gt; &quot;ei voi olla tyhjä&quot;, :too_long =&gt; &quot;on liian pitkä (maksimi on %d merkkiä)&quot;, :too_short =&gt; &quot;on liian lyhyt (minimi on %d merkkiä)&quot;, :wrong_length =&gt; &quot;on väärän pituinen (oikea pituus %d merkkiä)&quot;, :taken =&gt; &quot;on jo varattu&quot;, :not_a_number =&gt; &quot;ei ole numero&quot;, #Jespers additions: :error_translation =&gt; &quot;virhe&quot;, :error_header =&gt; &quot;%s esti tämän %s tallentamisen&quot;, :error_subheader =&gt; &quot;Seuraavat kentät aiheuttivat ongelmia:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;n'est pas inclut dans la liste&quot;, :exclusion =&gt; &quot;est réservé&quot;, :invalid =&gt; &quot;est invalide&quot;, :confirmation =&gt; &quot;ne correspond pas à la confirmation&quot;, :accepted =&gt; &quot;doit être accepté&quot;, :empty =&gt; &quot;ne peut pas être vide&quot;, :blank =&gt; &quot;ne peut pas être vierge&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;est trop long (%d caractères maximum)&quot;, :too_short =&gt; &quot;est trop court(%d caractères minimum)&quot;, :wrong_length =&gt; &quot;n'est pas de la bonne longueur (devrait être de %d caractères)&quot;, :taken =&gt; &quot;est déjà prit&quot;, :not_a_number =&gt; &quot;n'est pas le nombre&quot;, #Jespers additions: :error_translation =&gt; &quot;erreur&quot;, :error_header =&gt; &quot;%s interdit ce %s d'être sauvegardé&quot;, :error_subheader =&gt; &quot;Il y a des problèmes avec les champs suivants :&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;n'est pas inclus dans la liste&quot;, :exclusion =&gt; &quot;est réservé&quot;, :invalid =&gt; &quot;est non valide&quot;, :confirmation =&gt; &quot;ne correspond pas à la confirmation&quot;, :accepted =&gt; &quot;doit être accepté&quot;, :empty =&gt; &quot;ne peut pas être vide&quot;, :blank =&gt; &quot;ne peut pas être laissé à blanc&quot;, :too_long =&gt; &quot;dépasse la longueur permise (le maximum étant de %d caractères)&quot;, :too_short =&gt; &quot;est trop court (le minimum étant de %d caractères)&quot;, :wrong_length =&gt; &quot;n'est pas de la bonne longueur (doit être de %d caractères)&quot;, :taken =&gt; &quot;as déjà été pris&quot;, :not_a_number =&gt; &quot;n'est pas un nombre&quot;, #Jespers additions: :error_translation =&gt; &quot;erreur&quot;, :error_header =&gt; &quot;%s interdit d'enregistrer %s &quot;, :error_subheader =&gt; &quot;Il y a des erreurs dans les champs suivants : &quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;zit niet in de lijst&quot;, :exclusion =&gt; &quot;is gereserveerd&quot;, :invalid =&gt; &quot;is ongeldig&quot;, :confirmation =&gt; &quot;is niet hetzelfde als de verificatie&quot;, :accepted =&gt; &quot;moet worden geaccepteerd&quot;, :empty =&gt; &quot;mag niet leeg zijn&quot;, :blank =&gt; &quot;mag niet blanko zijn&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;is te land (maximum is %d karakters)&quot;, :too_short =&gt; &quot;is te kort (minimum is %d karakters)&quot;, :wrong_length =&gt; &quot;is de verkeerde lengte (dient %d karakters te zijn)&quot;, :taken =&gt; &quot;is reeds in gebruik&quot;, :not_a_number =&gt; &quot;is geen nummer&quot;, #Jespers additions: :error_translation =&gt; &quot;fout&quot;, :error_header =&gt; &quot;%s zorgen ervoor dat %s niet kan worden opgeslagen&quot;, :error_subheader =&gt; &quot;Er zijn problemen met de volgende velden:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;be not included in the list, me hearty&quot;, :exclusion =&gt; &quot;be reserrrrved&quot;, :invalid =&gt; &quot;be innvalid, m hearty&quot;, :confirmation =&gt; &quot;doesn't match confirmation&quot;, :accepted =&gt; &quot;must be accepted, arrrrh!&quot;, :empty =&gt; &quot;no nay ne'er be empty&quot;, :blank =&gt; &quot;no nay be blank, ye scurvy dog!&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;be too vastly in length (no more than %d characters or ye drivin' me nuts)&quot;, :too_short =&gt; &quot;be way too short (at least %d characters or ye drivin' me nuts)&quot;, :wrong_length =&gt; &quot;be the wrong length (should be %d characters)&quot;, :taken =&gt; &quot;has already been taken&quot;, :not_a_number =&gt; &quot;be not a number, matey&quot;, #Jespers additions: :error_translation =&gt; &quot;errrorrr&quot;, :error_header =&gt; &quot;Ohoy! %s prohibited ye %s from bein' saved&quot;, :error_subheader =&gt; &quot;Turn the steering wheeel and corrrect these fields, arrrrh.&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;finns inte i listan&quot;, :exclusion =&gt; &quot;Är reserverat&quot;, :invalid =&gt; &quot;Är ogiltigt&quot;, :confirmation =&gt; &quot;stämmer inte övererens&quot;, :accepted =&gt; &quot;måste vara accepterad&quot;, :empty =&gt; &quot;för ej vara tom&quot;, :blank =&gt; &quot;för ej vara blank&quot;, :too_long =&gt; &quot;Är för lång (maximum är %d tecken)&quot;, :too_short =&gt; &quot;Är för kort (minimum är %d tecken)&quot;, :wrong_length =&gt; &quot;har fel längd (ska vara %d tecken)&quot;, :taken =&gt; &quot;har redan tagits&quot;, :not_a_number =&gt; &quot;Är ej ett nummer&quot;, #Jespers additions: :error_translation =&gt; &quot;fel&quot;, :error_header =&gt; &quot;%s förhindrade %s från at sparse&quot;, :error_subheader =&gt; &quot;Problemar met dissa felterne:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ErrorMessages</td>
<td>=</td>
<td class="context-item-value">{ :inclusion =&gt; &quot;is not included in the list&quot;, :exclusion =&gt; &quot;is reserved&quot;, :invalid =&gt; &quot;is invalid&quot;, :confirmation =&gt; &quot;doesn't match confirmation&quot;, :accepted =&gt; &quot;must be accepted&quot;, :empty =&gt; &quot;can't be empty&quot;, :blank =&gt; &quot;can't be blank&quot;,# alternate, formulation: &quot;is required&quot; :too_long =&gt; &quot;is too long (maximum is %d characters)&quot;, :too_short =&gt; &quot;is too short (minimum is %d characters)&quot;, :wrong_length =&gt; &quot;is the wrong length (should be %d characters)&quot;, :taken =&gt; &quot;has already been taken&quot;, :not_a_number =&gt; &quot;is not a number&quot;, #Jespers additions: :error_translation =&gt; &quot;error&quot;, :error_header =&gt; &quot;%s prohibited this %s from being saved&quot;, :error_subheader =&gt; &quot;There were problems with the following fields:&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
ErrorMessages to override default messages in
+ActiveRecord::Errors::@@default_error_messages+ This plugin also replaces
hardcoded 3 text messages :error_translation is inflected using the Rails
inflector.
<p>
Remember to modify the Inflector with your localized translation of
&quot;error&quot; and &quot;errors&quot; in the bottom of this file
</p>
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,304 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: LocalizationSimplified::ArrayHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">LocalizationSimplified::ArrayHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/lang_cf_rb.html">
lib/lang_cf.rb
</a>
<br />
<a href="../../files/lib/lang_chef_rb.html">
lib/lang_chef.rb
</a>
<br />
<a href="../../files/lib/lang_da_rb.html">
lib/lang_da.rb
</a>
<br />
<a href="../../files/lib/lang_de_rb.html">
lib/lang_de.rb
</a>
<br />
<a href="../../files/lib/lang_en_rb.html">
lib/lang_en.rb
</a>
<br />
<a href="../../files/lib/lang_es_rb.html">
lib/lang_es.rb
</a>
<br />
<a href="../../files/lib/lang_fi_rb.html">
lib/lang_fi.rb
</a>
<br />
<a href="../../files/lib/lang_fr_rb.html">
lib/lang_fr.rb
</a>
<br />
<a href="../../files/lib/lang_fr__rb.html">
lib/lang_fr_.rb
</a>
<br />
<a href="../../files/lib/lang_nl_rb.html">
lib/lang_nl.rb
</a>
<br />
<a href="../../files/lib/lang_pirate_rb.html">
lib/lang_pirate.rb
</a>
<br />
<a href="../../files/lib/lang_se_rb.html">
lib/lang_se.rb
</a>
<br />
<a href="../../files/lib/lang_template_rb.html">
lib/lang_template.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'et', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'eend', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'og', :skip_last_comma =&gt; true</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'und', :skip_last_comma =&gt; true</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'and', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'y', :skip_last_comma =&gt; true</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'ja', :skip_last_comma =&gt; true</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'et', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'et', :skip_last_comma =&gt; false</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'en', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'and', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'och', :skip_last_comma =&gt; true</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">ToSentenceTexts</td>
<td>=</td>
<td class="context-item-value">{ :connector =&gt; 'and', :skip_last_comma =&gt; false</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Modifies +<a href="../Array.html#M000002">Array#to_sentence</a>()+ <a
href="http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274">api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.html#M000274</a>
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,969 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: LocalizationSimplified::DateHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">LocalizationSimplified::DateHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/lang_cf_rb.html">
lib/lang_cf.rb
</a>
<br />
<a href="../../files/lib/lang_chef_rb.html">
lib/lang_chef.rb
</a>
<br />
<a href="../../files/lib/lang_da_rb.html">
lib/lang_da.rb
</a>
<br />
<a href="../../files/lib/lang_de_rb.html">
lib/lang_de.rb
</a>
<br />
<a href="../../files/lib/lang_en_rb.html">
lib/lang_en.rb
</a>
<br />
<a href="../../files/lib/lang_es_rb.html">
lib/lang_es.rb
</a>
<br />
<a href="../../files/lib/lang_fi_rb.html">
lib/lang_fi.rb
</a>
<br />
<a href="../../files/lib/lang_fr_rb.html">
lib/lang_fr.rb
</a>
<br />
<a href="../../files/lib/lang_fr__rb.html">
lib/lang_fr_.rb
</a>
<br />
<a href="../../files/lib/lang_nl_rb.html">
lib/lang_nl.rb
</a>
<br />
<a href="../../files/lib/lang_pirate_rb.html">
lib/lang_pirate.rb
</a>
<br />
<a href="../../files/lib/lang_se_rb.html">
lib/lang_se.rb
</a>
<br />
<a href="../../files/lib/lang_template_rb.html">
lib/lang_template.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Texts to override +distance_of_time_in_words()+
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;moins de %d secondes&quot;, :half_a_minute =&gt; &quot;30 secondes&quot;, :less_than_a_minute =&gt; &quot;moins d'une minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d minutes&quot;, :one_hour =&gt; &quot;environ 1 heure&quot;, :x_hours =&gt; &quot;environ %d heures&quot;, :one_day =&gt; &quot;1 jour&quot;, :x_days =&gt; &quot;%d jours&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Fev Mar Avr Mai Jun Jui Aou Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Dim Lun Mar Mer Jeu Ven Sam}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;less thun %d secunds&quot;, :half_a_minute =&gt; &quot;helff a meenoote-a&quot;, :less_than_a_minute =&gt; &quot;less thun a meenoote-a&quot;, :one_minute =&gt; &quot;1 meenoote-a&quot;, :x_minutes =&gt; &quot;%d meenootes&quot;, :one_hour =&gt; &quot;ebuoot 1 huoor&quot;, :x_hours =&gt; &quot;ebuoot %d huoors&quot;, :one_day =&gt; &quot;1 dey&quot;, :x_days =&gt; &quot;%d deys&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Junooery Febrooery Merch Epreel Mey Joone-a Jooly Oogoost Seeptembooor Ooctuber Nufember Deezember}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jun Feb Mer Epr Mey Joon Jool Oog Sep Ooct Nuf Deez}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Soondey Mundey Tooesdey Vednesdey Thoorsdey Freedey Setoordey}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Soon Mun Tooe-a Ved Thoo Free Set}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;under %d sekunder&quot;, :half_a_minute =&gt; &quot;et halvt minut&quot;, :less_than_a_minute =&gt; &quot;under et minut&quot;, :one_minute =&gt; &quot;1 minut&quot;, :x_minutes =&gt; &quot;%d minutter&quot;, :one_hour =&gt; &quot;omkring en time&quot;, :x_hours =&gt; &quot;omkring %d timer&quot;, :one_day =&gt; &quot;1 dag&quot;, :x_days =&gt; &quot;%d dage&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{januar februar marts april maj juni juli august september oktober november december}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{jan feb mar apr maj jun jul aug sep okt nov dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{søndag mandag tirsdag onsdag torsdag fredag lørdag}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{søn man tir ons tors fre lør}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%e %b&quot;, :long =&gt; &quot;%e %B, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%A d. %d %B %Y %H:%M&quot;, #no timezone :short =&gt; &quot;%d. %b %H:%M&quot;, :long =&gt; &quot;%d. %B %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;weniger als %d Sekunden&quot;, :half_a_minute =&gt; &quot;hälfte ein Minute&quot;, :less_than_a_minute =&gt; &quot;weniger als ein Minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d Minuten&quot;, :one_hour =&gt; &quot;ungefähr 1 Stunden&quot;, :x_hours =&gt; &quot;ungefähr %d Stunden&quot;, :one_day =&gt; &quot;1 Tag&quot;, :x_days =&gt; &quot;%d Tage&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Januar Februar Märtz April Mai Juni Juli August September Oktober November Dezember}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Feb Mrz Apr Mai Jun Jul Aug Sep Oct Nov Dez}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Sontag Montag Dienstag Mittwoch Donnerstag Freitag Samstag}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Son Mon Die Mit Don Fre Sam}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;less than %d seconds&quot;, :half_a_minute =&gt; &quot;half a minute&quot;, :less_than_a_minute =&gt; &quot;less than a minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d minutes&quot;, :one_hour =&gt; &quot;about 1 hour&quot;, :x_hours =&gt; &quot;about %d hours&quot;, :one_day =&gt; &quot;1 day&quot;, :x_days =&gt; &quot;%d days&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{January February March April May June July August September October November December}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Sunday Monday Tuesday Wednesday Thursday Friday Saturday}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Sun Mon Tue Wed Thu Fri Sat}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;menos de %d segundos&quot;, :half_a_minute =&gt; &quot;medio minuto&quot;, :less_than_a_minute =&gt; &quot;menos de un minuto&quot;, :one_minute =&gt; &quot;1 minuto&quot;, :x_minutes =&gt; &quot;%d minutos&quot;, :one_hour =&gt; &quot;sobre una hora&quot;, :x_hours =&gt; &quot;sobre %d horas&quot;, :one_day =&gt; &quot;un día&quot;, :x_days =&gt; &quot;%d días&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{ene feb mar abr may jun jul ago sep oct nov dic}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{domingo lunes martes miércoles jueves viernes sábado}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{dom lun mar mié jue vie sáb }</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;alle %d sekuntia&quot;, :half_a_minute =&gt; &quot;puoli minuuttia&quot;, :less_than_a_minute =&gt; &quot;alle minuutti&quot;, :one_minute =&gt; &quot;1 minuutti&quot;, :x_minutes =&gt; &quot;%d minuuttia&quot;, :one_hour =&gt; &quot;noin tunti&quot;, :x_hours =&gt; &quot;noin %d tuntia&quot;, :one_day =&gt; &quot;1 päivä&quot;, :x_days =&gt; &quot;%d päivää&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{tammikuu helmikuu maaliskuu huhtikuu toukokuu kesäkuu heinäkuu elokuu syyskuu lokakuu marraskuu joulukuu}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{tammi helmi maalis huhti touko kesä heinä elo syys loka marras joulu}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{sunnuntai maanantai tiistai keskiviikko torstai perjantai lauantai}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{su ma ti ke to pe la}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%e.%m.%Y&quot;, :short =&gt; &quot;%d.%m.&quot;, :long =&gt; &quot;%e. %Bta %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a %Bn %e. %H:%M:%S %Z %Y&quot;, :short =&gt; &quot;%d.%m.%Y %H:%M&quot;, :long =&gt; &quot;%a %e. %Bta %Y %T&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;moins de %d secondes&quot;, :half_a_minute =&gt; &quot;une demi-minute&quot;, :less_than_a_minute =&gt; &quot;moins d'une minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d minutes&quot;, :one_hour =&gt; &quot;à peut près 1 heure&quot;, :x_hours =&gt; &quot;à peu près %d heures&quot;, :one_day =&gt; &quot;1 jour&quot;, :x_days =&gt; &quot;%d jours&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Decembre}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Fev Mar Avr Mai Jui Jul Aoû Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Dim Lun Mar Mer Jeu Ven Sam}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;moins de %d secondes&quot;, :half_a_minute =&gt; &quot;30 secondes&quot;, :less_than_a_minute =&gt; &quot;moins d'une minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d minutes&quot;, :one_hour =&gt; &quot;environ 1 heure&quot;, :x_hours =&gt; &quot;environ %d heures&quot;, :one_day =&gt; &quot;1 jour&quot;, :x_days =&gt; &quot;%d jours&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Fev Mar Avr Mai Jun Jui Aou Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Dim Lun Mar Mer Jeu Ven Sam}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;minder dan %d seconden&quot;, :half_a_minute =&gt; &quot;een halve minuut&quot;, :less_than_a_minute =&gt; &quot;minder dan een halve minuut&quot;, :one_minute =&gt; &quot;1 minuut&quot;, :x_minutes =&gt; &quot;%d minuten&quot;, :one_hour =&gt; &quot;ongeveer 1 uur&quot;, :x_hours =&gt; &quot;ongeveer %d uur&quot;, :one_day =&gt; &quot;1 dag&quot;, :x_days =&gt; &quot;%d dagen&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Januari Februari Maart April Mei Juni Juli Augustus September October November December}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Feb Mar Apr Mei Jun Jul Aug Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Zondag Maandag Dinsdag Woensdag Donderdag Vrijdag Zaterdag}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Zo Ma Di Wo Do Vr Za}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;less than %d seconds&quot;, :half_a_minute =&gt; &quot;half arrr minute&quot;, :less_than_a_minute =&gt; &quot;less than arrr minute&quot;, :one_minute =&gt; &quot;1 minute ye landlubber&quot;, :x_minutes =&gt; &quot;%d minutes accounted ferrrr&quot;, :one_hour =&gt; &quot;about one hourrr and a bottle of rum&quot;, :x_hours =&gt; &quot;about %d hourrrs and a bottle of rum&quot;, :one_day =&gt; &quot;1 day and a dead mans chest arrr&quot;, :x_days =&gt; &quot;%d days and a ship full of hornpipes&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{January February March April May June July August September October November December}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Sunday Monday Tuesday Wednesday Thurrrrrrsday Frrriday Saturrrrday}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Sun Mon Tue Wed Thurrrr Frri Sat}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%A, %d %b %Y %H:%M:%S&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;mindre än %d sekunder&quot;, :half_a_minute =&gt; &quot;en halv minut&quot;, :less_than_a_minute =&gt; &quot;mindre än en minut&quot;, :one_minute =&gt; &quot;1 minut&quot;, :x_minutes =&gt; &quot;%d minutter&quot;, :one_hour =&gt; &quot;ungefär 1 timma&quot;, :x_hours =&gt; &quot;ungefär %d timmar&quot;, :one_day =&gt; &quot;1 dygn&quot;, :x_days =&gt; &quot;%d dygn&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{januari februari mars april maj juni juli augusti september oktober november december}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Rails uses Month names in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{jan feb mar apr maj jun jul aug sep okt nov dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{söndag måndag tisdag onsdag torsdag fredag lördag}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{sön mån tis ons tors fre lör}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:day, :month, :year]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Texts</td>
<td>=</td>
<td class="context-item-value">{ :less_than_x_seconds =&gt; &quot;less than %d seconds&quot;, :half_a_minute =&gt; &quot;half a minute&quot;, :less_than_a_minute =&gt; &quot;less than a minute&quot;, :one_minute =&gt; &quot;1 minute&quot;, :x_minutes =&gt; &quot;%d minutes&quot;, :one_hour =&gt; &quot;about 1 hour&quot;, :x_hours =&gt; &quot;about %d hours&quot;, :one_day =&gt; &quot;1 day&quot;, :x_days =&gt; &quot;%d days&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Monthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{January February March April May June July August September October November December}</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Monthnames used by Rails in <a href="../Date.html">Date</a> and time select
boxes (<tt>date_select</tt> and <tt>datetime_select</tt> ) Currently (as of
version 1.1.6), Rails doesn&#8217;t use daynames
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrMonthnames</td>
<td>=</td>
<td class="context-item-value">[nil] + %w{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Daynames</td>
<td>=</td>
<td class="context-item-value">%w{Sunday Monday Tuesday Wednesday Thursday Friday Saturday}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">AbbrDaynames</td>
<td>=</td>
<td class="context-item-value">%w{Sun Mon Tue Wed Thu Fri Sat}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%Y-%m-%d&quot;, :short =&gt; &quot;%b %e&quot;, :long =&gt; &quot;%B %e, %Y&quot;</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
<a href="../Date.html">Date</a> and time format syntax explained in <a
href="http://www.rubycentral.com/ref/ref_c_time.html#strftime">www.rubycentral.com/ref/ref_c_time.html#strftime</a>
These are sent to strftime that Ruby&#8217;s date and time handlers use
internally Same options as php (that has a better list: <a
href="http://www.php.net/strftime">www.php.net/strftime</a> )
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TimeFormats</td>
<td>=</td>
<td class="context-item-value">{ :default =&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;, :short =&gt; &quot;%d %b %H:%M&quot;, :long =&gt; &quot;%B %d, %Y %H:%M&quot;</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">DateSelectOrder</td>
<td>=</td>
<td class="context-item-value">{ :order =&gt; [:year, :month, :day]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
Set the order of <tt>date_select</tt> and <tt>datetime_select</tt> boxes
Note that at present, the current Rails version only supports ordering of
date_select boxes
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,304 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: LocalizationSimplified::NumberHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">LocalizationSimplified::NumberHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/lang_cf_rb.html">
lib/lang_cf.rb
</a>
<br />
<a href="../../files/lib/lang_chef_rb.html">
lib/lang_chef.rb
</a>
<br />
<a href="../../files/lib/lang_da_rb.html">
lib/lang_da.rb
</a>
<br />
<a href="../../files/lib/lang_de_rb.html">
lib/lang_de.rb
</a>
<br />
<a href="../../files/lib/lang_en_rb.html">
lib/lang_en.rb
</a>
<br />
<a href="../../files/lib/lang_es_rb.html">
lib/lang_es.rb
</a>
<br />
<a href="../../files/lib/lang_fi_rb.html">
lib/lang_fi.rb
</a>
<br />
<a href="../../files/lib/lang_fr_rb.html">
lib/lang_fr.rb
</a>
<br />
<a href="../../files/lib/lang_fr__rb.html">
lib/lang_fr_.rb
</a>
<br />
<a href="../../files/lib/lang_nl_rb.html">
lib/lang_nl.rb
</a>
<br />
<a href="../../files/lib/lang_pirate_rb.html">
lib/lang_pirate.rb
</a>
<br />
<a href="../../files/lib/lang_se_rb.html">
lib/lang_se.rb
</a>
<br />
<a href="../../files/lib/lang_template_rb.html">
lib/lang_template.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;$&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;$&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;kr. &quot;, :separator =&gt; &quot;,&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;.&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:number, :unit]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;&quot;, :separator =&gt; &quot;,&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;.&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;$&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;&quot;, :separator =&gt; &quot;,&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;.&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;&quot;, :separator =&gt; &quot; &quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;$&quot;, :separator =&gt; &quot;.&quot;, :delimiter =&gt; &quot;,&quot;, :order =&gt; nil</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;pieces o' silver&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;kr. &quot;, :separator =&gt; &quot;,&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;.&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:number, :unit]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">CurrencyOptions</td>
<td>=</td>
<td class="context-item-value">{ :unit =&gt; &quot;$&quot;, :separator =&gt; &quot;.&quot;, #unit separator (between integer part and fraction part) :delimiter =&gt; &quot;,&quot;, #delimiter between each group of thousands. Example: 1.234.567 :order =&gt; [:unit, :number]</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
CurrencyOptions are used as default for +Number#to_currency()+ <a
href="http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449">api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000449</a>
</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Time</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Time</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/localization_simplified_rb.html">
lib/localization_simplified.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Modification of default <a href="Time.html">Time</a> format using
Time.to_formatted_s(:default) Localizes the hash with the formats :default,
:short, :long Usage: &lt;% t = Time.parse(&#8216;2006-12-25 13:55&#8217;)
%&gt; &lt;%= t.to_formatted_s(:short) #=&gt; outputs time in localized
format %&gt; &lt;%= t #=&gt; outputs time in localized format %&gt;
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">strftime</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="aliases-list">
<h3 class="section-bar">External Aliases</h3>
<div class="name-list">
<table summary="aliases">
<tr class="top-aligned-row context-row">
<td class="context-item-name">strftime</td>
<td>-></td>
<td class="context-item-value">old_strftime</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="#M000001" class="method-signature">
<span class="method-name">strftime</span><span class="method-args">(date)</span>
</a>
</div>
<div class="method-description">
<p>
Pre-translate format of <a href="Time.html">Time</a> before the time string
is translated by strftime. The <tt>:default</tt> time format is changed by
localizing month and daynames. Also Rails ActiveSupport allow us to modify
the <tt>:default</tt> timeformatting string. Originally, its <tt>:default
=&gt; &quot;%a, %d %b %Y %H:%M:%S %z&quot;</tt> (RFC2822 names), but as it
can be modified in this plugin, and we can end up with a different file
format in logfiles, etc
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000001-source">
<pre>
<span class="ruby-comment cmt"># File lib/localization_simplified.rb, line 166</span>
166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">date</span>)
167: <span class="ruby-constant">LocalizationSimplified</span><span class="ruby-operator">::</span><span class="ruby-identifier">localize_strftime</span>(<span class="ruby-identifier">date</span>, <span class="ruby-keyword kw">self</span>)
168: <span class="ruby-identifier">old_strftime</span>(<span class="ruby-identifier">date</span>)
169: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
Thu Sep 07 11:04:30 Romance Daylight Time 2006

Some files were not shown because too many files have changed in this diff Show more