This project is archived and is in readonly mode.
human_attribute_name scopes translations differently for nested classes since rails 3.0.2
-
Dalibor Filus
I was just searching for this bug too and you gave me the answer.
I'm running Rails 3.0.3.Problem is.. what happens now if i corrent my locales to this new design, then it will be considered a bug and "fixed"?
:( -
Boguś Tarnowski
to fix this bug try redesign locale files to
structure for namespaced modelsExample
class Hotels::Period
config/locales/pl/models/hotels/period.ymlpl: activerecord: models: hotels: period: 'okres' attributes: hotels: period: name: 'nazwa' start_date: 'początek' end_date: 'koniec' days: 'dni' discount: 'zniżka' -
Robert Pankowecki
My temporary workaround is :
ActiveModel::Name.class_eval do def i18n_key @fixed_i18n_key ||= ActiveSupport::Inflector.underscore(self).to_sym end end -
Boguś Tarnowski
nice work ;)
ive another interesting problem with i18n on forms helpers= form_for(@period, :url => period_path(@period), :html => { :multipart => true, :method => :put }) do |f| = f.label :name, :class => 'form-label size-60 fl-space2'autotranslate :name doesn't work with namespaced models :(
-
Robert Pankowecki
autotranslate :name ??
-
Aditya Sanghi
- Importance changed from to Low
@robert, as i understand, the fix is correct, only the CHANGELOG is not. Right? dot notation should be the correct way.
-
Boguś Tarnowski
@robert
i had tried to do labels with I18n from http://blog.plataformatec.com.br/2010/02/rails-3-i18n-changes/
but this way doesnt worki found answer.
'action_view/helpers/form_helper.rb' lines 890p "#{object_name}.#{method_name}" # me puts here I18n.t("helpers.label.#{object_name}.#{method_name}", :default => "").presence return "hotels_period.name"so in locales yml, keys must be like :
pl:
helpers:label: hotels_period: name: 'nazwa'not
hotels: period: name: 'nazwa'its just another inconsistence ?