ui-alchemy / ui_alchemy-rails

http://www.ui-alchemy.org
MIT License
14 stars 21 forks source link

Fix the unwanted gettext requirement in production #124

Closed jtomasek closed 11 years ago

jtomasek commented 11 years ago

This patch fixes the error the host application that uses i18n gets in production mode.

/alchemy/app/helpers/alchemy/gettext_translations.rb:3:in': undefined method _' for Alchemy::GettextTranslations:Module (NoMethodError)

knowncitizen commented 11 years ago

Oh nice. Let me try this.

ehelms commented 11 years ago

This doesn't just end up masking the error? Shouldn't this particular array not get loaded if :_ is not loaded? As per - https://github.com/ui-alchemy/alchemy/blob/master/app/helpers/alchemy/translation_helper.rb

jtomasek commented 11 years ago

For some reason I am getting error undefined method `_' for Alchemy::GettextTranslations:Module in production. Even thought the array should not be loaded. This patch fixes it. Anyone has better solution?

jtomasek commented 11 years ago

Updated with better fix.

ehelms commented 11 years ago

When you run rake gettext, which is designed to look for _("") declarations, will this pull in those strings in that hash?

knowncitizen commented 11 years ago

Wow, that is a great question @ehelms - I'm not sure that it would...

I wonder if we could dig the strings out...

knowncitizen commented 11 years ago

You took away the check for if respondto?(:)

See my PR: https://github.com/ui-alchemy/alchemy/pull/127

jtomasek commented 11 years ago

Yes, I removed it because I don't call the _() in the TRANSLATIONS. I just specify the strings there. I am not sure it if works for gettext but it does for rails i18n.

knowncitizen commented 11 years ago

This was fixed with #127. Closing.