works but need some cleanup

This commit is contained in:
Wojciech Todryk 2011-06-24 23:48:08 +02:00
parent 0ec83db287
commit e40a859b7d
752 changed files with 4866 additions and 27923 deletions

View file

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View file

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View file

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View file

@ -0,0 +1,36 @@
# config/initializers/pluralization.rb
module I18n::Backend::Pluralization
# rules taken from : http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
def pluralize(locale, entry, n)
return entry unless entry.is_a?(Hash) && n
if n == 0 && entry.has_key?(:zero)
key = :zero
else
key = case locale
when :pl # Polish
n==1 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
when :cs, :sk # Czech, Slovak
n==1 ? :one : (n>=2 && n<=4) ? :few : :other
when lt # Lithuanian
n%10==1 && n%100!=11 ? :one : n%10>=2 && (n%100<10 || n%100>=20) ? :few : :other
when :lv # Latvian
n%10==1 && n%100!=11 ? :one : n != 0 ? :few : :other
when :ru, :uk, :sr, :hr # Russian, Ukrainian, Serbian, Croatian
n%10==1 && n%100!=11 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
when :sl # Slovenian
n%100==1 ? :one : n%100==2 ? :few : n%100==3 || n%100==4 ? :many : :other
when :ro # Romanian
n==1 ? :one : (n==0 || (n%100 > 0 && n%100 < 20)) ? :few : :other
when :gd # Gaeilge
n==1 ? :one : n==2 ? :two : :other;
# add another language if you like...
else
n==1 ? :one : :other # default :en
end
end
raise InvalidPluralizationData.new(entry, n) unless entry.has_key?(key)
entry[key]
end
end
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)

View file

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Rails3::Application.config.secret_token = 'ade84d567b0c637fd3547fd18b97d1677fd6ca3c5331e6ed1a1b13bb6a7823cc367cbe317caf102f29f8c35eb487ff3ca33e6321d037c14ebb055eb530841ff6'

View file

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Rails3::Application.config.session_store :cookie_store, :key => '_rails3_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Rails3::Application.config.session_store :active_record_store