So... I have got little problem with I18N on my production server...

Development server using webrick when I make POST request (Sending
form) with not existing translation I have got result like:
# translation missing: es, surname translation missing: es,
invalid_field_with_e_end
# translation missing: es, email translation missing: es,
invalid_email_format
# translation missing: es, contact_phone translation missing: es,
invalid_field_with_y_end

It is ok because I dont have this translation....

On Production server using mongrel_cluster... I make SAME request...
and result is translated fields in DEFAULT locale....

To add a sickness ... it is only problem with a HALF of a form...
so.... I got:

# translation missing: es, surname translation missing: es,
invalid_field_with_e_end
# Your email has got Invalid email format
# translation missing: es, contact_phone translation missing: es,
invalid_field_with_y_end

Can someone tell me why ? It is important because when I have got two
languages pl and en I have got half of my form translated in pl and
half in en.... a bit sick...

default is pl
using pl/controller/action  I got proper form
using en/controller/action  I got only a half proper form.... (and
whole good on webrick :|  )

I am using nested attributes and base class is ACCOUNT and this
problem appears exactly with its fields...
COMPANY works FINE !!!

class Account < ActiveRecord::Base
  belongs_to :company

  accepts_nested_attributes_for :company

  attr_accessor :password

  validates_uniqueness_of :email
  validates_presence_of :surname, :name, :message => I18n.t
(:invalid_field_with_e_end)
  validates_presence_of :email, :contact_phone, :message => I18n.t
(:invalid_field_with_y_end)
  validates_length_of :email, :maximum => 100, :message => I18n.t
(:invalid_email_length)
  validates_format_of :email,  :with => /^([...@\s]+)@((?:[-a-z0-9]+\.)+
[a-z]{2,})$/i,  :message => I18n.t(:invalid_email_format)
  validates_length_of :password, :minimum => 8, :message => I18n.t
(:invalid_password_length), :on => :update

  HUMAN_ATTRIBUTES = {
    :email    => I18n.t(:email),
    :name => I18n.t(:name),
    :surname => I18n.t(:surname),
    :password => I18n.t(:password),
    :contact_phone => I18n.t(:contact_phone)
  }
end

and...

class Company < ActiveRecord::Base
  has_one :account
  belongs_to :city

  accepts_nested_attributes_for :city

  validates_uniqueness_of :nip, :regon
  validates_presence_of :name, :message => I18n.t
(:invalid_field_with_a_end)

  validates_presence_of :nip, :regon, :postal_code, :address, :message
=> I18n.t(:invalid_field_with_y_end)

  HUMAN_ATTRIBUTES = {
    :name => I18n.t(:company_name),
    :postal_code => I18n.t(:postal_code),
    :address => I18n.t(:address),
    :nip => I18n.t(:nip),
    :regon => I18n.t(:regon)
  }

  def self.human_attribute_name(attr)
    HUMAN_ATTRIBUTES[attr.to_sym] || super
  end
end

my environment
  config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config',
'locales', '**', '*.{rb,yml}')]
  config.i18n.default_locale = :pl

my application_controller.rb
before_filter :set_locale
  def set_locale
    I18n.locale = params[:locale]
  end

my routes.rb
  map.connect ':locale/:controller/:action/:id', :controller =>
"home", :action => "index"
  map.connect ':locale/:controller/:action/:id.:format'



So.... mongrel and webrick are handling locales atrribute in different
way ?

regards
Piotr MÄ…sior

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to