railslove / i18n_viz

Gem to visualize i18n strings within a rails project
MIT License
37 stars 10 forks source link

I18n_viz breaks when iterating over I18n strings #3

Closed paulkoegel closed 12 years ago

paulkoegel commented 12 years ago

Started GET "/?i18n_viz=1" for 127.0.0.1 at 2012-09-18 12:39:15 +0200 Processing by PagesController#index as HTML Parameters: {"i18n_viz"=>"1"} Rendered pages/index.html.haml within layouts/landing (2.7ms) Completed 500 Internal Server Error in 7ms

ActionView::Template::Error (undefined method each' for #<String:0x007f8f89d5c378>): 11: .m-check-list 12: %h2.m-check-list--head= t('landing.choose.usability.headline') 13: %ul.m-check-list--body 14: - t('landing.choose.usability.bullets').each do |key, string| 15: %li.m-check-list--body--item= t("landing.choose.usability.bullets.#{key}") 16: .centered 17: = link_to usability_tests_path, :class => 'm-button__large__with-arrow' do app/views/pages/index.html.haml:14:in_app_views_pages_index_html_haml___4414411902744183083_70127204391500'

jhilden commented 12 years ago

The overridden t() method from i18n_viz turns any output (including as in the example above) into a string, with additional information to extract the i18n information.

For those strings where it is important that they remain untouched you can simply supply an additiona :i18n_viz => false argument to the t() method.

In this case

- t('landing.choose.usability.bullets', :i18n_viz => false).each do |key, string|