Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

arrays from i18n files and html_safe!

#3799

ActionView::Helpers::TranslationHelper.translate in edge calls html_safe! on the return value of I18n.translate regardless of what type it is.

This makes using arrays impossible, because they don't respond to html_safe!. Arrays are used in the "standard" locale files by Sven Fuchs e.a. for day_names, month_names etc.

A simple workaround is this:

class Array

    def html_safe!
            each {|e| e.html_safe!  unless e.nil? }
    end



end

Reported by Marc Schütz · January 27th, 2010 @ 09:51 PM

State: committed
Milestone: 3.0.2
Assigned to: nobody
Importance: Medium

Activity

  1. Marc Schütz
  2. Santiago Pastorino
    Santiago Pastorino
    • Tag changed from i18n, rails3 to i18n, patch, rails3

    Patch with a failing test added

    February 19th, 2010 @ 12:35 AM

  3. Santiago Pastorino
    Santiago Pastorino
    • Milestone cleared.
    • State changed from new to committed

    February 19th, 2010 @ 12:58 AM

  4. MikZ
    MikZ

    its really commited?
    i can't see it in rails 3 beta 3 or master neighter

    May 17th, 2010 @ 01:38 AM

  5. Santiago Pastorino
    Santiago Pastorino

    Yes but i've re-implemented different. Take a look at how is now the translate method on actionpack/lib/action_view/helpers/translation_helper.rb

    May 17th, 2010 @ 04:28 AM

  6. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Medium

    October 15th, 2010 @ 11:01 PM