What actually is the use of the :root locale? It is a nice fallback
but do I have to set it manually?

Because now this is something I have an issue with:

I18n.default_locale = 'en-US'
I18n.locale = 'nl-NL'
m=SomeModel.new(:title => 'Dutch title')
m.save
I18n.locale = 'en-US'
m.title # => nil, but I would like to fallback to :root ??

Or am I missing the idea of :root and should it be set manually every
time?

Joost


A fix would be to set the :root locale whenever it isn't set already:

module Globalize
  module Model
    class AttributeStash < Hash

      def write(locale, attr_name, value)
        locale = locale.to_sym
        self[locale] ||= {}
        self[locale][attr_name] = value
        # Set the root if not set
        self[:root] ||= {}
        self[:root][attr_name] ||= value
      end

    end
  end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to