plataformatec/simple_form — Issue #437: I18n lookups for namespaced classes
Author: Titinux
Created: 2012-02-04 22:53:23+00:00
State: open

Hi,

I found a difference in i18n lookups between rails and simple_form.

In rails the i18n path for an attribute of Mymodule::Myclass is

```
fr:
activerecord:
attributes:
mymodule/myclass:
attribute: attribute_translation
```

but in simple form the module is omitted

```
fr:
simple_form:
hints:
myclass:
attribute: attribute_hint
```

I made some research in rails code to find how mymodule/myclass is generated and I found it is provided by calling Mymodule::Myclass.model_name.i18n_key

```def model_name
@_model_name ||= begin
namespace = self.parents.detect do |n|
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
end
ActiveModel::Name.new(self, namespace)
end
end
```

and ActiveModel::Name instance return i18n_key by doing .underscore.to_sym

So whould it be possible to call (or at least to try) model_name.i18n_key on class to make i18n lookups in simple_form ?

Thanks.