I'm working in the internationalization/localization of web site using Globalize3 and easy_globalize_accesors and right now I'm adapting the forms to manage fields with possible translations. Suppose I have a class named Role:
class Role
translates :name, :fallbacks_for_empty_translations => true
# rest of class definition
I've done this because I want to show the default translation if there isn't a translation or is empty in the current locale and this works as expected.
But, in my form I want the opposite: I would like to have each input who refers to a different locale than default locale to show no value unless there is a value for that attribute in the role_translations table. Here is how I've created the inputs:
<%= textfield 'role', "name_#{locale}", :class => ... %>
Currently, what happens to me is if I have created a new Role with only the translation for the default locale, when I want to edit the role to add translations to other locales, each input show me the value of default translation.
Thanks in advance
define_method
at runtime is bad for the Global method cache counter. Essentially calling define_method causes every method to have to be re-looked up to see where it should be defined. Not good for performance! – Plod