Forum: Ruby on Rails Rails 2.2.0 and i18n issue / caching problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jochen K. (Guest)
on 2008-10-25 09:12
(Received via mailing list)
I have some issues with the new great i18n features

Everytime I make some chages in my .yml file I need to restart script/
server
to see the changes. It seems to be not a browser caching issue.



/lib/local/de.yml
-----------------
"de":
   txt:
     menue:
       link: "Bitte folgen Sie diesem Link {{link1}}"


.../views/home/index.html.erb
-----------------------------

Link: <%= I18n.t 'txt.menue.link', :link1 => 
mail_to("removed_email_address@domain.invalid",
"xxx") %>


.../controllers/application.rb:
-------------------------------
   def set_locale
     I18n.locale = extract_locale_from_params ||
extract_locale_from_uri || 'de'
     logger.debug "Locale set to '#{I18n.locale}'"
   end

   def available_locales
     AVAILABLE_LOCALES # See config/initializers/locales.rb
   end

   def current_locale?(l)
     l == I18n.locale
   end

   def current_page_path(options={})
     url_for( {:controller => self.controller_name, :action =>
self.action_name}.merge(options) )
   end

   private

   def extract_locale_from_params
     (available_locales.include? params[:locale]) ? params[:locale] :
nil
   end

   def extract_locale_from_uri
     parsed_locale = URI.parse(request.url).host.split('.').last.gsub(/
com/, 'de')
     (available_locales.include? parsed_locale) ? parsed_locale : nil
   end
This topic is locked and can not be replied to.