开发者

Activescaffold Rails 3 (vhochstein) STI localization

开发者 https://www.devze.com 2023-04-02 13:33 出处:网络
Im trying to localize the labels for ActiveScaffold STI children. In development it works fine with just this:

Im trying to localize the labels for ActiveScaffold STI children. In development it works fine with just this:

es:
  activerecord:
    models:
      rule:开发者_开发百科 "Regla"
      concrete_rule: "Regla puntual"
      weekly_rule: "Regla semanal"
      monthly_rule: "Regla mensual"

But in production it always takes the default locale set in application. I know this is an Activescaffold problem and I have solved it for another labels setting the translations inside the key active_scaffold but it's not working for STI. Any help with this ?

EDIT:

I found where activescaffold gets the i18n translation but I still don't know how to make it to take the correct translation in a production environment.

new_sti_link.label = child.to_s.camelize.constantize.model_name.human


Finally I found the only way to achieve what I want is to monkey patch ActiveScaffold to accept lambdas as parameters for the labels and to evaluate them when rendering the view.


You can try to clean cache in your browser. Or change in your production.rb this line from "true" to "false"

config.i18n.fallbacks = false
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号